From 9b8f2a1431c42da702d08ba2fbc1ab7bff1aa99f Mon Sep 17 00:00:00 2001 From: Seokhyun Lee <7948302+henrylee97@users.noreply.github.com> Date: Thu, 30 Nov 2023 20:36:17 +0900 Subject: [PATCH 1/2] refactor(java): maven-release (#113) --- Java-base/maven-release/Dockerfile | 28 + Java-base/maven-release/src/Jenkinsfile | 20 + Java-base/maven-release/src/README.TXT | 11 + Java-base/maven-release/src/README.md | 99 + Java-base/maven-release/src/deploySite.bat | 21 + Java-base/maven-release/src/deploySite.sh | 23 + .../src/maven-release-api/pom.xml | 68 + .../release/ReleaseExecutionException.java | 39 + .../release/ReleaseFailureException.java | 34 + .../maven/shared/release/ReleaseResult.java | 135 + .../release/config/ReleaseDescriptor.java | 495 ++++ .../release/env/ReleaseEnvironment.java | 51 + .../release/phase/AbstractReleasePhase.java | 72 + .../shared/release/phase/ReleasePhase.java | 66 + .../release/phase/ResourceGenerator.java | 42 + .../release/policy/PolicyException.java | 39 + .../release/policy/naming/NamingPolicy.java | 41 + .../policy/naming/NamingPolicyRequest.java | 67 + .../policy/naming/NamingPolicyResult.java | 44 + .../release/policy/version/VersionPolicy.java | 53 + .../policy/version/VersionPolicyRequest.java | 57 + .../policy/version/VersionPolicyResult.java | 41 + .../shared/release/strategy/Strategy.java | 58 + .../release/versions/AetherVersion.java | 53 + .../versions/MavenArtifactVersion.java | 109 + .../shared/release/versions/Version.java | 337 +++ .../VersionComparisonConflictException.java | 53 + .../versions/VersionParseException.java | 32 + .../src/maven-release-api/src/site/site.xml | 35 + .../src/maven-release-manager/pom.xml | 289 +++ .../src/main/components-fragment.xml | 261 ++ .../release/AbstractReleaseRequest.java | 87 + .../shared/release/DefaultReleaseManager.java | 699 ++++++ .../DefaultReleaseManagerListener.java | 109 + .../shared/release/ReleaseBranchRequest.java | 80 + .../shared/release/ReleaseCleanRequest.java | 30 + .../maven/shared/release/ReleaseManager.java | 94 + .../release/ReleaseManagerListener.java | 40 + .../shared/release/ReleasePerformRequest.java | 87 + .../shared/release/ReleasePrepareRequest.java | 101 + .../release/ReleaseRollbackRequest.java | 49 + .../release/ReleaseUpdateVersionsRequest.java | 63 + .../PropertiesReleaseDescriptorStore.java | 425 ++++ .../config/ReleaseDescriptorBuilder.java | 459 ++++ .../config/ReleaseDescriptorStore.java | 53 + .../ReleaseDescriptorStoreException.java | 34 + .../shared/release/config/ReleaseUtils.java | 292 +++ .../env/DefaultReleaseEnvironment.java | 124 + .../release/exec/AbstractMavenExecutor.java | 202 ++ .../release/exec/CommandLineFactory.java | 40 + .../exec/DefaultCommandLineFactory.java | 52 + .../release/exec/ForkedMavenExecutor.java | 256 ++ .../release/exec/InvokerMavenExecutor.java | 554 ++++ .../shared/release/exec/MavenExecutor.java | 49 + .../release/exec/MavenExecutorException.java | 48 + .../shared/release/exec/RawStreamPumper.java | 128 + .../shared/release/exec/TeeConsumer.java | 76 + .../shared/release/exec/TeeOutputStream.java | 94 + .../phase/AbstractBackupPomsPhase.java | 58 + .../phase/AbstractReleasePomsPhase.java | 80 + .../phase/AbstractRewritePomsPhase.java | 682 +++++ .../release/phase/AbstractRunGoalsPhase.java | 139 ++ .../release/phase/AbstractScmCommitPhase.java | 259 ++ .../CheckCompletedPreparePhasesPhase.java | 86 + .../phase/CheckDependencySnapshotsPhase.java | 535 ++++ .../shared/release/phase/CheckPomPhase.java | 120 + .../release/phase/CheckoutProjectFromScm.java | 275 ++ .../release/phase/CreateBackupPomsPhase.java | 100 + .../shared/release/phase/EndReleasePhase.java | 68 + .../phase/GenerateReleasePomsPhase.java | 700 ++++++ .../release/phase/InputVariablesPhase.java | 286 +++ .../release/phase/MapVersionsPhase.java | 396 +++ .../release/phase/RemoveReleasePomsPhase.java | 157 ++ .../release/phase/RemoveScmTagPhase.java | 160 ++ .../release/phase/RestoreBackupPomsPhase.java | 143 ++ .../phase/RewritePomVersionsPhase.java | 78 + .../phase/RewritePomsForBranchPhase.java | 257 ++ .../phase/RewritePomsForDevelopmentPhase.java | 106 + .../phase/RewritePomsForReleasePhase.java | 252 ++ .../release/phase/RunCompleteGoalsPhase.java | 71 + .../release/phase/RunPerformGoalsPhase.java | 145 ++ .../release/phase/RunPrepareGoalsPhase.java | 70 + .../shared/release/phase/ScmBranchPhase.java | 165 ++ .../phase/ScmCheckModificationsPhase.java | 206 ++ .../phase/ScmCommitDevelopmentPhase.java | 103 + .../phase/ScmCommitPreparationPhase.java | 86 + .../shared/release/phase/ScmTagPhase.java | 193 ++ .../release/policies/DefaultNamingPolicy.java | 42 + .../policies/DefaultVersionPolicy.java | 56 + .../release/scm/ClearCaseScmTranslator.java | 75 + .../shared/release/scm/CvsScmTranslator.java | 75 + .../scm/DefaultScmRepositoryConfigurator.java | 214 ++ .../shared/release/scm/GitScmTranslator.java | 54 + .../shared/release/scm/HgScmTranslator.java | 54 + .../shared/release/scm/IdentifiedScm.java | 53 + .../shared/release/scm/JazzScmTranslator.java | 104 + .../scm/ReleaseScmCommandException.java | 38 + .../scm/ReleaseScmRepositoryException.java | 54 + .../scm/ScmRepositoryConfigurator.java | 70 + .../shared/release/scm/ScmTranslator.java | 66 + .../release/scm/SubversionScmTranslator.java | 72 + .../release/strategies/DefaultStrategy.java | 112 + .../release/transform/MavenCoordinate.java | 39 + .../shared/release/transform/ModelETL.java | 43 + .../release/transform/ModelETLFactory.java | 30 + .../release/transform/ModelETLRequest.java | 67 + .../release/transform/jdom/JDomBuild.java | 329 +++ .../transform/jdom/JDomDependency.java | 169 ++ .../jdom/JDomDependencyManagement.java | 87 + .../release/transform/jdom/JDomExtension.java | 82 + .../transform/jdom/JDomMavenCoordinate.java | 82 + .../release/transform/jdom/JDomModel.java | 227 ++ .../release/transform/jdom/JDomModelBase.java | 94 + .../release/transform/jdom/JDomModelETL.java | 234 ++ .../transform/jdom/JDomModelETLFactory.java | 46 + .../release/transform/jdom/JDomParent.java | 93 + .../release/transform/jdom/JDomPlugin.java | 193 ++ .../transform/jdom/JDomPluginManagement.java | 98 + .../release/transform/jdom/JDomProfile.java | 63 + .../transform/jdom/JDomProperties.java | 161 ++ .../transform/jdom/JDomReportPlugin.java | 165 ++ .../release/transform/jdom/JDomReporting.java | 123 + .../release/transform/jdom/JDomScm.java | 87 + .../release/transform/jdom/JDomUtils.java | 132 + .../maven/shared/release/util/PomFinder.java | 305 +++ .../shared/release/util/ReleaseUtil.java | 240 ++ .../release/versions/DefaultVersionInfo.java | 425 ++++ .../shared/release/versions/VersionInfo.java | 56 + .../src/main/mdo/release-descriptor.mdo | 1165 +++++++++ .../resources/META-INF/plexus/components.xml | 45 + .../resources/release-messages.properties | 21 + .../resources/release-messages_en.properties | 23 + .../src/site/apt/index.apt.vm | 39 + .../maven-release-manager/src/site/site.xml | 35 + .../release/DefaultReleaseManagerTest.java | 799 ++++++ .../shared/release/PlexusJUnit4TestCase.java | 291 +++ .../PropertiesReleaseDescriptorStoreTest.java | 499 ++++ .../config/ReleaseDescriptorStoreStub.java | 55 + .../release/config/ReleaseUtilsTest.java | 306 +++ .../exec/AbstractMavenExecutorTest.java | 110 + .../release/exec/CommandLineFactoryTest.java | 56 + .../release/exec/ForkedMavenExecutorTest.java | 365 +++ .../exec/InvokerMavenExecutorTest.java | 198 ++ .../shared/release/exec/TeeConsumerTest.java | 61 + .../release/exec/TeeOutputStreamTest.java | 63 + .../phase/AbstractBackupPomsPhaseTest.java | 93 + ...EditModeRewritingReleasePhaseTestCase.java | 206 ++ .../phase/AbstractReleaseTestCase.java | 422 ++++ ...AbstractRewritingReleasePhaseTestCase.java | 770 ++++++ .../phase/AbstractScmCommitPhaseTest.java | 100 + .../phase/BranchInputVariablesPhaseTest.java | 333 +++ .../CheckDependencySnapshotsPhaseTest.java | 1261 ++++++++++ .../release/phase/CheckPomPhaseTest.java | 227 ++ .../phase/CheckoutProjectFromScmTest.java | 262 ++ .../phase/CreateBackupPomsPhaseTest.java | 136 + .../release/phase/EndReleasePhaseTest.java | 69 + .../phase/GenerateReleasePomsPhaseTest.java | 321 +++ .../phase/InputVariablesPhaseTest.java | 381 +++ .../release/phase/IsScmBranchEquals.java | 46 + .../phase/IsScmBranchParametersEquals.java | 47 + .../release/phase/IsScmFileSetEquals.java | 58 + .../shared/release/phase/IsScmTagEquals.java | 49 + .../phase/IsScmTagParametersEquals.java | 45 + .../phase/MapDevelopmentVersionPhaseIT.java | 65 + .../release/phase/MapVersionsPhaseTest.java | 2224 +++++++++++++++++ .../release/phase/ReleasePhaseStub.java | 102 + .../phase/RemoveReleasePomsPhaseTest.java | 253 ++ .../release/phase/RemoveScmTagPhaseTest.java | 246 ++ .../phase/RestoreBackupPomsPhaseTest.java | 112 + .../phase/RewritePomsForBranchPhaseTest.java | 476 ++++ .../RewritePomsForDevelopmentPhaseTest.java | 430 ++++ .../phase/RewritePomsForReleasePhaseTest.java | 493 ++++ .../phase/RunCompleteGoalsPhaseTest.java | 233 ++ .../phase/RunPerformGoalsPhaseTest.java | 381 +++ .../phase/RunPrepareGoalsPhaseTest.java | 234 ++ .../release/phase/ScmBranchPhaseTest.java | 442 ++++ .../phase/ScmCheckModificationsPhaseTest.java | 442 ++++ .../phase/ScmCommitDevelopmentPhaseTest.java | 204 ++ .../phase/ScmCommitPreparationPhaseTest.java | 551 ++++ .../shared/release/phase/ScmTagPhaseTest.java | 445 ++++ .../policies/DefaultNamingPolicyTest.java | 44 + .../policies/DefaultVersionPolicyTest.java | 73 + .../scm/ClearCaseScmTranslatorTest.java | 55 + .../release/scm/CvsScmTranslatorTest.java | 55 + .../DefaultScmRepositoryConfiguratorTest.java | 221 ++ .../release/scm/GitScmTranslatorTest.java | 55 + .../release/scm/HgScmTranslatorTest.java | 54 + .../release/scm/JazzScmTranslatorTest.java | 60 + .../scm/SubversionScmTranslatorTest.java | 56 + .../release/stubs/MavenExecutorWrapper.java | 47 + .../release/stubs/NamingPolicyStub.java | 40 + .../shared/release/stubs/ScmManagerStub.java | 82 + .../release/transform/jdom/JDomBuildTest.java | 306 +++ .../jdom/JDomDependencyManagementTest.java | 71 + .../transform/jdom/JDomDependencyTest.java | 186 ++ .../transform/jdom/JDomExtensionTest.java | 102 + .../release/transform/jdom/JDomModelTest.java | 98 + .../transform/jdom/JDomParentTest.java | 101 + .../transform/jdom/JDomPropertiesTest.java | 157 ++ .../release/transform/jdom/JDomScmTest.java | 138 + .../shared/release/util/PomFinderTest.java | 75 + .../shared/release/util/ReleaseUtilTest.java | 225 ++ .../versions/DefaultVersionInfoTest.java | 373 +++ ...Id-release-range-1.0-20060424.060453-1.jar | 1 + ...Id-release-range-1.0-20060424.060453-1.pom | 30 + .../1.0-SNAPSHOT/maven-metadata.xml | 32 + .../1.0/artifactId-release-range-1.0.jar | 1 + .../1.0/artifactId-release-range-1.0.pom | 30 + .../maven-metadata.xml | 32 + .../artifactId-1.0-20060424.060453-1.jar | 1 + .../artifactId-1.0-20060424.060453-1.pom | 30 + .../1.0-SNAPSHOT/maven-metadata.xml | 32 + .../artifactId/1.0/artifactId-1.0.jar | 1 + .../artifactId/1.0/artifactId-1.0.pom | 30 + .../artifactId-1.1-20080128.141330-1.jar | 1 + .../artifactId-1.1-20080128.141330-1.pom | 30 + .../1.1-SNAPSHOT/maven-metadata.xml | 32 + .../external/artifactId/maven-metadata.xml | 33 + .../extension-artifactId-1.3-SNAPSHOT.jar | 1 + .../extension-artifactId-1.3-SNAPSHOT.pom | 32 + .../parent-artifactId-1-SNAPSHOT.pom | 33 + .../1/parent-artifactId-1.pom | 33 + .../parent-artifactId/maven-metadata.xml | 32 + .../1.0/plugin-artifactId-1.0.jar | 1 + .../1.0/plugin-artifactId-1.0.pom | 31 + .../1.1-SNAPSHOT/maven-metadata.xml | 32 + ...lugin-artifactId-1.1-20060424.131158-1.jar | 1 + ...lugin-artifactId-1.1-20060424.131158-1.pom | 30 + .../plugin-artifactId/maven-metadata.xml | 32 + .../artifactId2-1.0-20100813.112234-1.pom | 27 + .../1.0-SNAPSHOT/maven-metadata.xml | 33 + .../groupId/artifactId2/maven-metadata.xml | 32 + .../1.0-SNAPSHOT/subproject1-1.0-SNAPSHOT.jar | 1 + .../1.0-SNAPSHOT/subproject1-1.0-SNAPSHOT.pom | 36 + .../subproject1/2.0/subproject1-2.0.jar | 1 + .../subproject1/2.0/subproject1-2.0.pom | 36 + .../plexus-utils/1.1/plexus-utils-1.1.jar | 1 + .../plexus-utils/1.1/plexus-utils-1.1.pom | 30 + .../test/resources/empty-release.properties | 19 + .../release/DefaultReleaseManagerTest.xml | 152 ++ .../release/exec/ForkedMavenExecutorTest.xml | 32 + .../phase/BranchInputVariablesPhaseTest.xml | 41 + .../CheckDependencySnapshotsPhaseTest.xml | 32 + .../phase/CheckoutProjectFromScmTest.xml | 36 + .../release/phase/EndReleasePhaseTest.xml | 32 + .../phase/GenerateReleasePomsPhaseTest.xml | 41 + .../release/phase/MapVersionsPhaseTest.xml | 82 + .../phase/RemoveReleasePomsPhaseTest.xml | 36 + .../release/phase/RemoveScmTagPhaseTest.xml | 36 + .../phase/RewritePomsForBranchPhaseTest.xml | 32 + .../RewritePomsForDevelopmentPhaseTest.xml | 32 + .../phase/RewritePomsForReleasePhaseTest.xml | 32 + .../phase/RunCompleteGoalsPhaseTest.xml | 37 + .../phase/RunPerformGoalsPhaseTest.xml | 37 + .../phase/RunPrepareGoalsPhaseTest.xml | 37 + .../release/phase/ScmBranchPhaseTest.xml | 36 + .../phase/ScmCheckModificationsPhaseTest.xml | 36 + .../phase/ScmCommitDevelopmentPhaseTest.xml | 36 + .../phase/ScmCommitPreparationPhaseTest.xml | 36 + .../shared/release/phase/ScmTagPhaseTest.xml | 36 + .../src/test/resources/pomfinder/pom1.xml | 223 ++ .../external-extension/pom.xml | 32 + .../pom.xml | 37 + .../subproject1/pom.xml | 33 + .../external-managed-snapshot-plugin/pom.xml | 40 + .../subproject1/pom.xml | 36 + .../external-parent/child/pom.xml | 27 + .../external-parent/pom.xml | 23 + .../pom.xml | 30 + .../external-snapshot-all/pom.xml | 57 + .../external-snapshot-dependencies/pom.xml | 30 + .../external-snapshot-extension/pom.xml | 32 + .../external-snapshot-parent/child/pom.xml | 26 + .../external-snapshot-parent/pom.xml | 23 + .../external-snapshot-plugins/pom.xml | 32 + .../external-snapshot-report-plugins/pom.xml | 32 + .../pom.xml | 30 + .../pom.xml | 36 + .../subproject1/pom.xml | 26 + .../subproject2/pom.xml | 34 + .../pom.xml | 39 + .../subproject1/pom.xml | 27 + .../subproject2/pom.xml | 37 + .../pom.xml | 39 + .../subproject1/pom.xml | 27 + .../subproject2/pom.xml | 37 + .../pom.xml | 28 + .../subproject1/pom.xml | 26 + .../subproject2/pom.xml | 34 + .../pom.xml | 39 + .../subproject1/pom.xml | 26 + .../subproject2/pom.xml | 33 + .../internal-managed-snapshot-plugin/pom.xml | 40 + .../subproject1/pom.xml | 27 + .../subproject2/pom.xml | 36 + .../pom.xml | 31 + .../internal-snapshot-dependencies/pom.xml | 28 + .../subproject1/pom.xml | 26 + .../subproject2/pom.xml | 34 + .../internal-snapshot-extension/pom.xml | 28 + .../subproject1/pom.xml | 26 + .../subproject2/pom.xml | 37 + .../internal-snapshot-plugins/pom.xml | 28 + .../subproject1/pom.xml | 27 + .../subproject2/pom.xml | 37 + .../internal-snapshot-report-plugins/pom.xml | 28 + .../subproject1/pom.xml | 27 + .../subproject2/pom.xml | 37 + .../pom.xml | 34 + .../subproject1/pom.xml | 36 + .../subproject2/pom.xml | 36 + .../no-snapshot-dependencies/pom.xml | 30 + .../no-snapshot-plugins/pom.xml | 33 + .../no-snapshot-range-dependencies/pom.xml | 30 + .../no-snapshot-report-plugins/pom.xml | 33 + .../snapshot-release-plugin/pom.xml | 32 + .../pom.xml | 38 + .../subproject1/pom.xml | 26 + .../pom.xml | 40 + .../subproject1/pom.xml | 26 + .../pom.xml | 38 + .../subproject1/pom.xml | 26 + .../pom.xml | 40 + .../subproject1/pom.xml | 26 + .../basic-pom/expected-backup.xml | 26 + .../create-backup-poms/basic-pom/pom.xml | 26 + .../pom-with-modules/expected-backup.xml | 32 + .../pom-with-modules/pom.xml | 32 + .../subproject1/expected-backup.xml | 30 + .../pom-with-modules/subproject1/pom.xml | 30 + .../subproject2/expected-backup.xml | 38 + .../pom-with-modules/subproject2/pom.xml | 38 + .../expected-release-pom.xml | 68 + .../basic-pom-entities/pom.xml | 27 + .../expected-release-pom.xml | 69 + .../basic-pom-namespace/pom.xml | 28 + .../expected-release-pom.xml | 74 + .../basic-pom-with-encoding/pom.xml | Bin 0 -> 2148 bytes .../expected-release-pom-with-schema.xml | 74 + .../basic-pom/expected-release-pom.xml | 74 + .../generate-release-poms/basic-pom/pom.xml | 30 + .../expected-release-pom.xml | 79 + .../cdata-around-values/pom.xml | 58 + .../subproject1/expected-release-pom.xml | 74 + .../cdata-around-values/subproject1/pom.xml | 29 + .../subproject2/expected-release-pom.xml | 89 + .../cdata-around-values/subproject2/pom.xml | 46 + .../expected-release-pom.xml | 78 + .../comments-around-values/pom.xml | 59 + .../subproject1/expected-release-pom.xml | 74 + .../subproject1/pom.xml | 27 + .../expected-release-pom.xml | 82 + .../external-range-dependency/pom.xml | 36 + .../expected-release-pom.xml | 74 + .../pom.xml | 28 + .../subproject1/expected-release-pom.xml | 69 + .../subproject1/pom.xml | 26 + .../subproject2/expected-release-pom.xml | 77 + .../subproject2/pom.xml | 34 + .../expected-release-pom.xml | 74 + .../pom.xml | 28 + .../subproject1/expected-release-pom.xml | 69 + .../subproject1/pom.xml | 26 + .../subproject2/expected-release-pom.xml | 76 + .../subproject2/pom.xml | 37 + .../expected-release-pom.xml | 74 + .../pom.xml | 28 + .../subproject1/expected-release-pom.xml | 69 + .../subproject1/pom.xml | 26 + .../subproject2/expected-release-pom.xml | 76 + .../subproject2/pom.xml | 37 + .../expected-release-pom.xml | 74 + .../pom.xml | 28 + .../subproject1/expected-release-pom.xml | 69 + .../subproject1/pom.xml | 26 + .../subproject2/expected-release-pom.xml | 76 + .../subproject2/pom.xml | 37 + .../expected-release-pom.xml | 75 + .../pom.xml | 45 + .../subproject1/expected-release-pom.xml | 69 + .../subproject1/pom.xml | 26 + .../subproject2/expected-release-pom.xml | 77 + .../subproject2/pom.xml | 33 + .../subproject3/expected-release-pom.xml | 83 + .../subproject3/pom.xml | 37 + .../expected-release-pom.xml | 75 + .../internal-managed-snapshot-plugin/pom.xml | 46 + .../subproject1/expected-release-pom.xml | 69 + .../subproject1/pom.xml | 26 + .../subproject2/expected-release-pom.xml | 76 + .../subproject2/pom.xml | 35 + .../subproject3/expected-release-pom.xml | 81 + .../subproject3/pom.xml | 39 + .../expected-release-pom.xml | 76 + .../internal-snapshot-dependencies/pom.xml | 30 + .../subproject1/expected-release-pom.xml | 77 + .../subproject1/pom.xml | 35 + .../subproject2/expected-release-pom.xml | 77 + .../subproject2/pom.xml | 34 + .../subproject3/expected-release-pom.xml | 83 + .../subproject3/pom.xml | 40 + .../subproject4/expected-release-pom.xml | 87 + .../subproject4/pom.xml | 39 + .../subsubproject/expected-release-pom.xml | 83 + .../subproject4/subsubproject/pom.xml | 26 + .../expected-release-pom.xml | 75 + .../internal-snapshot-extension/pom.xml | 29 + .../subproject1/expected-release-pom.xml | 77 + .../subproject1/pom.xml | 35 + .../subproject2/expected-release-pom.xml | 76 + .../subproject2/pom.xml | 36 + .../subproject3/expected-release-pom.xml | 81 + .../subproject3/pom.xml | 42 + .../expected-release-pom.xml | 76 + .../internal-snapshot-plugins/pom.xml | 30 + .../subproject1/expected-release-pom.xml | 76 + .../subproject1/pom.xml | 36 + .../subproject2/expected-release-pom.xml | 76 + .../subproject2/pom.xml | 36 + .../subproject3/expected-release-pom.xml | 81 + .../subproject3/pom.xml | 42 + .../subproject4/expected-release-pom.xml | 76 + .../subproject4/pom.xml | 36 + .../expected-release-pom.xml | 71 + .../pom.xml | 28 + .../subproject1/expected-release-pom.xml | 66 + .../subproject1/pom.xml | 26 + .../subproject2/expected-release-pom.xml | 74 + .../subproject2/pom.xml | 34 + .../expected-release-pom.xml | 76 + .../internal-snapshot-report-plugins/pom.xml | 30 + .../subproject1/expected-release-pom.xml | 76 + .../subproject1/pom.xml | 36 + .../subproject2/expected-release-pom.xml | 76 + .../subproject2/pom.xml | 36 + .../subproject3/expected-release-pom.xml | 81 + .../subproject3/pom.xml | 42 + .../subproject4/expected-release-pom.xml | 76 + .../subproject4/pom.xml | 35 + .../expected-release-pom.xml | 74 + .../pom-with-finalname/pom.xml | 34 + .../expected-release-pom.xml | 73 + .../pom-with-inherited-version/pom.xml | 27 + .../expected-release-pom-version-changed.xml | 69 + .../subproject1/expected-release-pom.xml | 69 + .../subproject1/pom.xml | 27 + .../expected-release-pom.xml | 74 + .../pom-with-namespace/pom.xml | 28 + .../subproject1/expected-release-pom.xml | 77 + .../pom-with-namespace/subproject1/pom.xml | 36 + .../subproject2/expected-release-pom.xml | 77 + .../pom-with-namespace/subproject2/pom.xml | 35 + .../pom-with-parent/expected-release-pom.xml | 78 + .../pom-with-parent/pom.xml | 33 + .../subproject1/expected-release-pom.xml | 74 + .../pom-with-parent/subproject1/pom.xml | 27 + .../expected-release-pom.xml | 73 + .../pom-with-released-parent/pom.xml | 27 + .../subproject1/expected-release-pom.xml | 69 + .../subproject1/pom.xml | 27 + .../expected-release-pom.xml | 76 + .../pom-without-extension-version/pom.xml | 35 + .../expected-release-pom.xml | 79 + .../whitespace-around-values/pom.xml | 80 + .../subproject1/expected-release-pom.xml | 74 + .../subproject1/pom.xml | 37 + .../subproject2/expected-release-pom.xml | 89 + .../subproject2/pom.xml | 64 + .../remove-release-poms/basic-pom/pom.xml | 26 + .../pom-with-modules/pom.xml | 32 + .../pom-with-modules/subproject1/pom.xml | 30 + .../pom-with-modules/subproject2/pom.xml | 38 + .../basic-pom/expected-pom.xml | 26 + .../restore-backup-poms/basic-pom/pom.xml | 26 + .../basic-pom/pom.xml.releaseBackup | 26 + .../pom-with-modules/expected-pom.xml | 32 + .../pom-with-modules/pom.xml | 32 + .../pom-with-modules/pom.xml.releaseBackup | 32 + .../subproject1/expected-pom.xml | 30 + .../pom-with-modules/subproject1/pom.xml | 30 + .../subproject1/pom.xml.releaseBackup | 30 + .../subproject2/expected-pom.xml | 38 + .../pom-with-modules/subproject2/pom.xml | 38 + .../subproject2/pom.xml.releaseBackup | 38 + .../basic-pom-entities/expected-pom.xml | 31 + .../basic-pom-entities/pom.xml | 31 + .../basic-pom-inherited-scm/expected-pom.xml | 46 + .../basic-pom-inherited-scm/pom.xml | 40 + .../subproject1/expected-pom.xml | 34 + .../subproject1/pom.xml | 34 + .../subsubproject/expected-pom.xml | 29 + .../subproject1/subsubproject/pom.xml | 29 + .../basic-pom-namespace/expected-pom.xml | 160 ++ .../basic-pom-namespace/pom.xml | 162 ++ .../expected-pom.xml | 39 + .../basic-pom-with-cvs-from-tag/pom.xml | 39 + .../basic-pom-with-cvs/expected-pom.xml | 35 + .../basic-pom-with-cvs/pom.xml | 34 + .../expected-pom.xml | 37 + .../basic-pom-with-dashes-in-comment/pom.xml | 37 + .../basic-pom-with-empty-scm/expected-pom.xml | 32 + .../basic-pom-with-empty-scm/pom.xml | 32 + .../basic-pom-with-encoding/expected-pom.xml | Bin 0 -> 2450 bytes .../basic-pom-with-encoding/pom.xml | Bin 0 -> 2348 bytes .../expected-pom.xml | 33 + .../basic-pom-with-scm-expression/pom.xml | 33 + .../expected-pom.xml | 34 + .../pom.xml | 34 + .../basic-pom-with-tag-base/expected-pom.xml | 34 + .../basic-pom-with-tag-base/pom.xml | 34 + .../basic-pom/expected-pom-with-schema.xml | 41 + .../basic-pom/expected-pom.xml | 41 + .../rewrite-for-branch/basic-pom/pom.xml | 41 + .../cdata-around-values/expected-pom.xml | 58 + .../cdata-around-values/pom.xml | 58 + .../subproject1/expected-pom.xml | 29 + .../cdata-around-values/subproject1/pom.xml | 29 + .../subproject2/expected-pom.xml | 46 + .../cdata-around-values/subproject2/pom.xml | 46 + .../cdata-section/expected-pom.xml | 67 + .../rewrite-for-branch/cdata-section/pom.xml | 67 + .../comments-around-values/expected-pom.xml | 59 + .../comments-around-values/pom.xml | 59 + .../subproject1/expected-pom.xml | 27 + .../subproject1/pom.xml | 27 + .../expected-pom.xml | 30 + .../pom.xml | 30 + .../subproject1/expected-pom.xml | 39 + .../subproject1/pom.xml | 39 + .../subproject2/expected-pom.xml | 48 + .../subproject2/pom.xml | 48 + .../expected-pom.xml | 28 + .../pom.xml | 28 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 34 + .../subproject2/pom.xml | 34 + .../expected-pom.xml | 28 + .../pom.xml | 28 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 37 + .../subproject2/pom.xml | 37 + .../expected-pom.xml | 28 + .../pom.xml | 28 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 37 + .../subproject2/pom.xml | 37 + .../expected-pom.xml | 28 + .../pom.xml | 28 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 37 + .../subproject2/pom.xml | 37 + .../expected-pom.xml | 45 + .../pom.xml | 45 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 33 + .../subproject2/pom.xml | 33 + .../subproject3/expected-pom.xml | 37 + .../subproject3/pom.xml | 37 + .../expected-pom.xml | 46 + .../internal-managed-snapshot-plugin/pom.xml | 46 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 35 + .../subproject2/pom.xml | 35 + .../subproject3/expected-pom.xml | 39 + .../subproject3/pom.xml | 39 + .../expected-pom.xml | 30 + .../internal-snapshot-dependencies/pom.xml | 30 + .../subproject1/expected-pom.xml | 35 + .../subproject1/pom.xml | 35 + .../subproject2/expected-pom.xml | 34 + .../subproject2/pom.xml | 34 + .../subproject3/expected-pom.xml | 40 + .../subproject3/pom.xml | 40 + .../subproject4/expected-pom.xml | 39 + .../subproject4/pom.xml | 39 + .../subsubproject/expected-pom.xml | 26 + .../subproject4/subsubproject/pom.xml | 26 + .../expected-pom.xml | 29 + .../internal-snapshot-extension/pom.xml | 29 + .../subproject1/expected-pom.xml | 35 + .../subproject1/pom.xml | 35 + .../subproject2/expected-pom.xml | 36 + .../subproject2/pom.xml | 36 + .../subproject3/expected-pom.xml | 42 + .../subproject3/pom.xml | 42 + .../expected-pom.xml | 29 + .../internal-snapshot-plugin-deps/pom.xml | 29 + .../subproject1/expected-pom.xml | 43 + .../subproject1/pom.xml | 43 + .../subproject2/expected-pom.xml | 43 + .../subproject2/pom.xml | 43 + .../subproject3/expected-pom.xml | 49 + .../subproject3/pom.xml | 49 + .../expected-pom.xml | 30 + .../internal-snapshot-plugins/pom.xml | 30 + .../subproject1/expected-pom.xml | 36 + .../subproject1/pom.xml | 36 + .../subproject2/expected-pom.xml | 36 + .../subproject2/pom.xml | 36 + .../subproject3/expected-pom.xml | 42 + .../subproject3/pom.xml | 42 + .../subproject4/expected-pom.xml | 35 + .../subproject4/pom.xml | 35 + .../expected-pom.xml | 49 + .../internal-snapshot-profile/pom.xml | 49 + .../subproject1/expected-pom.xml | 55 + .../subproject1/pom.xml | 55 + .../subproject2/expected-pom.xml | 55 + .../subproject2/pom.xml | 55 + .../subproject3/expected-pom.xml | 74 + .../subproject3/pom.xml | 74 + .../expected-pom.xml | 30 + .../internal-snapshot-report-plugins/pom.xml | 30 + .../subproject1/expected-pom.xml | 36 + .../subproject1/pom.xml | 36 + .../subproject2/expected-pom.xml | 36 + .../subproject2/pom.xml | 36 + .../subproject3/expected-pom.xml | 42 + .../subproject3/pom.xml | 42 + .../subproject4/expected-pom.xml | 35 + .../subproject4/pom.xml | 35 + .../expected-pom-different-version.xml | 51 + .../interpolated-versions/expected-pom.xml | 51 + .../interpolated-versions/pom.xml | 51 + .../subproject1/expected-pom.xml | 26 + .../interpolated-versions/subproject1/pom.xml | 26 + .../expected-pom-different-version.xml | 42 + .../subproject2/expected-pom.xml | 42 + .../interpolated-versions/subproject2/pom.xml | 42 + .../expected-pom-different-version.xml | 61 + .../subproject3/expected-pom.xml | 61 + .../interpolated-versions/subproject3/pom.xml | 61 + .../expected-pom.xml | 28 + .../modules-with-different-versions/pom.xml | 28 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 31 + .../subproject2/pom.xml | 31 + .../expected-pom.xml | 37 + .../multimodule-with-deep-subprojects/pom.xml | 37 + .../sub/subproject2/expected-pom.xml | 37 + .../sub/subproject2/pom.xml | 37 + .../subproject1/expected-pom.xml | 30 + .../subproject1/pom.xml | 30 + .../expected-pom.xml | 27 + .../pom-with-inherited-version/pom.xml | 27 + .../expected-pom-version-changed.xml | 28 + .../subproject1/expected-pom.xml | 27 + .../subproject1/pom.xml | 27 + .../pom-with-namespace/expected-pom.xml | 28 + .../pom-with-namespace/pom.xml | 28 + .../subproject1/expected-pom.xml | 35 + .../pom-with-namespace/subproject1/pom.xml | 36 + .../subproject2/expected-pom.xml | 34 + .../pom-with-namespace/subproject2/pom.xml | 35 + .../pom-with-overridden-scm/expected-pom.xml | 32 + .../pom-with-overridden-scm/pom.xml | 32 + .../subproject1/expected-pom.xml | 37 + .../subproject1/pom.xml | 37 + .../subsubproject/expected-pom.xml | 29 + .../subproject1/subsubproject/pom.xml | 29 + .../expected-pom.xml | 36 + .../pom-with-parent-and-properties/pom.xml | 36 + .../subproject1/expected-pom.xml | 34 + .../subproject1/pom.xml | 34 + .../subproject2/expected-pom.xml | 42 + .../subproject2/pom.xml | 42 + .../root-project/expected-pom.xml | 33 + .../pom-with-parent-flat/root-project/pom.xml | 33 + .../subproject1/expected-pom.xml | 28 + .../pom-with-parent-flat/subproject1/pom.xml | 28 + .../pom-with-parent/expected-pom.xml | 33 + .../pom-with-parent/pom.xml | 33 + .../subproject1/expected-pom.xml | 27 + .../pom-with-parent/subproject1/pom.xml | 27 + .../expected-pom.xml | 36 + .../pom.xml | 36 + .../subproject1-3.4/expected-pom.xml | 33 + .../subproject1-3.4/pom.xml | 33 + .../subproject2/expected-pom.xml | 42 + .../subproject2/pom.xml | 42 + .../pom-with-released-parent/expected-pom.xml | 27 + .../pom-with-released-parent/pom.xml | 27 + .../subproject1/expected-pom.xml | 27 + .../subproject1/pom.xml | 27 + .../expected-pom.xml | 33 + .../pom.xml | 33 + .../subproject1/expected-pom.xml | 33 + .../subproject1/pom.xml | 33 + .../expected-pom.xml | 35 + .../pom-without-extension-version/pom.xml | 35 + .../whitespace-around-values/expected-pom.xml | 80 + .../whitespace-around-values/pom.xml | 80 + .../subproject1/expected-pom.xml | 37 + .../subproject1/pom.xml | 37 + .../subproject2/expected-pom.xml | 64 + .../subproject2/pom.xml | 64 + .../ejb/expected-pom.xml | 25 + .../basic-pom-ejb-client-dep/ejb/pom.xml | 25 + .../project/expected-pom.xml | 56 + .../basic-pom-ejb-client-dep/project/pom.xml | 56 + .../basic-pom-entities/expected-pom.xml | 31 + .../basic-pom-entities/pom.xml | 31 + .../basic-pom-inherited-scm/expected-pom.xml | 39 + .../basic-pom-inherited-scm/pom.xml | 40 + .../subproject1/expected-pom.xml | 39 + .../subproject1/pom.xml | 39 + .../subsubproject/expected-pom.xml | 29 + .../subproject1/subsubproject/pom.xml | 29 + .../basic-pom-namespace/expected-pom.xml | 26 + .../basic-pom-namespace/pom.xml | 28 + .../expected-pom.xml | 35 + .../basic-pom-with-cvs-from-tag/pom.xml | 35 + .../basic-pom-with-cvs/expected-pom.xml | 38 + .../basic-pom-with-cvs/pom.xml | 39 + .../basic-pom-with-encoding/expected-pom.xml | Bin 0 -> 2144 bytes .../basic-pom-with-encoding/pom.xml | Bin 0 -> 2204 bytes .../basic-pom/expected-pom-with-schema.xml | 50 + .../basic-pom/expected-pom.xml | 50 + .../rewrite-for-development/basic-pom/pom.xml | 50 + .../cdata-around-values/expected-pom.xml | 58 + .../cdata-around-values/pom.xml | 58 + .../subproject1/expected-pom.xml | 29 + .../cdata-around-values/subproject1/pom.xml | 29 + .../subproject2/expected-pom.xml | 46 + .../cdata-around-values/subproject2/pom.xml | 46 + .../comments-around-values/expected-pom.xml | 59 + .../comments-around-values/pom.xml | 59 + .../subproject1/expected-pom.xml | 27 + .../subproject1/pom.xml | 27 + .../expected-pom.xml | 28 + .../pom.xml | 28 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 34 + .../subproject2/pom.xml | 34 + .../expected-pom.xml | 28 + .../pom.xml | 28 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 37 + .../subproject2/pom.xml | 37 + .../expected-pom.xml | 28 + .../pom.xml | 28 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 37 + .../subproject2/pom.xml | 37 + .../expected-pom.xml | 28 + .../pom.xml | 28 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 37 + .../subproject2/pom.xml | 37 + .../expected-pom.xml | 45 + .../pom.xml | 45 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 33 + .../subproject2/pom.xml | 33 + .../subproject3/expected-pom.xml | 37 + .../subproject3/pom.xml | 37 + .../expected-pom.xml | 46 + .../internal-managed-snapshot-plugin/pom.xml | 46 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 35 + .../subproject2/pom.xml | 35 + .../subproject3/expected-pom.xml | 39 + .../subproject3/pom.xml | 39 + .../expected-pom.xml | 30 + .../pom.xml | 30 + .../subproject1/expected-pom.xml | 35 + .../subproject1/pom.xml | 35 + .../subproject2/expected-pom.xml | 34 + .../subproject2/pom.xml | 34 + .../subproject3/expected-pom.xml | 40 + .../subproject3/pom.xml | 40 + .../subproject4/expected-pom.xml | 39 + .../subproject4/pom.xml | 39 + .../subsubproject/expected-pom.xml | 26 + .../subproject4/subsubproject/pom.xml | 26 + .../expected-pom.xml | 30 + .../internal-snapshot-dependencies/pom.xml | 30 + .../subproject1/expected-pom.xml | 35 + .../subproject1/pom.xml | 35 + .../subproject2/expected-pom.xml | 34 + .../subproject2/pom.xml | 34 + .../subproject3/expected-pom.xml | 40 + .../subproject3/pom.xml | 40 + .../subproject4/expected-pom.xml | 39 + .../subproject4/pom.xml | 39 + .../subsubproject/expected-pom.xml | 26 + .../subproject4/subsubproject/pom.xml | 26 + .../expected-pom.xml | 29 + .../internal-snapshot-extension/pom.xml | 29 + .../subproject1/expected-pom.xml | 35 + .../subproject1/pom.xml | 35 + .../subproject2/expected-pom.xml | 36 + .../subproject2/pom.xml | 36 + .../subproject3/expected-pom.xml | 42 + .../subproject3/pom.xml | 42 + .../expected-pom.xml | 29 + .../internal-snapshot-plugin-deps/pom.xml | 29 + .../subproject1/expected-pom.xml | 43 + .../subproject1/pom.xml | 43 + .../subproject2/expected-pom.xml | 43 + .../subproject2/pom.xml | 43 + .../subproject3/expected-pom.xml | 49 + .../subproject3/pom.xml | 49 + .../expected-pom.xml | 30 + .../internal-snapshot-plugins/pom.xml | 30 + .../subproject1/expected-pom.xml | 36 + .../subproject1/pom.xml | 36 + .../subproject2/expected-pom.xml | 36 + .../subproject2/pom.xml | 36 + .../subproject3/expected-pom.xml | 42 + .../subproject3/pom.xml | 42 + .../subproject4/expected-pom.xml | 35 + .../subproject4/pom.xml | 35 + .../expected-pom.xml | 49 + .../internal-snapshot-profile/pom.xml | 49 + .../subproject1/expected-pom.xml | 55 + .../subproject1/pom.xml | 55 + .../subproject2/expected-pom.xml | 55 + .../subproject2/pom.xml | 55 + .../subproject3/expected-pom.xml | 74 + .../subproject3/pom.xml | 74 + .../expected-pom.xml | 30 + .../internal-snapshot-report-plugins/pom.xml | 30 + .../subproject1/expected-pom.xml | 36 + .../subproject1/pom.xml | 36 + .../subproject2/expected-pom.xml | 36 + .../subproject2/pom.xml | 36 + .../subproject3/expected-pom.xml | 42 + .../subproject3/pom.xml | 42 + .../subproject4/expected-pom.xml | 35 + .../subproject4/pom.xml | 35 + .../expected-pom.xml | 27 + .../pom-with-inherited-version/pom.xml | 27 + .../expected-pom-version-changed.xml | 28 + .../subproject1/expected-pom.xml | 27 + .../subproject1/pom.xml | 27 + .../pom-with-namespace/expected-pom.xml | 34 + .../pom-with-namespace/pom.xml | 35 + .../subproject1/expected-pom.xml | 35 + .../pom-with-namespace/subproject1/pom.xml | 36 + .../subproject2/expected-pom.xml | 34 + .../pom-with-namespace/subproject2/pom.xml | 35 + .../expected-pom.xml | 36 + .../pom.xml | 36 + .../subproject1/expected-pom.xml | 44 + .../subproject1/pom.xml | 44 + .../subproject2/expected-pom.xml | 46 + .../subproject2/pom.xml | 46 + .../expected-pom.xml | 36 + .../pom.xml | 36 + .../subproject1/expected-pom.xml | 34 + .../subproject1/pom.xml | 34 + .../subproject2/expected-pom.xml | 44 + .../subproject2/pom.xml | 44 + .../expected-pom.xml | 36 + .../pom.xml | 36 + .../subproject1/expected-pom.xml | 34 + .../subproject1/pom.xml | 34 + .../subproject2/expected-pom.xml | 42 + .../subproject2/pom.xml | 42 + .../expected-pom.xml | 36 + .../pom-with-parent-and-properties/pom.xml | 36 + .../subproject1/expected-pom.xml | 34 + .../subproject1/pom.xml | 34 + .../subproject2/expected-pom.xml | 42 + .../subproject2/pom.xml | 42 + .../pom-with-parent/expected-pom.xml | 33 + .../pom-with-parent/pom.xml | 33 + .../subproject1/expected-pom.xml | 27 + .../pom-with-parent/subproject1/pom.xml | 27 + .../expected-pom.xml | 36 + .../pom.xml | 36 + .../subproject1-3.4/expected-pom.xml | 33 + .../subproject1-3.4/pom.xml | 33 + .../subproject2/expected-pom.xml | 42 + .../subproject2/pom.xml | 42 + .../pom-with-released-parent/expected-pom.xml | 27 + .../pom-with-released-parent/pom.xml | 27 + .../subproject1/expected-pom.xml | 27 + .../subproject1/pom.xml | 27 + .../expected-pom.xml | 35 + .../pom-without-extension-version/pom.xml | 35 + .../whitespace-around-values/expected-pom.xml | 80 + .../whitespace-around-values/pom.xml | 80 + .../subproject1/expected-pom.xml | 37 + .../subproject1/pom.xml | 37 + .../subproject2/expected-pom.xml | 64 + .../subproject2/pom.xml | 64 + .../basic-pom-entities/expected-pom.xml | 31 + .../basic-pom-entities/pom.xml | 31 + .../basic-pom-inherited-scm/expected-pom.xml | 46 + .../basic-pom-inherited-scm/pom.xml | 40 + .../subproject1/expected-pom.xml | 34 + .../subproject1/pom.xml | 34 + .../subsubproject/expected-pom.xml | 29 + .../subproject1/subsubproject/pom.xml | 29 + .../basic-pom-namespace/expected-pom.xml | 160 ++ .../basic-pom-namespace/pom.xml | 162 ++ .../expected-pom.xml | 39 + .../basic-pom-with-cvs-from-tag/pom.xml | 39 + .../basic-pom-with-cvs/expected-pom.xml | 35 + .../basic-pom-with-cvs/pom.xml | 34 + .../expected-pom.xml | 37 + .../basic-pom-with-dashes-in-comment/pom.xml | 37 + .../basic-pom-with-empty-scm/expected-pom.xml | 32 + .../basic-pom-with-empty-scm/pom.xml | 32 + .../basic-pom-with-encoding/expected-pom.xml | Bin 0 -> 2408 bytes .../basic-pom-with-encoding/pom.xml | Bin 0 -> 2348 bytes .../expected-pom.xml | 33 + .../basic-pom-with-scm-expression/pom.xml | 33 + .../expected-pom.xml | 34 + .../pom.xml | 34 + .../basic-pom-with-tag-base/expected-pom.xml | 34 + .../basic-pom-with-tag-base/pom.xml | 34 + .../basic-pom/expected-pom-with-schema.xml | 50 + .../basic-pom/expected-pom.xml | 50 + .../rewrite-for-release/basic-pom/pom.xml | 50 + .../cdata-around-values/expected-pom.xml | 58 + .../cdata-around-values/pom.xml | 58 + .../subproject1/expected-pom.xml | 29 + .../cdata-around-values/subproject1/pom.xml | 29 + .../subproject2/expected-pom.xml | 46 + .../cdata-around-values/subproject2/pom.xml | 46 + .../cdata-section/expected-pom.xml | 68 + .../rewrite-for-release/cdata-section/pom.xml | 68 + .../comments-around-values/expected-pom.xml | 59 + .../comments-around-values/pom.xml | 59 + .../subproject1/expected-pom.xml | 27 + .../subproject1/pom.xml | 27 + .../expected-pom.xml | 30 + .../pom.xml | 30 + .../subproject1/expected-pom.xml | 39 + .../subproject1/pom.xml | 39 + .../subproject2/expected-pom.xml | 48 + .../subproject2/pom.xml | 48 + .../expected-pom.xml | 28 + .../pom.xml | 28 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 34 + .../subproject2/pom.xml | 34 + .../expected-pom.xml | 28 + .../pom.xml | 28 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 37 + .../subproject2/pom.xml | 37 + .../expected-pom.xml | 28 + .../pom.xml | 28 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 37 + .../subproject2/pom.xml | 37 + .../expected-pom.xml | 28 + .../pom.xml | 28 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 37 + .../subproject2/pom.xml | 37 + .../expected-pom.xml | 45 + .../pom.xml | 45 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 33 + .../subproject2/pom.xml | 33 + .../subproject3/expected-pom.xml | 37 + .../subproject3/pom.xml | 37 + .../expected-pom.xml | 46 + .../internal-managed-snapshot-plugin/pom.xml | 46 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 35 + .../subproject2/pom.xml | 35 + .../subproject3/expected-pom.xml | 39 + .../subproject3/pom.xml | 39 + .../expected-pom.xml | 30 + .../internal-snapshot-dependencies/pom.xml | 30 + .../subproject1/expected-pom.xml | 35 + .../subproject1/pom.xml | 35 + .../subproject2/expected-pom.xml | 34 + .../subproject2/pom.xml | 34 + .../subproject3/expected-pom.xml | 40 + .../subproject3/pom.xml | 40 + .../subproject4/expected-pom.xml | 39 + .../subproject4/pom.xml | 39 + .../subsubproject/expected-pom.xml | 26 + .../subproject4/subsubproject/pom.xml | 26 + .../expected-pom.xml | 29 + .../internal-snapshot-extension/pom.xml | 29 + .../subproject1/expected-pom.xml | 35 + .../subproject1/pom.xml | 35 + .../subproject2/expected-pom.xml | 36 + .../subproject2/pom.xml | 36 + .../subproject3/expected-pom.xml | 42 + .../subproject3/pom.xml | 42 + .../expected-pom.xml | 29 + .../internal-snapshot-plugin-deps/pom.xml | 29 + .../subproject1/expected-pom.xml | 43 + .../subproject1/pom.xml | 43 + .../subproject2/expected-pom.xml | 43 + .../subproject2/pom.xml | 43 + .../subproject3/expected-pom.xml | 49 + .../subproject3/pom.xml | 49 + .../expected-pom.xml | 30 + .../internal-snapshot-plugins/pom.xml | 30 + .../subproject1/expected-pom.xml | 36 + .../subproject1/pom.xml | 36 + .../subproject2/expected-pom.xml | 36 + .../subproject2/pom.xml | 36 + .../subproject3/expected-pom.xml | 42 + .../subproject3/pom.xml | 42 + .../subproject4/expected-pom.xml | 35 + .../subproject4/pom.xml | 35 + .../expected-pom.xml | 49 + .../internal-snapshot-profile/pom.xml | 49 + .../subproject1/expected-pom.xml | 55 + .../subproject1/pom.xml | 55 + .../subproject2/expected-pom.xml | 55 + .../subproject2/pom.xml | 55 + .../subproject3/expected-pom.xml | 74 + .../subproject3/pom.xml | 74 + .../expected-pom.xml | 30 + .../internal-snapshot-report-plugins/pom.xml | 30 + .../subproject1/expected-pom.xml | 36 + .../subproject1/pom.xml | 36 + .../subproject2/expected-pom.xml | 36 + .../subproject2/pom.xml | 36 + .../subproject3/expected-pom.xml | 42 + .../subproject3/pom.xml | 42 + .../subproject4/expected-pom.xml | 35 + .../subproject4/pom.xml | 35 + .../expected-pom-different-version.xml | 51 + .../interpolated-versions/expected-pom.xml | 51 + .../interpolated-versions/pom.xml | 51 + .../subproject1/expected-pom.xml | 26 + .../interpolated-versions/subproject1/pom.xml | 26 + .../expected-pom-different-version.xml | 42 + .../subproject2/expected-pom.xml | 42 + .../interpolated-versions/subproject2/pom.xml | 42 + .../expected-pom-different-version.xml | 62 + .../subproject3/expected-pom.xml | 62 + .../interpolated-versions/subproject3/pom.xml | 62 + .../expected-pom.xml | 28 + .../modules-with-different-versions/pom.xml | 28 + .../subproject1/expected-pom.xml | 26 + .../subproject1/pom.xml | 26 + .../subproject2/expected-pom.xml | 31 + .../subproject2/pom.xml | 31 + .../expected-pom.xml | 37 + .../multimodule-with-deep-subprojects/pom.xml | 37 + .../sub/subproject2/expected-pom.xml | 37 + .../sub/subproject2/pom.xml | 37 + .../subproject1/expected-pom.xml | 30 + .../subproject1/pom.xml | 30 + .../expected-pom.xml | 36 + .../pom.xml | 31 + .../expected-pom.xml | 27 + .../pom-with-inherited-version/pom.xml | 27 + .../expected-pom-version-changed.xml | 28 + .../subproject1/expected-pom.xml | 27 + .../subproject1/pom.xml | 27 + .../pom-with-namespace/expected-pom.xml | 28 + .../pom-with-namespace/pom.xml | 28 + .../subproject1/expected-pom.xml | 35 + .../pom-with-namespace/subproject1/pom.xml | 36 + .../subproject2/expected-pom.xml | 34 + .../pom-with-namespace/subproject2/pom.xml | 35 + .../pom-with-overridden-scm/expected-pom.xml | 32 + .../pom-with-overridden-scm/pom.xml | 32 + .../subproject1/expected-pom.xml | 37 + .../subproject1/pom.xml | 37 + .../subsubproject/expected-pom.xml | 29 + .../subproject1/subsubproject/pom.xml | 29 + .../expected-pom.xml | 36 + .../pom-with-parent-and-properties/pom.xml | 36 + .../subproject1/expected-pom.xml | 34 + .../subproject1/pom.xml | 34 + .../subproject2/expected-pom.xml | 42 + .../subproject2/pom.xml | 42 + .../root-project/expected-pom.xml | 33 + .../pom-with-parent-flat/root-project/pom.xml | 33 + .../subproject1/expected-pom.xml | 28 + .../pom-with-parent-flat/subproject1/pom.xml | 28 + .../pom-with-parent/expected-pom.xml | 33 + .../pom-with-parent/pom.xml | 33 + .../subproject1/expected-pom.xml | 27 + .../pom-with-parent/subproject1/pom.xml | 27 + .../expected-pom.xml | 36 + .../pom.xml | 36 + .../subproject1-3.4/expected-pom.xml | 33 + .../subproject1-3.4/pom.xml | 33 + .../subproject2/expected-pom.xml | 42 + .../subproject2/pom.xml | 42 + .../pom-with-released-parent/expected-pom.xml | 27 + .../pom-with-released-parent/pom.xml | 27 + .../subproject1/expected-pom.xml | 27 + .../subproject1/pom.xml | 27 + .../expected-pom.xml | 33 + .../pom.xml | 33 + .../subproject1/expected-pom.xml | 33 + .../subproject1/pom.xml | 33 + .../expected-pom.xml | 35 + .../pom-without-extension-version/pom.xml | 35 + .../whitespace-around-values/expected-pom.xml | 80 + .../whitespace-around-values/pom.xml | 80 + .../subproject1/expected-pom.xml | 37 + .../subproject1/pom.xml | 37 + .../subproject2/expected-pom.xml | 64 + .../subproject2/pom.xml | 64 + .../multimodule-with-deep-subprojects/pom.xml | 31 + .../sub/subproject2/pom.xml | 38 + .../subproject1/pom.xml | 29 + .../projects/scm-commit/multiple-poms/pom.xml | 28 + .../multiple-poms/subproject1/pom.xml | 26 + .../multiple-poms/subproject2/pom.xml | 34 + .../projects/scm-commit/single-pom/pom.xml | 22 + .../src/test/resources/release.properties | 54 + .../test/resources/rewrite-release.properties | 28 + .../src/test/resources/settings-security.xml | 24 + .../src/maven-release-plugin/pom.xml | 289 +++ .../repository/dependency-1.0-SNAPSHOT.pom | 27 + .../mrm/repository/extension-1.0-SNAPSHOT.pom | 30 + .../it/mrm/repository/parent-1-SNAPSHOT.pom | 28 + .../src/it/mrm/settings.xml | 79 + .../it/projects/branch/MRELEASE-458/pom.xml | 79 + .../projects/branch/MRELEASE-458/verify.bsh | 59 + .../it/projects/branch/MRELEASE-694/pom.xml | 77 + .../branch/MRELEASE-694/test.properties | 21 + .../branch/MRELEASE-694/verify.groovy | 27 + .../it/projects/branch/MRELEASE-745/pom.xml | 49 + .../branch/MRELEASE-745/verify.groovy | 24 + .../it/projects/branch/MRELEASE-976/pom.xml | 57 + .../branch/MRELEASE-976/verify.groovy | 28 + .../src/it/projects/branch/invoker.properties | 18 + .../it/projects/perform/MRELEASE-459/pom.xml | 72 + .../perform/MRELEASE-459/verify.groovy | 32 + .../it/projects/perform/MRELEASE-592/pom.xml | 116 + .../it/projects/perform/MRELEASE-736/pom.xml | 62 + .../perform/MRELEASE-736/test.properties | 18 + .../it/projects/perform/MRELEASE-818/pom.xml | 65 + .../perform/MRELEASE-818/verify.groovy | 27 + .../perform/MRELEASE-832/invoker.properties | 18 + .../it/projects/perform/MRELEASE-832/pom.xml | 48 + .../perform/MRELEASE-832/verify.groovy | 25 + .../it/projects/perform/invoker.properties | 18 + .../prepare-with-pom/MRELEASE-808/pom.xml | 63 + .../MRELEASE-808/verify.groovy | 24 + .../prepare-with-pom/finalname-basic/pom.xml | 62 + .../finalname-basic/verify.groovy | 24 + .../finalname-multimodule/module/pom.xml | 25 + .../finalname-multimodule/pom.xml | 63 + .../finalname-multimodule/verify.groovy | 24 + .../prepare-with-pom/invoker.properties | 18 + .../it/projects/prepare/MRELEASE-128/pom.xml | 50 + .../prepare/MRELEASE-128/verify.groovy | 39 + .../it/projects/prepare/MRELEASE-156/pom.xml | 55 + .../prepare/MRELEASE-156/verify.groovy | 31 + .../MRELEASE-161-dependencyManagement/pom.xml | 96 + .../release-test-module-one/pom.xml | 49 + .../release-test-module-two/pom.xml | 47 + .../verify.groovy | 29 + .../it/projects/prepare/MRELEASE-161/pom.xml | 77 + .../release-test-module-one/pom.xml | 49 + .../release-test-module-two/pom.xml | 49 + .../prepare/MRELEASE-161/verify.groovy | 29 + .../it/projects/prepare/MRELEASE-420/pom.xml | 56 + .../prepare/MRELEASE-420/verify.groovy | 24 + .../it/projects/prepare/MRELEASE-483/pom.xml | 56 + .../prepare/MRELEASE-483/test.properties | 20 + .../prepare/MRELEASE-483/verify.groovy | 25 + .../prepare/MRELEASE-533/other-pom.xml | 48 + .../prepare/MRELEASE-533/test.properties | 18 + .../prepare/MRELEASE-533/verify.groovy | 24 + .../MRELEASE-571_M3/invoker.properties | 20 + .../prepare/MRELEASE-571_M3/module1/pom.xml | 85 + .../projects/prepare/MRELEASE-571_M3/pom.xml | 54 + .../prepare/MRELEASE-571_M3/verify.groovy | 27 + .../projects/prepare/MRELEASE-618/my-pom.xml | 51 + .../prepare/MRELEASE-618/verify.groovy | 24 + .../it/projects/prepare/MRELEASE-667/pom.xml | 52 + .../prepare/MRELEASE-667/verify.groovy | 27 + .../it/projects/prepare/MRELEASE-834/pom.xml | 44 + .../prepare/MRELEASE-834/test.properties | 18 + .../it/projects/prepare/MRELEASE-835/pom.xml | 71 + .../prepare/MRELEASE-835/verify.groovy | 28 + .../prepare/MRELEASE-966/invoker.properties | 18 + .../projects/prepare/MRELEASE-966/my-pom.xml | 48 + .../it/projects/prepare/MRELEASE-966/pom.xml | 48 + .../prepare/MRELEASE-966/verify.groovy | 27 + .../it/projects/prepare/MRELEASE-976/pom.xml | 56 + .../prepare/MRELEASE-976/verify.groovy | 30 + .../it/projects/prepare/MRELEASE-985/pom.xml | 65 + .../prepare/MRELEASE-985/test.properties | 21 + .../prepare/MRELEASE-985/verify.groovy | 36 + .../projects/prepare/completion-goals/pom.xml | 58 + .../prepare/completion-goals/verify.bsh | 79 + .../fail-on-snapshots/invoker.properties | 18 + .../prepare/fail-on-snapshots/pom.xml | 97 + .../prepare/fail-on-snapshots/verify.groovy | 32 + .../flat-multi-module/module-a/pom.xml | 41 + .../maven/plugin/release/module/a/App.java | 32 + .../plugin/release/module/a/AppTest.java | 57 + .../flat-multi-module/module-b/pom.xml | 41 + .../maven/plugin/release/module/b/App.java | 33 + .../plugin/release/module/b/AppTest.java | 58 + .../flat-multi-module/parent-project/pom.xml | 62 + .../parent-project/verify.bsh | 70 + .../it/projects/prepare/forked-basic/pom.xml | 55 + .../it/projects/prepare/invoker-basic/pom.xml | 55 + .../it/projects/prepare/invoker.properties | 18 + .../src/it/projects/prepare/namespace/pom.xml | 60 + .../projects/prepare/namespace/verify.groovy | 29 + .../projects/prepare/oddeven-policy/pom.xml | 54 + .../regular-multi-module/module-a/pom.xml | 40 + .../maven/plugin/release/module/a/App.java | 32 + .../plugin/release/module/a/AppTest.java | 57 + .../regular-multi-module/module-b/pom.xml | 40 + .../maven/plugin/release/module/b/App.java | 32 + .../plugin/release/module/b/AppTest.java | 57 + .../prepare/regular-multi-module/pom.xml | 62 + .../prepare/regular-multi-module/verify.bsh | 58 + .../it/projects/prepare/semver-policy/pom.xml | 54 + .../MRELEASE-555/module-a/pom.xml | 29 + .../MRELEASE-555/module-b/pom.xml | 37 + .../update-versions/MRELEASE-555/pom.xml | 45 + .../MRELEASE-555/verify.groovy | 28 + .../update-versions/MRELEASE-611/pom.xml | 41 + .../MRELEASE-611/verify.groovy | 28 + .../update-versions/MRELEASE-783/pom.xml | 40 + .../update-versions/MRELEASE-976/pom.xml | 47 + .../MRELEASE-976/verify.groovy | 25 + .../update-versions/invoker.properties | 18 + .../invoker.properties | 18 + .../maven-project-naming-stub-policy/pom.xml | 61 + .../release/policy/stub/StubNamingPolicy.java | 38 + .../invoker.properties | 18 + .../maven-project-version-stub-policy/pom.xml | 66 + .../policy/stub/StubVersionPolicy.java | 45 + .../invoker.properties | 18 + .../it/setup/maven-scm-provider-dummy/pom.xml | 63 + .../scm/provider/dummy/DummyScmProvider.java | 59 + .../dummy/DummyScmProviderRepository.java | 37 + .../invoker.properties | 18 + .../it/setup/maven-scm-provider-stub/pom.xml | 65 + .../scm/provider/stub/StubBranchCommand.java | 49 + .../scm/provider/stub/StubCheckInCommand.java | 107 + .../provider/stub/StubCheckOutCommand.java | 130 + .../scm/provider/stub/StubScmProvider.java | 100 + .../stub/StubScmProviderRepository.java | 163 ++ .../scm/provider/stub/StubStatusCommand.java | 52 + .../scm/provider/stub/StubTagCommand.java | 110 + .../invoker.properties | 18 + .../setup/maven-wagon-provider-dummy/pom.xml | 65 + .../providers/dummy/DummyWagonProvider.java | 183 ++ .../plugins/release/AbstractReleaseMojo.java | 305 +++ .../release/AbstractScmReleaseMojo.java | 202 ++ .../plugins/release/BranchReleaseMojo.java | 299 +++ .../plugins/release/CleanReleaseMojo.java | 66 + .../plugins/release/PerformReleaseMojo.java | 232 ++ .../plugins/release/PrepareReleaseMojo.java | 390 +++ .../release/PrepareWithPomReleaseMojo.java | 50 + .../plugins/release/RollbackReleaseMojo.java | 97 + .../plugins/release/StageReleaseMojo.java | 74 + .../plugins/release/UpdateVersionsMojo.java | 132 + .../src/site/apt/examples/branch.apt | 75 + .../src/site/apt/examples/clean-release.apt | 40 + .../apt/examples/generate-release-poms.apt | 45 + .../src/site/apt/examples/lock-files.apt | 48 + .../apt/examples/non-interactive-release.apt | 98 + .../site/apt/examples/perform-release.apt.vm | 75 + .../site/apt/examples/prepare-release.apt.vm | 144 ++ .../site/apt/examples/rollback-release.apt | 54 + .../examples/run-goals-before-commit.apt.vm | 54 + .../src/site/apt/examples/update-versions.apt | 58 + .../src/site/apt/index.apt | 98 + .../src/site/apt/usage.apt.vm | 153 ++ .../maven-release-plugin/src/site/fml/faq.fml | 101 + .../maven-release-plugin/src/site/site.xml | 55 + .../plugins/release/CleanReleaseMojoTest.java | 75 + .../release/PerformReleaseMojoTest.java | 396 +++ .../release/PrepareReleaseMojoTest.java | 276 ++ .../plugins/release/StageReleaseMojoTest.java | 114 + .../FlatMultiModuleMavenProjectStub.java | 105 + .../release/stubs/MavenProjectStub.java | 75 + .../src/test/resources/mojos/clean/clean.xml | 34 + .../mojos/perform/perform-with-args.xml | 40 + .../perform/perform-with-flat-structure.xml | 40 + .../perform/perform-with-multiline-goals.xml | 42 + .../mojos/perform/perform-with-scm.xml | 40 + .../mojos/perform/perform-without-site.xml | 39 + .../test/resources/mojos/perform/perform.xml | 39 + .../test/resources/mojos/prepare/prepare.xml | 37 + .../src/test/resources/mojos/stage/stage.xml | 40 + .../maven-release-oddeven-policy/pom.xml | 84 + .../policy/oddeven/OddEvenVersionPolicy.java | 142 ++ .../release/policy/oddeven/package-info.java | 25 + .../src/site/site.xml | 35 + .../oddeven/OddEvenVersionPolicyTestCase.java | 82 + .../maven-release-semver-policy/pom.xml | 81 + .../policy/semver/SemVerVersionPolicy.java | 80 + .../src/site/site.xml | 35 + .../semver/SemVerVersionPolicyTest.java | 71 + Java-base/maven-release/src/pom.xml | 209 ++ .../maven-release/src/src/site/apt/index.apt | 50 + .../src/src/site/resources/download.cgi | 22 + Java-base/maven-release/src/src/site/site.xml | 37 + .../src/src/site/xdoc/download.xml.vm | 126 + .../Dockerfile | 18 + .../buggy.java | 290 +++ .../metadata.json | 21 + .../npe.json | 7 + .../Dockerfile | 18 + .../buggy.java | 198 ++ .../metadata.json | 21 + .../npe.json | 7 + .../Dockerfile | 18 + .../buggy.java | 188 ++ .../metadata.json | 21 + .../npe.json | 7 + 1332 files changed, 86196 insertions(+) create mode 100644 Java-base/maven-release/Dockerfile create mode 100644 Java-base/maven-release/src/Jenkinsfile create mode 100644 Java-base/maven-release/src/README.TXT create mode 100644 Java-base/maven-release/src/README.md create mode 100644 Java-base/maven-release/src/deploySite.bat create mode 100644 Java-base/maven-release/src/deploySite.sh create mode 100644 Java-base/maven-release/src/maven-release-api/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/ReleaseExecutionException.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/ReleaseFailureException.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/ReleaseResult.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptor.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/env/ReleaseEnvironment.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/phase/AbstractReleasePhase.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/phase/ReleasePhase.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/phase/ResourceGenerator.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/PolicyException.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/naming/NamingPolicy.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/naming/NamingPolicyRequest.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/naming/NamingPolicyResult.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/version/VersionPolicy.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/version/VersionPolicyRequest.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/version/VersionPolicyResult.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/strategy/Strategy.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/AetherVersion.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/MavenArtifactVersion.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/Version.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/VersionComparisonConflictException.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/VersionParseException.java create mode 100644 Java-base/maven-release/src/maven-release-api/src/site/site.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/components-fragment.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/AbstractReleaseRequest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManagerListener.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseBranchRequest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseCleanRequest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseManager.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseManagerListener.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleasePerformRequest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleasePrepareRequest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseRollbackRequest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseUpdateVersionsRequest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorBuilder.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorStore.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorStoreException.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/env/DefaultReleaseEnvironment.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/AbstractMavenExecutor.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/CommandLineFactory.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/DefaultCommandLineFactory.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/ForkedMavenExecutor.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/InvokerMavenExecutor.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/MavenExecutor.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/MavenExecutorException.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/RawStreamPumper.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/TeeConsumer.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/TeeOutputStream.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractBackupPomsPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractReleasePomsPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRunGoalsPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckCompletedPreparePhasesPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckPomPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScm.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CreateBackupPomsPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/EndReleasePhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/InputVariablesPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/MapVersionsPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RemoveReleasePomsPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RemoveScmTagPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RestoreBackupPomsPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomVersionsPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunCompleteGoalsPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPerformGoalsPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPrepareGoalsPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmBranchPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCheckModificationsPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmTagPhase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/policies/DefaultNamingPolicy.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/policies/DefaultVersionPolicy.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ClearCaseScmTranslator.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/CvsScmTranslator.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/DefaultScmRepositoryConfigurator.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/GitScmTranslator.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/HgScmTranslator.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/IdentifiedScm.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/JazzScmTranslator.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ReleaseScmCommandException.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ReleaseScmRepositoryException.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ScmRepositoryConfigurator.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ScmTranslator.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/SubversionScmTranslator.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/strategies/DefaultStrategy.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/MavenCoordinate.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/ModelETL.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/ModelETLFactory.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/ModelETLRequest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomBuild.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomDependency.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomDependencyManagement.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomExtension.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomMavenCoordinate.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModel.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelBase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelETL.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelETLFactory.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomParent.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomPlugin.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomPluginManagement.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomProfile.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomProperties.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReportPlugin.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReporting.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomScm.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomUtils.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/util/PomFinder.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/util/ReleaseUtil.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/versions/DefaultVersionInfo.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/versions/VersionInfo.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/mdo/release-descriptor.mdo create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/resources/META-INF/plexus/components.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/resources/release-messages.properties create mode 100644 Java-base/maven-release/src/maven-release-manager/src/main/resources/release-messages_en.properties create mode 100644 Java-base/maven-release/src/maven-release-manager/src/site/apt/index.apt.vm create mode 100644 Java-base/maven-release/src/maven-release-manager/src/site/site.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/PlexusJUnit4TestCase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStoreTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/ReleaseDescriptorStoreStub.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/ReleaseUtilsTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/AbstractMavenExecutorTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/CommandLineFactoryTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/ForkedMavenExecutorTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/InvokerMavenExecutorTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/TeeConsumerTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/TeeOutputStreamTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractBackupPomsPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractEditModeRewritingReleasePhaseTestCase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractReleaseTestCase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractRewritingReleasePhaseTestCase.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/BranchInputVariablesPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckPomPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScmTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CreateBackupPomsPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/EndReleasePhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/InputVariablesPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmBranchEquals.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmBranchParametersEquals.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmFileSetEquals.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmTagEquals.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmTagParametersEquals.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/MapDevelopmentVersionPhaseIT.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/MapVersionsPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ReleasePhaseStub.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RemoveReleasePomsPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RemoveScmTagPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RestoreBackupPomsPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RunCompleteGoalsPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RunPerformGoalsPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RunPrepareGoalsPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmBranchPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCheckModificationsPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmTagPhaseTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/policies/DefaultNamingPolicyTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/policies/DefaultVersionPolicyTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/ClearCaseScmTranslatorTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/CvsScmTranslatorTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/DefaultScmRepositoryConfiguratorTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/GitScmTranslatorTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/HgScmTranslatorTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/JazzScmTranslatorTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/SubversionScmTranslatorTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/stubs/MavenExecutorWrapper.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/stubs/NamingPolicyStub.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/stubs/ScmManagerStub.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomBuildTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomDependencyManagementTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomDependencyTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomExtensionTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomModelTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomParentTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomPropertiesTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomScmTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/util/PomFinderTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/util/ReleaseUtilTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/versions/DefaultVersionInfoTest.java create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0-SNAPSHOT/artifactId-release-range-1.0-20060424.060453-1.jar create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0-SNAPSHOT/artifactId-release-range-1.0-20060424.060453-1.pom create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0-SNAPSHOT/maven-metadata.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0/artifactId-release-range-1.0.jar create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0/artifactId-release-range-1.0.pom create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/maven-metadata.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0-SNAPSHOT/artifactId-1.0-20060424.060453-1.jar create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0-SNAPSHOT/artifactId-1.0-20060424.060453-1.pom create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0-SNAPSHOT/maven-metadata.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0/artifactId-1.0.jar create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0/artifactId-1.0.pom create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.1-SNAPSHOT/artifactId-1.1-20080128.141330-1.jar create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.1-SNAPSHOT/artifactId-1.1-20080128.141330-1.pom create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.1-SNAPSHOT/maven-metadata.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/maven-metadata.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/extension-artifactId/1.3-SNAPSHOT/extension-artifactId-1.3-SNAPSHOT.jar create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/extension-artifactId/1.3-SNAPSHOT/extension-artifactId-1.3-SNAPSHOT.pom create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/parent-artifactId/1-SNAPSHOT/parent-artifactId-1-SNAPSHOT.pom create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/parent-artifactId/1/parent-artifactId-1.pom create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/parent-artifactId/maven-metadata.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.0/plugin-artifactId-1.0.jar create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.0/plugin-artifactId-1.0.pom create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.1-SNAPSHOT/maven-metadata.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.1-SNAPSHOT/plugin-artifactId-1.1-20060424.131158-1.jar create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.1-SNAPSHOT/plugin-artifactId-1.1-20060424.131158-1.pom create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/maven-metadata.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/artifactId2/1.0-SNAPSHOT/artifactId2-1.0-20100813.112234-1.pom create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/artifactId2/1.0-SNAPSHOT/maven-metadata.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/artifactId2/maven-metadata.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/1.0-SNAPSHOT/subproject1-1.0-SNAPSHOT.jar create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/1.0-SNAPSHOT/subproject1-1.0-SNAPSHOT.pom create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/2.0/subproject1-2.0.jar create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/2.0/subproject1-2.0.pom create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.pom create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/empty-release.properties create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/DefaultReleaseManagerTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/exec/ForkedMavenExecutorTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/BranchInputVariablesPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/CheckoutProjectFromScmTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/EndReleasePhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/GenerateReleasePomsPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/MapVersionsPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RemoveReleasePomsPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RemoveScmTagPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RewritePomsForBranchPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RewritePomsForReleasePhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RunCompleteGoalsPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RunPerformGoalsPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RunPrepareGoalsPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmBranchPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmCheckModificationsPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmCommitPreparationPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmTagPhaseTest.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/pomfinder/pom1.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-extension/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-dependency/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-dependency/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-plugin/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-plugin/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-parent/child/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-parent/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-range-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-all/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-extension/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-parent/child/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-parent/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-report-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-timestamped-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-dependencies/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-dependencies/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-report-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-report-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-report-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-differing-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-differing-snapshot-dependencies/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-differing-snapshot-dependencies/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-dependency/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-dependency/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-dependency/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-plugin/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-plugin/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-plugin/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies-no-reactor/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-extension/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-extension/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-extension/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-report-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-report-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-report-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/multimodule-external-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/multimodule-external-snapshot-dependencies/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/multimodule-external-snapshot-dependencies/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-range-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-report-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/snapshot-release-plugin/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-dependency/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-dependency/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-plugin/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-plugin/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-dependency/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-dependency/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-plugin/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-plugin/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/basic-pom/expected-backup.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/basic-pom/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/expected-backup.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject1/expected-backup.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject2/expected-backup.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-entities/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-entities/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-namespace/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-namespace/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-with-encoding/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-with-encoding/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom/expected-release-pom-with-schema.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject2/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/external-range-dependency/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/external-range-dependency/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject2/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject2/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject2/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject2/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject2/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject3/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject2/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject3/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject2/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject3/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/subsubproject/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject2/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject3/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject2/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject3/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject4/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject2/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject2/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject3/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject4/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-finalname/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-finalname/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/subproject1/expected-release-pom-version-changed.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject2/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-without-extension-version/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-without-extension-version/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject1/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject2/expected-release-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/basic-pom/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/pom-with-modules/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/pom-with-modules/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/pom-with-modules/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/basic-pom/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/basic-pom/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/basic-pom/pom.xml.releaseBackup create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/pom.xml.releaseBackup create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject1/pom.xml.releaseBackup create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject2/pom.xml.releaseBackup create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-entities/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-entities/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/subsubproject/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/subsubproject/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-namespace/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-namespace/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs-from-tag/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs-from-tag/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-dashes-in-comment/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-dashes-in-comment/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-empty-scm/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-empty-scm/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-encoding/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-encoding/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-scm-expression/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-scm-expression/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base-and-varying-scm-urls/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base-and-varying-scm-urls/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/expected-pom-with-schema.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-section/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-section/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/subsubproject/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject4/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject4/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/expected-pom-different-version.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject2/expected-pom-different-version.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject3/expected-pom-different-version.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/sub/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/sub/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/subproject1/expected-pom-version-changed.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/subsubproject/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/subsubproject/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/root-project/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/root-project/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject1-3.4/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject1-3.4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-without-extension-version/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-without-extension-version/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/ejb/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/ejb/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/project/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/project/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-entities/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-entities/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/subsubproject/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/subsubproject/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-namespace/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-namespace/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs-from-tag/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs-from-tag/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-encoding/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-encoding/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/expected-pom-with-schema.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/subsubproject/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/subsubproject/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/subsubproject/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject4/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject4/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/subproject1/expected-pom-version-changed.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject1-3.4/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject1-3.4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-without-extension-version/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-without-extension-version/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-entities/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-entities/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/subsubproject/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/subsubproject/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-namespace/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-namespace/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs-from-tag/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs-from-tag/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-dashes-in-comment/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-dashes-in-comment/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-empty-scm/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-empty-scm/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-encoding/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-encoding/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-scm-expression/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-scm-expression/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base-and-varying-scm-urls/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base-and-varying-scm-urls/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom-with-schema.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/subsubproject/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject4/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject4/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/expected-pom-different-version.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject2/expected-pom-different-version.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject3/expected-pom-different-version.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject3/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/sub/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/sub/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-externally-released-parent/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-externally-released-parent/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/subproject1/expected-pom-version-changed.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/subsubproject/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/subsubproject/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/root-project/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/root-project/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject1-3.4/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject1-3.4/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-without-extension-version/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-without-extension-version/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject1/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject2/expected-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multimodule-with-deep-subprojects/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multimodule-with-deep-subprojects/sub/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multimodule-with-deep-subprojects/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multiple-poms/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multiple-poms/subproject1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multiple-poms/subproject2/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/single-pom/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/release.properties create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/rewrite-release.properties create mode 100644 Java-base/maven-release/src/maven-release-manager/src/test/resources/settings-security.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/mrm/repository/dependency-1.0-SNAPSHOT.pom create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/mrm/repository/extension-1.0-SNAPSHOT.pom create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/mrm/repository/parent-1-SNAPSHOT.pom create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/mrm/settings.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-458/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-458/verify.bsh create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-694/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-694/test.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-694/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-745/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-745/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-976/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-976/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/invoker.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-459/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-459/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-592/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-736/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-736/test.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-818/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-818/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-832/invoker.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-832/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-832/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/invoker.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/MRELEASE-808/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/MRELEASE-808/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-basic/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-basic/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-multimodule/module/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-multimodule/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-multimodule/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/invoker.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-128/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-128/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-156/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-156/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/release-test-module-one/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/release-test-module-two/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/release-test-module-one/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/release-test-module-two/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-420/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-420/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-483/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-483/test.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-483/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-533/other-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-533/test.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-533/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/invoker.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/module1/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-618/my-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-618/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-667/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-667/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-834/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-834/test.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-835/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-835/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/invoker.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/my-pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/test.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/completion-goals/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/completion-goals/verify.bsh create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/invoker.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-a/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-a/src/main/java/org/apache/maven/plugin/release/module/a/App.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-a/src/test/java/org/apache/maven/plugin/release/module/a/AppTest.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-b/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-b/src/main/java/org/apache/maven/plugin/release/module/b/App.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-b/src/test/java/org/apache/maven/plugin/release/module/b/AppTest.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/parent-project/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/parent-project/verify.bsh create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/forked-basic/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/invoker-basic/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/invoker.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/namespace/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/namespace/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/oddeven-policy/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-a/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-a/src/main/java/org/apache/maven/plugin/release/module/a/App.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-a/src/test/java/org/apache/maven/plugin/release/module/a/AppTest.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-b/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-b/src/main/java/org/apache/maven/plugin/release/module/b/App.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-b/src/test/java/org/apache/maven/plugin/release/module/b/AppTest.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/verify.bsh create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/semver-policy/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/module-a/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/module-b/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-611/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-611/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-783/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/verify.groovy create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/invoker.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-naming-stub-policy/invoker.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-naming-stub-policy/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-naming-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/StubNamingPolicy.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/invoker.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/StubVersionPolicy.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/invoker.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/src/main/java/org/apache/maven/scm/provider/dummy/DummyScmProvider.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/src/main/java/org/apache/maven/scm/provider/dummy/DummyScmProviderRepository.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/invoker.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubBranchCommand.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubCheckInCommand.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubCheckOutCommand.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubScmProvider.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubScmProviderRepository.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubStatusCommand.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubTagCommand.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/invoker.properties create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/org/apache/maven/wagon/providers/dummy/DummyWagonProvider.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractScmReleaseMojo.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/CleanReleaseMojo.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareWithPomReleaseMojo.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/RollbackReleaseMojo.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/StageReleaseMojo.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/branch.apt create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/clean-release.apt create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/generate-release-poms.apt create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/lock-files.apt create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/non-interactive-release.apt create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/perform-release.apt.vm create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/prepare-release.apt.vm create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/rollback-release.apt create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/run-goals-before-commit.apt.vm create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/update-versions.apt create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/site/apt/index.apt create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/site/apt/usage.apt.vm create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/site/fml/faq.fml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/site/site.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/CleanReleaseMojoTest.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PerformReleaseMojoTest.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PrepareReleaseMojoTest.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/StageReleaseMojoTest.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/stubs/FlatMultiModuleMavenProjectStub.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/stubs/MavenProjectStub.java create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/clean/clean.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-args.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-flat-structure.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-multiline-goals.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-scm.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-without-site.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/prepare/prepare.xml create mode 100644 Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/stage/stage.xml create mode 100644 Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/main/java/org/apache/maven/shared/release/policy/oddeven/OddEvenVersionPolicy.java create mode 100644 Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/main/java/org/apache/maven/shared/release/policy/oddeven/package-info.java create mode 100644 Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/site/site.xml create mode 100644 Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/test/java/org/apache/maven/shared/release/policy/oddeven/OddEvenVersionPolicyTestCase.java create mode 100644 Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/pom.xml create mode 100644 Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/src/main/java/org/apache/maven/shared/release/policy/semver/SemVerVersionPolicy.java create mode 100644 Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/src/site/site.xml create mode 100644 Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/src/test/java/org/apache/maven/shared/release/policy/semver/SemVerVersionPolicyTest.java create mode 100644 Java-base/maven-release/src/pom.xml create mode 100644 Java-base/maven-release/src/src/site/apt/index.apt create mode 100644 Java-base/maven-release/src/src/site/resources/download.cgi create mode 100644 Java-base/maven-release/src/src/site/site.xml create mode 100644 Java-base/maven-release/src/src/site/xdoc/download.xml.vm create mode 100644 Java/maven-release-AbstractReleaseMojo_198/Dockerfile create mode 100644 Java/maven-release-AbstractReleaseMojo_198/buggy.java create mode 100644 Java/maven-release-AbstractReleaseMojo_198/metadata.json create mode 100644 Java/maven-release-AbstractReleaseMojo_198/npe.json create mode 100644 Java/maven-release-AbstractScmReleaseMojo_130/Dockerfile create mode 100644 Java/maven-release-AbstractScmReleaseMojo_130/buggy.java create mode 100644 Java/maven-release-AbstractScmReleaseMojo_130/metadata.json create mode 100644 Java/maven-release-AbstractScmReleaseMojo_130/npe.json create mode 100644 Java/maven-release-AbstractScmReleaseMojo_156/Dockerfile create mode 100644 Java/maven-release-AbstractScmReleaseMojo_156/buggy.java create mode 100644 Java/maven-release-AbstractScmReleaseMojo_156/metadata.json create mode 100644 Java/maven-release-AbstractScmReleaseMojo_156/npe.json diff --git a/Java-base/maven-release/Dockerfile b/Java-base/maven-release/Dockerfile new file mode 100644 index 000000000..e208c4890 --- /dev/null +++ b/Java-base/maven-release/Dockerfile @@ -0,0 +1,28 @@ +FROM ubuntu:22.04 + +RUN export DEBIAN_FRONTEND=noninteractive \ + && apt-get update \ + && apt-get install -y software-properties-common \ + && add-apt-repository ppa:deadsnakes/ppa \ + && apt-get update \ + && apt-get install -y \ + build-essential \ + git \ + vim \ + jq \ + && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/list/* + +RUN apt-get -y install sudo \ + openjdk-8-jdk \ + maven + +RUN bash -c "echo 2 | update-alternatives --config java" + +COPY src /workspace +WORKDIR /workspace + +RUN mvn install -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100 -DskipTests=true -DskipITs=true -Dtest=None -DfailIfNoTests=false + +RUN mvn test -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100 + +ENV TZ=Asia/Seoul diff --git a/Java-base/maven-release/src/Jenkinsfile b/Java-base/maven-release/src/Jenkinsfile new file mode 100644 index 000000000..e9f05f7d9 --- /dev/null +++ b/Java-base/maven-release/src/Jenkinsfile @@ -0,0 +1,20 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +asfMavenTlpPlgnBuild() diff --git a/Java-base/maven-release/src/README.TXT b/Java-base/maven-release/src/README.TXT new file mode 100644 index 000000000..793e8f3df --- /dev/null +++ b/Java-base/maven-release/src/README.TXT @@ -0,0 +1,11 @@ +Issue Tracking +-------------- + +https://issues.apache.org/jira/projects/MRELEASE/summary + +GitHub is provided only for Pull Requests. + +Deploying web site +------------------- + +see http://maven.apache.org/developers/website/deploy-component-reference-documentation.html diff --git a/Java-base/maven-release/src/README.md b/Java-base/maven-release/src/README.md new file mode 100644 index 000000000..604ea89c9 --- /dev/null +++ b/Java-base/maven-release/src/README.md @@ -0,0 +1,99 @@ + +Contributing to [Apache Maven Release (Plugin)](https://maven.apache.org/maven-release/) +====================== + +[![ASF Jira](https://img.shields.io/endpoint?url=https%3A%2F%2Fmaven.apache.org%2Fbadges%2Fasf_jira-MRELEASE.json)][jira] +[![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/apache/maven.svg?label=License)][license] +[![Maven Central](https://img.shields.io/maven-central/v/org.apache.maven.plugins/maven-release-plugin.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.apache.maven.plugins/maven-release-plugin) +[![Jenkins Status](https://img.shields.io/jenkins/s/https/builds.apache.org/job/maven-box/job/maven-release/job/master.svg?)][build] +[![Jenkins tests](https://img.shields.io/jenkins/t/https/builds.apache.org/job/maven-box/job/maven-release/job/master.svg?)][test-results] + + +You have found a bug or you have an idea for a cool new feature? Contributing +code is a great way to give something back to the open source community. Before +you dig right into the code, there are a few guidelines that we need +contributors to follow so that we can have a chance of keeping on top of +things. + +Getting Started +--------------- + ++ Make sure you have a [JIRA account](https://issues.apache.org/jira/). ++ Make sure you have a [GitHub account](https://github.com/signup/free). ++ If you're planning to implement a new feature, it makes sense to discuss your changes + on the [dev list][ml-list] first. + This way you can make sure you're not wasting your time on something that isn't + considered to be in Apache Maven's scope. ++ Submit a ticket for your issue, assuming one does not already exist. + + Clearly describe the issue, including steps to reproduce when it is a bug. + + Make sure you fill in the earliest version that you know has the issue. ++ Fork the repository on GitHub. + +Making and Submitting Changes +-------------- + +We accept Pull Requests via GitHub. The [developer mailing list][ml-list] is the +main channel of communication for contributors. +There are some guidelines which will make applying PRs easier for us: ++ Create a topic branch from where you want to base your work (this is usually the master branch). + Push your changes to a topic branch in your fork of the repository. ++ Make commits of logical units. ++ Respect the original code style: by using the same [codestyle][code-style], + patches should only highlight the actual difference, not being disturbed by any formatting issues: + + Only use spaces for indentation. + + Create minimal diffs - disable on save actions like reformat source code or organize imports. + If you feel the source code should be reformatted, create a separate PR for this change. + + Check for unnecessary whitespace with `git diff --check` before committing. ++ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue. +``` +[MASSEMBLY-XXX] - Subject of the JIRA Ticket + Optional supplemental description. +``` ++ Make sure you have added the necessary tests (JUnit/IT) for your changes. ++ Run all the tests with `mvn -Prun-its verify` to assure nothing else was accidentally broken. ++ Submit a pull request to the repository in the Apache organization. ++ Update your JIRA ticket and include a link to the pull request in the ticket. + +If you plan to contribute on a regular basis, please consider filing a [contributor license agreement][cla]. + +Making Trivial Changes +---------------------- + +For changes of a trivial nature to comments and documentation, it is not always +necessary to create a new ticket in JIRA. In this case, it is appropriate to +start the first line of a commit with '(doc)' instead of a ticket number. + +Additional Resources +-------------------- + ++ [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch) ++ [Apache Maven Release JIRA project page][jira] ++ [Contributor License Agreement][cla] ++ [General GitHub documentation](https://help.github.com/) ++ [GitHub pull request documentation](https://help.github.com/send-pull-requests/) ++ [Apache Maven Twitter Account](https://twitter.com/ASFMavenProject) ++ #Maven IRC channel on freenode.org + +[jira]: https://issues.apache.org/jira/projects/MRELEASE/ +[license]: https://www.apache.org/licenses/LICENSE-2.0 +[ml-list]: https://maven.apache.org/mailing-lists.html +[code-style]: https://maven.apache.org/developers/conventions/code.html +[cla]: https://www.apache.org/licenses/#clas +[maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index +[test-results]: https://builds.apache.org/job/maven-box/job/maven-release/job/master/lastCompletedBuild/testReport/ +[build]: https://builds.apache.org/job/maven-box/job/maven-release/job/master/ diff --git a/Java-base/maven-release/src/deploySite.bat b/Java-base/maven-release/src/deploySite.bat new file mode 100644 index 000000000..e1cc989fd --- /dev/null +++ b/Java-base/maven-release/src/deploySite.bat @@ -0,0 +1,21 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +mvn -Preporting site site:stage %* +mvn scm-publish:publish-scm %* diff --git a/Java-base/maven-release/src/deploySite.sh b/Java-base/maven-release/src/deploySite.sh new file mode 100644 index 000000000..f6c265d75 --- /dev/null +++ b/Java-base/maven-release/src/deploySite.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +mvn -Preporting site site:stage $@ +mvn scm-publish:publish-scm $@ diff --git a/Java-base/maven-release/src/maven-release-api/pom.xml b/Java-base/maven-release/src/maven-release-api/pom.xml new file mode 100644 index 000000000..03985e6e7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/pom.xml @@ -0,0 +1,68 @@ + + + + + 4.0.0 + + org.apache.maven.release + maven-release + 3.0.0-SNAPSHOT + + + maven-release-api + + Maven Release APIs + APIs to implement to extend maven-release-plugin. + + + + org.apache.maven + maven-repository-metadata + + + org.apache.maven + maven-artifact + + + org.apache.maven + maven-core + + + org.apache.maven + maven-model + + + org.apache.maven + maven-settings + + + org.eclipse.aether + aether-util + 1.0.0.v20140518 + true + + + + junit + junit + test + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/ReleaseExecutionException.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/ReleaseExecutionException.java new file mode 100644 index 000000000..afaf6ad8e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/ReleaseExecutionException.java @@ -0,0 +1,39 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Exception occuring during release execution. + * + * @author Brett Porter + */ +public class ReleaseExecutionException + extends Exception +{ + public ReleaseExecutionException( String message ) + { + super( message ); + } + + public ReleaseExecutionException( String message, Throwable t ) + { + super( message, t ); + } +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/ReleaseFailureException.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/ReleaseFailureException.java new file mode 100644 index 000000000..b93f4ef82 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/ReleaseFailureException.java @@ -0,0 +1,34 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 failure during the release process. + * + * @author Brett Porter + */ +public class ReleaseFailureException + extends Exception +{ + public ReleaseFailureException( String message ) + { + super( message ); + } +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/ReleaseResult.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/ReleaseResult.java new file mode 100644 index 000000000..04547ed3a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/ReleaseResult.java @@ -0,0 +1,135 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +/** + * @author Edwin Punzalan + */ +public class ReleaseResult +{ + public static final int UNDEFINED = -1, SUCCESS = 0, ERROR = 1; + + private StringBuilder stdOut = new StringBuilder(); + + private int resultCode = UNDEFINED; + + private long startTime; + + private long endTime; + + private static final String LS = System.getProperty( "line.separator" ); + + public void appendInfo( String message ) + { + stdOut.append( "[INFO] " ).append( message ).append( LS ); + } + + public void appendWarn( String message ) + { + stdOut.append( "[WARN] " ).append( message ).append( LS ); + } + + public void appendDebug( String message ) + { + stdOut.append( "[DEBUG] " ).append( message ).append( LS ); + } + + public void appendDebug( String message, Exception e ) + { + appendDebug( message ); + + stdOut.append( getStackTrace( e ) ).append( LS ); + } + + public void appendError( String message ) + { + stdOut.append( "[ERROR] " ).append( message ).append( LS ); + + setResultCode( ERROR ); + } + + public void appendError( Exception e ) + { + appendError( getStackTrace( e ) ); + } + + public void appendError( String message, Exception e ) + { + appendError( message ); + + stdOut.append( getStackTrace( e ) ).append( LS ); + } + + public void appendOutput( String message ) + { + stdOut.append( message ); + } + + public String getOutput() + { + return stdOut.toString(); + } + + public int getResultCode() + { + return resultCode; + } + + public void setResultCode( int resultCode ) + { + this.resultCode = resultCode; + } + + public long getStartTime() + { + return startTime; + } + + public void setStartTime( long startTime ) + { + this.startTime = startTime; + } + + public long getEndTime() + { + return endTime; + } + + public void setEndTime( long endTime ) + { + this.endTime = endTime; + } + + private String getStackTrace( Exception e ) + { + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); + + PrintStream stream = new PrintStream( byteStream ); + + e.printStackTrace( stream ); + + stream.flush(); + + return byteStream.toString(); + } +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptor.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptor.java new file mode 100644 index 000000000..a48272749 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptor.java @@ -0,0 +1,495 @@ +package org.apache.maven.shared.release.config; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.model.Scm; + +/** + * + * @author Robert Scholte + */ +public interface ReleaseDescriptor +{ + /** + * Get if updateDependencies is false, dependencies version won't be updated to the next development version. + * + * @return boolean + */ + boolean isUpdateDependencies(); + + /** + * Get whether to use the release profile that adds sources and javadocs to the released artifact, if appropriate. + * If set to true, this will set the property "performRelease" to true. + * + * @return boolean + */ + boolean isUseReleaseProfile(); + + /** + * Get whether to use the parent pom version for submodule versions. + * + * @return boolean + */ + boolean isAutoVersionSubmodules(); + + /** + * Get whether a SNAPSHOT of the release plugin is allowed. + * + * @return boolean + */ + boolean isSnapshotReleasePluginAllowed(); + + /** + * Get the commits must be done by modules or not. Set it to true in case of flat directory structure. + * + * @return boolean + */ + boolean isCommitByProject(); + + /** + * Get whether to create a branch instead of do a release. + * + * @return boolean + */ + boolean isBranchCreation(); + + /** + * Get whether to update branch POM versions. + * + * @return boolean + */ + boolean isUpdateBranchVersions(); + + /** + * Get whether to update working copy POM versions. + * + * @return boolean + */ + boolean isUpdateWorkingCopyVersions(); + + /** + * Get whether to suppress a commit of changes to the working copy before a tag or branch is created. + * + * @return boolean + */ + boolean isSuppressCommitBeforeTagOrBranch(); + + /** + * Get should timestamped SNAPSHOT dependencies be allowed? Default is to fail when any SNAPSHOT dependency is + * found. + * + * @return boolean + */ + boolean isAllowTimestampedSnapshots(); + + /** + * Get whether to update branch versions to SNAPSHOT. + * + * @return boolean + */ + boolean isUpdateVersionsToSnapshot(); + + /** + * Get nOTE : currently only implemented with svn scm. Enable a workaround to prevent issue due to svn client > + * 1.5.0 (https://issues.apache.org/jira/browse/SCM-406). + * + * @return boolean + */ + boolean isRemoteTagging(); + + /** + * Get if the scm provider should use local checkouts via file://${basedir} instead of doing a clean checkout over + * the network. This is very helpful for releasing large projects! + * + * @return boolean + */ + boolean isLocalCheckout(); + + /** + * Get should distributed changes be pushed to the central repository? For many distributed SCMs like Git, a change + * like a commit is only stored in your local copy of the repository. Pushing the change allows your to more easily + * share it with other users. + * + * @return boolean + */ + boolean isPushChanges(); + + /** + * Get default version to use for new working copy. + * + * Some SCMs may require a Work Item or a Task to allow the + * changes to be pushed or delivered. + * This field allows you to specify that Work Item + * or Task. It is optional, and only relevant if pushChanges is true. + * + * @return String + */ + String getWorkItem(); + + /** + * Get default version to use for new working copy. + * + * @return String + */ + String getDefaultDevelopmentVersion(); + + /** + * Get relative path of the project returned by the checkout command. + * + * @return String + */ + String getScmRelativePathProjectDirectory(); + + /** + * Get the directory where the tag will be checked out. + * + * @return String + */ + String getCheckoutDirectory(); + + /** + * Get the goals to execute in perform phase for the release. + * + * @return String + */ + String getPerformGoals(); + + /** + * Get default version to use for the tagged release or the new branch. + * + * @return String + */ + String getDefaultReleaseVersion(); + + /** + * Get nOTE : currently only implemented with svn scm. It contains the revision of the committed released pom to + * remotely tag the source code with this revision. + * + * @return String + */ + String getScmReleasedPomRevision(); + + /** + * Get whether to add the model schema to the top of the rewritten POM if it wasn't there already. If + * false then the root element will remain untouched. + * + * @return boolean + */ + boolean isAddSchema(); + + /** + * Get whether to generate release POMs. + * + * @return boolean + */ + boolean isGenerateReleasePoms(); + + /** + * Get whether the release process is interactive and the release manager should be prompted to confirm values, or + * whether the defaults are used regardless. + * + * @return boolean + */ + boolean isInteractive(); + + /** + * Get whether to use edit mode when making SCM modifications. This setting is disregarded if the SCM does not + * support edit mode, or if edit mode is compulsory for the given SCM. + * + * @return boolean + */ + boolean isScmUseEditMode(); + + /** + * + * @return list of profiles to activate + */ + List getActivateProfiles(); + + /** + * Get the last completed phase. + * + * @return String + */ + String getCompletedPhase(); + + /** + * Method getCheckModificationExcludes. + * + * @return List + */ + List getCheckModificationExcludes(); + + /** + * Get additional arguments to pass to any executed Maven process. + * + * @return String + */ + String getAdditionalArguments(); + + /** + * Get the goals to execute in preparation for the release. + * + * @return String + */ + String getPreparationGoals(); + + /** + * Get the goals to execute in on completion of preparation for the release. + * + * @return String + */ + String getCompletionGoals(); + + /** + * Get the file name of the POM to pass to any executed Maven process. + * + * @return String + */ + String getPomFileName(); + + /** + * Get the prefix of SCM modification messages. + * + * @return String + */ + String getScmCommentPrefix(); + + /** + * Get the SCM commit comment when setting pom.xml to release. + * + * @return String + * @since 3.0.0-M1 + */ + String getScmReleaseCommitComment(); + + /** + * Get the SCM commit comment when setting pom.xml back to development. + * + * @return String + * @since 3.0.0-M1 + */ + String getScmDevelopmentCommitComment(); + + /** + * Get the SCM commit comment when branching. + * + * @return String + * @since 3.0.0-M1 + */ + String getScmBranchCommitComment(); + + /** + * Get the SCM commit comment when rolling back. + * + * @return String + * @since 3.0.0-M1 + */ + String getScmRollbackCommitComment(); + + /** + * Get pass phrase for the private key. + * + * @return String + */ + String getScmPrivateKeyPassPhrase(); + + /** + * Get the password for the user interacting with the scm. + * + * @return String + */ + String getScmPassword(); + + /** + * Get private key for an SSH based SCM repository. + * + * @return String + */ + String getScmPrivateKey(); + + /** + * Get tag or branch name: the identifier for the tag/branch. Example: maven-release-plugin-2.0. + * + * @return String + */ + String getScmReleaseLabel(); + + /** + * Get where you are going to put your tagged sources Example https://svn.apache.org/repos/asf/maven/plugins/tags. + * + * @return String + */ + String getScmTagBase(); + + /** + * Get where you are going to put your branched sources Example + * https://svn.apache.org/repos/asf/maven/plugins/branches. + * + * @return String + */ + String getScmBranchBase(); + + /** + * Get the id can be used to get the credentials by the server-id from the settings.xml. + * + * @return String + */ + String getScmId(); + + /** + * Get this is a MavenSCM of where you're going to get the sources to make the release with. Example: + * scm:svn:https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-release-plugin. + * + * @return String + */ + String getScmSourceUrl(); + + /** + * Get the user name to interact with the scm. + * + * @return String + */ + String getScmUsername(); + + /** + * Get wait the specified number of seconds before creating a tag. + * + * @return int + */ + int getWaitBeforeTagging(); + + /** + * Get the directory where the release is performed. + * + * @return String + */ + String getWorkingDirectory(); + + /** + * Get specifies the format for generating a tag name. Property expansion is used with the optional prefix of + * project, where properties are delimited with @{ and }. + * + * @return String + */ + String getScmTagNameFormat(); + + /** + * Get the role-hint for the NamingPolicy implementation used to calculate the project branch and tag names. + * + * @return String + */ + String getProjectNamingPolicyId(); + + /** + * Get the role-hint for the VersionPolicy implementation used to calculate the project versions. + * + * @return String + */ + String getProjectVersionPolicyId(); + + /** + * Get the role-hint for the release Strategy implementation. + * + * @return String + */ + String getReleaseStrategyId(); + + /** + * @return {@code String} The original version for the resolved snapshot dependency. + * + * @param artifactKey the artifact key {@code String} + */ + String getDependencyOriginalVersion( String artifactKey ); + + /** + * @return {@code String} the release version for the resolved snapshot dependency. + * + * @param artifactKey the artifact key {@code String} + */ + String getDependencyReleaseVersion( String artifactKey ); + + /** + * @return {@code String} the release version for the resolved snapshot dependency. + * + * @param artifactKey the artifact key {@code String} + */ + String getDependencyDevelopmentVersion( String artifactKey ); + + + String getProjectOriginalVersion( String projectKey ); + + String getProjectDevelopmentVersion( String projectKey ); + + String getProjectReleaseVersion( String key ); + + /** + * @return the original {@code Scm} information. + * + * @param projectKey the project key {@code String} + */ + Scm getOriginalScmInfo( String projectKey ); + + // Modifiable + void addDependencyOriginalVersion( String versionlessKey, String string ); + + void addDependencyReleaseVersion( String versionlessKey, String version ); + + void addDependencyDevelopmentVersion( String versionlessKey, String version ); + + void addReleaseVersion( String projectId, String nextVersion ); + + void addDevelopmentVersion( String projectId, String nextVersion ); + + void setScmReleaseLabel( String tag ); + + void setScmReleasedPomRevision( String scmRevision ); + + void setScmRelativePathProjectDirectory( String scmRelativePathProjectDirectory ); + + void setScmSourceUrl( String scmUrl ); + + /** + * Returns whether unresolved SNAPSHOT dependencies should automatically be resolved. + * If this is set, then this specifies the default answer to be used when unresolved SNAPSHOT + * dependencies should automatically be resolved ( 0:All 1:Project Dependencies 2:Plugins + * 3:Reports 4:Extensions ). Possible values are: + * + * + * @return String + */ + String getAutoResolveSnapshots(); + + /** + * Determines whether the {@code --pin-externals} option in {@code svn copy} command is enabled + * which is new in Subversion 1.9. + * + * @return boolean + */ + boolean isPinExternals(); +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/env/ReleaseEnvironment.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/env/ReleaseEnvironment.java new file mode 100644 index 000000000..88ef9e20c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/env/ReleaseEnvironment.java @@ -0,0 +1,51 @@ +package org.apache.maven.shared.release.env; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.Locale; + +import org.apache.maven.settings.Settings; + +/** + * + */ +public interface ReleaseEnvironment +{ + + String DEFAULT_MAVEN_EXECUTOR_ID = "forked-path"; + + String getMavenExecutorId(); + + File getLocalRepositoryDirectory(); + + Settings getSettings(); + + File getMavenHome(); + + File getJavaHome(); + + /** + * + * @return the locale + * @since 2.4 + */ + Locale getLocale(); +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/phase/AbstractReleasePhase.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/phase/AbstractReleasePhase.java new file mode 100644 index 000000000..672c18e07 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/phase/AbstractReleasePhase.java @@ -0,0 +1,72 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.ReleaseResult; +import org.codehaus.plexus.logging.AbstractLogEnabled; + +/** + * Base class for all phases. + * + * @author Brett Porter + */ +public abstract class AbstractReleasePhase + extends AbstractLogEnabled + implements ReleasePhase +{ + protected void logInfo( ReleaseResult result, String message ) + { + result.appendInfo( message ); + getLogger().info( message ); + } + + protected void logWarn( ReleaseResult result, String message ) + { + result.appendWarn( message ); + getLogger().warn( message ); + } + + protected void logError( ReleaseResult result, String message ) + { + result.appendWarn( message ); + getLogger().error( message ); + } + + protected void logDebug( ReleaseResult result, String message ) + { + result.appendDebug( message ); + getLogger().debug( message ); + } + + protected void logDebug( ReleaseResult result, String message, Exception e ) + { + result.appendDebug( message, e ); + getLogger().debug( message, e ); + } + + protected ReleaseResult getReleaseResultSuccess() + { + ReleaseResult result = new ReleaseResult(); + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/phase/ReleasePhase.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/phase/ReleasePhase.java new file mode 100644 index 000000000..1170856f9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/phase/ReleasePhase.java @@ -0,0 +1,66 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; + +import java.util.List; + +/** + * A phase in the release cycle. + * + * @author Brett Porter + */ +public interface ReleasePhase +{ + /** + * Execute the phase. + * + * @param releaseDescriptor the configuration to use + * @param releaseEnvironment the environmental configuration, such as Maven settings, Maven home, etc. + * @param reactorProjects the reactor projects + * @throws ReleaseExecutionException an exception during the execution of the phase + * @throws ReleaseFailureException a failure during the execution of the phase + * @return the release result + */ + ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException; + + /** + * Simulate the phase, but don't make any changes to the project. + * + * @param releaseDescriptor the configuration to use + * @param releaseEnvironment the environmental configuration, such as Maven settings, Maven home, etc. + * @param reactorProjects the reactor projects + * @throws ReleaseExecutionException an exception during the execution of the phase + * @throws ReleaseFailureException a failure during the execution of the phase + * @return the release result + */ + ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException; + +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/phase/ResourceGenerator.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/phase/ResourceGenerator.java new file mode 100644 index 000000000..8f85e3eef --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/phase/ResourceGenerator.java @@ -0,0 +1,42 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.ReleaseResult; + +/** + * Additional interface for ReleasePhase if the phase generates resources, which should be cleaned up afterwards. + * + * @author Robert Scholte + * @since 3.0.0 + */ +public interface ResourceGenerator +{ + /** + * Clean up after a phase if it leaves any additional files in the checkout. + * + * @param reactorProjects the reactor projects + * @return the release result + */ + ReleaseResult clean( List reactorProjects ); +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/PolicyException.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/PolicyException.java new file mode 100644 index 000000000..a3d7c340a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/PolicyException.java @@ -0,0 +1,39 @@ +package org.apache.maven.shared.release.policy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * + * @since 2.5.1 (MRELEASE-431) + */ +public class PolicyException + extends Exception +{ + + public PolicyException( String message ) + { + super( message ); + } + + public PolicyException( String message, Exception exception ) + { + super( message, exception ); + } +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/naming/NamingPolicy.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/naming/NamingPolicy.java new file mode 100644 index 000000000..467f2cd82 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/naming/NamingPolicy.java @@ -0,0 +1,41 @@ +package org.apache.maven.shared.release.policy.naming; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.policy.PolicyException; + +/** + * API for branch and tag naming. Used by maven-release-plugin to suggest names for tags and branches. + * + * @since 3.0.0 (MRELEASE-979) + */ +public interface NamingPolicy +{ + /** + * @return the calculation of the name used for branching or tagging. + * + * @param request the {@code NamingPolicyRequest} + * + * @throws PolicyException if exception in the policy + */ + NamingPolicyResult getName( NamingPolicyRequest request ) + throws PolicyException; + +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/naming/NamingPolicyRequest.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/naming/NamingPolicyRequest.java new file mode 100644 index 000000000..d6181425a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/naming/NamingPolicyRequest.java @@ -0,0 +1,67 @@ +package org.apache.maven.shared.release.policy.naming; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 Robert Scholte + * @since 3.0.0 + */ +public class NamingPolicyRequest +{ + private String groupId; + + private String artifactId; + + private String version; + + public String getGroupId() + { + return groupId; + } + + public NamingPolicyRequest setGroupId( String groupId ) + { + this.groupId = groupId; + return this; + } + + public String getArtifactId() + { + return artifactId; + } + + public NamingPolicyRequest setArtifactId( String artifactId ) + { + this.artifactId = artifactId; + return this; + } + + public String getVersion() + { + return version; + } + + public NamingPolicyRequest setVersion( String version ) + { + this.version = version; + return this; + } +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/naming/NamingPolicyResult.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/naming/NamingPolicyResult.java new file mode 100644 index 000000000..411e8b724 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/naming/NamingPolicyResult.java @@ -0,0 +1,44 @@ +package org.apache.maven.shared.release.policy.naming; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * + * @since 3.0.0 (MRELEASE-979) + */ +public class NamingPolicyResult +{ + /** + * The tag or branch name to use. + */ + private String name; + + public String getName() + { + return name; + } + + public NamingPolicyResult setName( String name ) + { + this.name = name; + return this; + } + +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/version/VersionPolicy.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/version/VersionPolicy.java new file mode 100644 index 000000000..607080247 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/version/VersionPolicy.java @@ -0,0 +1,53 @@ +package org.apache.maven.shared.release.policy.version; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.shared.release.policy.PolicyException; +import org.apache.maven.shared.release.versions.VersionParseException; + +/** + * API for next version calculations, used by maven-release-plugin to suggest release and next develoment versions. + * + * @since 2.5.1 (MRELEASE-431) + */ +public interface VersionPolicy +{ + /** + * @return the calculation of the release version from development state. + * + * @param request the {@code VersionPolicyRequest} + * + * @throws PolicyException if exception in the policy + * @throws VersionParseException if exception parsing the version + */ + VersionPolicyResult getReleaseVersion( VersionPolicyRequest request ) + throws PolicyException, VersionParseException; + + /** + * @return the calculation of the next development version from release state. + * + * @param request the {@code VersionPolicyRequest} + * + * @throws PolicyException if exception in the policy + * @throws VersionParseException if exception parsing the version + */ + VersionPolicyResult getDevelopmentVersion( VersionPolicyRequest request ) + throws PolicyException, VersionParseException; +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/version/VersionPolicyRequest.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/version/VersionPolicyRequest.java new file mode 100644 index 000000000..36bd1a148 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/version/VersionPolicyRequest.java @@ -0,0 +1,57 @@ +package org.apache.maven.shared.release.policy.version; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.repository.metadata.Metadata; + +/** + * + * @since 2.5.1 (MRELEASE-431) + */ +public class VersionPolicyRequest +{ + + private String version; + + private Metadata metaData; + + public String getVersion() + { + return version; + } + + public VersionPolicyRequest setVersion( String version ) + { + this.version = version; + return this; + } + + public Metadata getMetaData() + { + return metaData; + } + + public VersionPolicyRequest setMetaData( Metadata metaData ) + { + this.metaData = metaData; + return this; + } + +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/version/VersionPolicyResult.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/version/VersionPolicyResult.java new file mode 100644 index 000000000..de7fb5836 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/policy/version/VersionPolicyResult.java @@ -0,0 +1,41 @@ +package org.apache.maven.shared.release.policy.version; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * + * @since 2.5.1 (MRELEASE-431) + */ +public class VersionPolicyResult +{ + private String version; + + public String getVersion() + { + return version; + } + + public VersionPolicyResult setVersion( String version ) + { + this.version = version; + return this; + } + +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/strategy/Strategy.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/strategy/Strategy.java new file mode 100644 index 000000000..43300b012 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/strategy/Strategy.java @@ -0,0 +1,58 @@ +package org.apache.maven.shared.release.strategy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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; + +/** + * Interface to override default strategy. + * + * If a method returns {@code null}, the default will be used, otherwise the provided collection of phaseIds + * + * @author Robert Scholte + * @since 3.0.0 + */ +public interface Strategy +{ + /** + * @return The release phases to execute the calling the prepare goal + */ + List getPreparePhases(); + + /** + * @return The release phases to execute the calling the perform goal + */ + List getPerformPhases(); + + /** + * @return The release phases to execute the calling the branch goal + */ + List getBranchPhases(); + + /** + * @return The release phases to execute the calling the rollback goal + */ + List getRollbackPhases(); + + /** + * @return The release phases to execute the calling the update-versions goal + */ + List getUpdateVersionsPhases(); +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/AetherVersion.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/AetherVersion.java new file mode 100644 index 000000000..55a014c4b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/AetherVersion.java @@ -0,0 +1,53 @@ +package org.apache.maven.shared.release.versions; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.eclipse.aether.util.version.GenericVersionScheme; +import org.eclipse.aether.version.InvalidVersionSpecificationException; + +class AetherVersion + implements org.eclipse.aether.version.Version +{ + private final org.eclipse.aether.version.Version version; + + AetherVersion( String version ) + throws VersionParseException + { + try + { + this.version = new GenericVersionScheme().parseVersion( version ); + } + catch ( InvalidVersionSpecificationException e ) + { + throw new VersionParseException( e.getMessage() ); + } + } + + @Override + public String toString() + { + return this.version.toString(); + } + + public int compareTo( org.eclipse.aether.version.Version other ) + { + return this.version.compareTo( other ); + } +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/MavenArtifactVersion.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/MavenArtifactVersion.java new file mode 100644 index 000000000..25a2acb17 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/MavenArtifactVersion.java @@ -0,0 +1,109 @@ +package org.apache.maven.shared.release.versions; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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; + +class MavenArtifactVersion + implements ArtifactVersion +{ + private final ArtifactVersion version; + + MavenArtifactVersion( String version ) + { + this.version = new DefaultArtifactVersion( version ); + } + + public int compareTo( Object o ) + { + if ( o instanceof MavenArtifactVersion ) + { + return version.compareTo( ( (MavenArtifactVersion) o ).version ); + } + else + { + return version.compareTo( version ); + } + } + + public int getMajorVersion() + { + return version.getMajorVersion(); + } + + public int getMinorVersion() + { + return version.getMinorVersion(); + } + + public int getIncrementalVersion() + { + return version.getIncrementalVersion(); + } + + public int getBuildNumber() + { + return version.getBuildNumber(); + } + + public String getQualifier() + { + return version.getQualifier(); + } + + public void parseVersion( String version ) + { + this.version.parseVersion( version ); + } + + @Override + public String toString() + { + return this.version.toString(); + } + + @Override + public int hashCode() + { + return this.version.hashCode(); + } + + @Override + public boolean equals( Object other ) + { + if ( this == other ) + { + return true; + } + if ( other == null ) + { + return false; + } + + if ( other instanceof MavenArtifactVersion ) + { + return version.equals( ( (MavenArtifactVersion) other ).version ); + } + return false; + } + + +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/Version.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/Version.java new file mode 100644 index 000000000..7d4fbcded --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/Version.java @@ -0,0 +1,337 @@ +package org.apache.maven.shared.release.versions; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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 java.util.Objects; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.maven.artifact.ArtifactUtils; +import org.codehaus.plexus.util.StringUtils; + +/** + * + */ +public class Version + implements Comparable, Cloneable +{ + private final AetherVersion aetherVersion; + + private final MavenArtifactVersion mavenArtifactVersion; + + private final String strVersion; + + private final List digits; + + private String annotation; + + private String annotationRevision; + + private final String buildSpecifier; + + private String annotationSeparator; + + private String annotationRevSeparator; + + private String buildSeparator; + + private static final int DIGITS_INDEX = 1; + + private static final int ANNOTATION_SEPARATOR_INDEX = 2; + + private static final int ANNOTATION_INDEX = 3; + + private static final int ANNOTATION_REV_SEPARATOR_INDEX = 4; + + private static final int ANNOTATION_REVISION_INDEX = 5; + + private static final int BUILD_SEPARATOR_INDEX = 6; + + private static final int BUILD_SPECIFIER_INDEX = 7; + + private static final String SNAPSHOT_IDENTIFIER = "SNAPSHOT"; + + private static final String DIGIT_SEPARATOR_STRING = "."; + + private static final String DEFAULT_ANNOTATION_REV_SEPARATOR = "-"; + + private static final String DEFAULT_BUILD_SEPARATOR = "-"; + + public static final Pattern STANDARD_PATTERN = Pattern.compile( "^((?:\\d+\\.)*\\d+)" // digit(s) and '.' repeated - + // followed by digit (version + // digits 1.22.0, etc) + + "([-_])?" // optional - or _ (annotation separator) + + "([a-zA-Z]*)" // alpha characters (looking for annotation - alpha, beta, RC, etc.) + + "([-_])?" // optional - or _ (annotation revision separator) + + "(\\d*)" // digits (any digits after rc or beta is an annotation revision) + + "(?:([-_])?(.*?))?$" ); // - or _ followed everything else (build specifier) + + /* * + * cmaki 02242009 FIX for non-digit release numbers, e.g. trunk-SNAPSHOT or just SNAPSHOT This alternate pattern + * supports version numbers like: trunk-SNAPSHOT branchName-SNAPSHOT SNAPSHOT + */ + // for SNAPSHOT releases only (possible versions include: trunk-SNAPSHOT or SNAPSHOT) + public static final Pattern ALTERNATE_PATTERN = Pattern.compile( "^(SNAPSHOT|[a-zA-Z]+[_-]SNAPSHOT)" ); + + private Version( List digits, String annotation, String annotationRevision, String buildSpecifier, + String annotationSeparator, String annotationRevSeparator, String buildSeparator ) + { + this.digits = digits; + this.annotation = annotation; + this.annotationRevision = annotationRevision; + this.buildSpecifier = buildSpecifier; + this.annotationSeparator = annotationSeparator; + this.annotationRevSeparator = annotationRevSeparator; + this.buildSeparator = buildSeparator; + this.strVersion = getVersionString( this, buildSpecifier, buildSeparator ); + + // for now no need to reparse, original version was valid + this.aetherVersion = null; + this.mavenArtifactVersion = null; + } + + public Version( String version ) + throws VersionParseException + { + this.strVersion = version; + this.aetherVersion = new AetherVersion( version ); + this.mavenArtifactVersion = new MavenArtifactVersion( version ); + + // FIX for non-digit release numbers, e.g. trunk-SNAPSHOT or just SNAPSHOT + Matcher matcher = ALTERNATE_PATTERN.matcher( strVersion ); + // TODO: hack because it didn't support "SNAPSHOT" + if ( matcher.matches() ) + { + annotation = null; + digits = null; + buildSpecifier = version; + buildSeparator = null; + return; + } + + Matcher m = STANDARD_PATTERN.matcher( strVersion ); + if ( m.matches() ) + { + digits = parseDigits( m.group( DIGITS_INDEX ) ); + if ( !SNAPSHOT_IDENTIFIER.equals( m.group( ANNOTATION_INDEX ) ) ) + { + annotationSeparator = m.group( ANNOTATION_SEPARATOR_INDEX ); + annotation = nullIfEmpty( m.group( ANNOTATION_INDEX ) ); + + if ( StringUtils.isNotEmpty( m.group( ANNOTATION_REV_SEPARATOR_INDEX ) ) + && StringUtils.isEmpty( m.group( ANNOTATION_REVISION_INDEX ) ) ) + { + // The build separator was picked up as the annotation revision separator + buildSeparator = m.group( ANNOTATION_REV_SEPARATOR_INDEX ); + buildSpecifier = nullIfEmpty( m.group( BUILD_SPECIFIER_INDEX ) ); + } + else + { + annotationRevSeparator = m.group( ANNOTATION_REV_SEPARATOR_INDEX ); + annotationRevision = nullIfEmpty( m.group( ANNOTATION_REVISION_INDEX ) ); + + buildSeparator = m.group( BUILD_SEPARATOR_INDEX ); + buildSpecifier = nullIfEmpty( m.group( BUILD_SPECIFIER_INDEX ) ); + } + } + else + { + // Annotation was "SNAPSHOT" so populate the build specifier with that data + buildSeparator = m.group( ANNOTATION_SEPARATOR_INDEX ); + buildSpecifier = nullIfEmpty( m.group( ANNOTATION_INDEX ) ); + } + } + else + { + throw new VersionParseException( "Unable to parse the version string: \"" + version + "\"" ); + } + } + + public boolean isSnapshot() + { + return ArtifactUtils.isSnapshot( strVersion ); + } + + public String toString() + { + return strVersion; + } + + protected static String getVersionString( Version info, String buildSpecifier, String buildSeparator ) + { + StringBuilder sb = new StringBuilder(); + + if ( info.digits != null ) + { + sb.append( joinDigitString( info.digits ) ); + } + + if ( StringUtils.isNotEmpty( info.annotation ) ) + { + sb.append( StringUtils.defaultString( info.annotationSeparator ) ); + sb.append( info.annotation ); + } + + if ( StringUtils.isNotEmpty( info.annotationRevision ) ) + { + if ( StringUtils.isEmpty( info.annotation ) ) + { + sb.append( StringUtils.defaultString( info.annotationSeparator ) ); + } + else + { + sb.append( StringUtils.defaultString( info.annotationRevSeparator ) ); + } + sb.append( info.annotationRevision ); + } + + if ( StringUtils.isNotEmpty( buildSpecifier ) ) + { + sb.append( StringUtils.defaultString( buildSeparator ) ); + sb.append( buildSpecifier ); + } + + return sb.toString(); + } + + /** + * Simply joins the items in the list with "." period + * + * @return a {@code String} containing the items in the list joined by "." period + * @param digits the list of digits {@code List} + */ + protected static String joinDigitString( List digits ) + { + return digits != null ? StringUtils.join( digits.iterator(), DIGIT_SEPARATOR_STRING ) : null; + } + + /** + * Splits the string on "." and returns a list containing each digit. + * + * @param strDigits + */ + private List parseDigits( String strDigits ) + { + return Arrays.asList( StringUtils.split( strDigits, DIGIT_SEPARATOR_STRING ) ); + } + + private static String nullIfEmpty( String s ) + { + return StringUtils.isEmpty( s ) ? null : s; + } + + public List getDigits() + { + return digits; + } + + public String getAnnotation() + { + return annotation; + } + + public String getAnnotationRevSeparator() + { + return annotationRevSeparator; + } + + public String getAnnotationRevision() + { + return annotationRevision; + } + + public String getBuildSeparator() + { + return buildSeparator; + } + + public String getBuildSpecifier() + { + return buildSpecifier; + } + + /** + * + * @param newDigits the new list of digits + * @return a new instance of Version + */ + public Version setDigits( List newDigits ) + { + return new Version( newDigits, this.annotation, this.annotationRevision, this.buildSpecifier, + this.annotationSeparator, this.annotationRevSeparator, this.buildSeparator ); + } + + /** + * + * @param newAnnotationRevision the new annotation revision + * @return a new instance of Version + */ + public Version setAnnotationRevision( String newAnnotationRevision ) + { + return new Version( this.digits, this.annotation, newAnnotationRevision, this.buildSpecifier, + this.annotationSeparator, + Objects.toString( this.annotationRevSeparator, DEFAULT_ANNOTATION_REV_SEPARATOR ), + this.buildSeparator ); + } + + /** + * + * @param newBuildSpecifier the new build specifier + * @return a new instance of Version + */ + public Version setBuildSpecifier( String newBuildSpecifier ) + { + return new Version( this.digits, this.annotation, this.annotationRevision, newBuildSpecifier, + this.annotationSeparator, this.annotationRevSeparator, + Objects.toString( this.buildSeparator, DEFAULT_BUILD_SEPARATOR ) ); + } + + /** + * @throws VersionComparisonConflictException if {@link org.eclipse.aether.version.Version} and + * {@link org.apache.maven.artifact.versioning.ArtifactVersion ArtifactVersion} give different results + */ + public int compareTo( Version other ) + throws VersionComparisonConflictException + { + int aetherComparisonResult = this.aetherVersion.compareTo( other.aetherVersion ); + int mavenComparisonResult = this.mavenArtifactVersion.compareTo( other.mavenArtifactVersion ); + + if ( aetherComparisonResult < 0 && mavenComparisonResult < 0 ) + { + return -1; + } + else if ( aetherComparisonResult == 0 && mavenComparisonResult == 0 ) + { + return 0; + } + else if ( aetherComparisonResult > 0 && mavenComparisonResult > 0 ) + { + return 1; + } + else + { + throw new VersionComparisonConflictException( this.strVersion, other.strVersion, aetherComparisonResult, + mavenComparisonResult ); + } + } + +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/VersionComparisonConflictException.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/VersionComparisonConflictException.java new file mode 100644 index 000000000..441692eb7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/VersionComparisonConflictException.java @@ -0,0 +1,53 @@ +package org.apache.maven.shared.release.versions; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 VersionComparisonConflictException + extends RuntimeException +{ + + private final String lhsVersion; + + private final String rhsVersion; + + private int aetherComparisonResult; + + private int mavenComparisonResult; + + public VersionComparisonConflictException( String lhsVersion, String rhsVersion, int aetherComparisonResult, + int mavenComparisonResult ) + { + this.lhsVersion = lhsVersion; + this.rhsVersion = rhsVersion; + this.aetherComparisonResult = aetherComparisonResult; + this.mavenComparisonResult = mavenComparisonResult; + } + + @Override + public String getMessage() + { + return "Conflict when comparing " + lhsVersion + " with " + rhsVersion + "; Aether: " + aetherComparisonResult + + "; Maven: " + mavenComparisonResult; + } + +} diff --git a/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/VersionParseException.java b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/VersionParseException.java new file mode 100644 index 000000000..d37cd9218 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/VersionParseException.java @@ -0,0 +1,32 @@ +package org.apache.maven.shared.release.versions; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 VersionParseException + extends Exception +{ + public VersionParseException( String message ) + { + super( message ); + } +} diff --git a/Java-base/maven-release/src/maven-release-api/src/site/site.xml b/Java-base/maven-release/src/maven-release-api/src/site/site.xml new file mode 100644 index 000000000..220ecbb57 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-api/src/site/site.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/pom.xml b/Java-base/maven-release/src/maven-release-manager/pom.xml new file mode 100644 index 000000000..9f1edb004 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/pom.xml @@ -0,0 +1,289 @@ + + + + + 4.0.0 + + + org.apache.maven.release + maven-release + 3.0.0-SNAPSHOT + + + maven-release-manager + + Maven Release Manager + + + + org.apache.maven.release + maven-release-api + 3.0.0-SNAPSHOT + + + org.codehaus.plexus + plexus-utils + + + org.codehaus.plexus + plexus-interactivity-api + 1.0-alpha-6 + + + plexus + plexus-utils + + + org.codehaus.plexus + plexus-component-api + + + + + org.codehaus.plexus + plexus-interpolation + 1.17 + + + + org.sonatype.plexus + plexus-sec-dispatcher + 1.3 + + + org.sonatype.plexus + plexus-cipher + 1.4 + + + + org.apache.maven + maven-model + + + org.apache.maven + maven-artifact + + + org.apache.maven + maven-core + + + org.apache.maven + maven-settings + + + org.apache.maven.shared + maven-invoker + 2.2 + + + org.apache.commons + commons-lang3 + 3.7 + + + commons-cli + commons-cli + 1.2 + + + commons-lang + commons-lang + + + + + commons-io + commons-io + 2.6 + + + + org.apache.maven.scm + maven-scm-providers-standard + pom + runtime + + + org.apache.maven.scm + maven-scm-manager-plexus + runtime + + + org.apache.maven.scm + maven-scm-api + + + org.apache.maven.scm + maven-scm-provider-svn-commons + + + org.apache.maven.shared + maven-artifact-transfer + 0.9.1 + + + + org.jdom + jdom + + + + junit + junit + test + + + org.apache.maven + maven-compat + test + + + org.apache.maven.scm + maven-scm-test + test + + + org.mockito + mockito-core + test + + + org.xmlunit + xmlunit-core + test + + + org.sonatype.aether + aether-connector-file + 1.7 + test + + + org.sonatype.aether + aether-connector-wagon + 1.7 + test + + + + + + + maven-surefire-plugin + + -Xmx256m + + ${project.build.testOutputDirectory}/settings-security.xml + ${maven.home} + + + + + org.codehaus.modello + modello-maven-plugin + + + + xpp3-reader + java + xpp3-writer + + + + + 3.0.0 + false + true + + src/main/mdo/release-descriptor.mdo + + + + + org.codehaus.plexus + plexus-component-metadata + + + + generate-metadata + + + + class + + + + + merge + process-classes + + merge-metadata + + + ${project.build.outputDirectory}/META-INF/plexus/components.xml + + ${project.build.outputDirectory}/META-INF/plexus/components.xml + src/main/components-fragment.xml + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + integration-test + verify + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + org.apache.maven.shared.release.config + + + + + + + + reporting + + + + org.codehaus.plexus + plexus-maven-plugin + 1.3.8 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/components-fragment.xml b/Java-base/maven-release/src/maven-release-manager/src/main/components-fragment.xml new file mode 100644 index 000000000..6bb0f3165 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/components-fragment.xml @@ -0,0 +1,261 @@ + + + + + + + + org.apache.maven.shared.release.strategy.Strategy + default + org.apache.maven.shared.release.strategies.DefaultStrategy + + + check-poms + scm-check-modifications + check-dependency-snapshots + create-backup-poms + map-release-versions + input-variables + map-development-versions + rewrite-poms-for-release + generate-release-poms + run-preparation-goals + scm-commit-release + scm-tag + rewrite-poms-for-development + remove-release-poms + run-completion-goals + scm-commit-development + end-release + + + verify-completed-prepare-phases + checkout-project-from-scm + run-perform-goals + + + restore-backup-poms + scm-commit-rollback + remove-scm-tag + + + check-poms + scm-check-modifications + create-backup-poms + map-branch-versions + branch-input-variables + map-development-versions + rewrite-poms-for-branch + scm-commit-branch + scm-branch + rewrite-poms-for-development + scm-commit-development + end-release + + + check-poms-updateversions + create-backup-poms + map-development-versions + rewrite-pom-versions + + + + + + org.apache.maven.shared.release.phase.ReleasePhase + map-release-versions + org.apache.maven.shared.release.phase.MapVersionsPhase + + false + + + + org.codehaus.plexus.components.interactivity.Prompter + default + + + org.apache.maven.shared.release.policy.version.VersionPolicy + versionPolicies + + + + + org.apache.maven.shared.release.phase.ReleasePhase + map-development-versions + org.apache.maven.shared.release.phase.MapVersionsPhase + + true + + + + org.codehaus.plexus.components.interactivity.Prompter + default + + + org.apache.maven.shared.release.policy.version.VersionPolicy + versionPolicies + + + + + org.apache.maven.shared.release.phase.ReleasePhase + map-branch-versions + org.apache.maven.shared.release.phase.MapVersionsPhase + + true + true + + + + org.codehaus.plexus.components.interactivity.Prompter + default + + + org.apache.maven.shared.release.policy.version.VersionPolicy + versionPolicies + + + + + org.apache.maven.shared.release.phase.ReleasePhase + scm-commit-release + org.apache.maven.shared.release.phase.ScmCommitPreparationPhase + + + org.apache.maven.shared.release.scm.ScmRepositoryConfigurator + + + + getScmReleaseCommitComment + + + + org.apache.maven.shared.release.phase.ReleasePhase + scm-commit-development + org.apache.maven.shared.release.phase.ScmCommitDevelopmentPhase + + + org.apache.maven.shared.release.scm.ScmRepositoryConfigurator + + + + getScmDevelopmentCommitComment + rollback changes from release preparation of {0} + + + + org.apache.maven.shared.release.phase.ReleasePhase + scm-commit-branch + org.apache.maven.shared.release.phase.ScmCommitPreparationPhase + + + org.apache.maven.shared.release.scm.ScmRepositoryConfigurator + + + + getScmBranchCommitComment + + + + org.apache.maven.shared.release.phase.ReleasePhase + scm-commit-rollback + org.apache.maven.shared.release.phase.ScmCommitPreparationPhase + + + org.apache.maven.shared.release.scm.ScmRepositoryConfigurator + + + + getScmRollbackCommitComment + + + + org.apache.maven.shared.release.phase.ReleasePhase + check-poms + org.apache.maven.shared.release.phase.CheckPomPhase + + true + true + + + + org.apache.maven.shared.release.scm.ScmRepositoryConfigurator + + + + + org.apache.maven.shared.release.phase.ReleasePhase + check-poms-updateversions + org.apache.maven.shared.release.phase.CheckPomPhase + + false + false + + + + org.apache.maven.shared.release.scm.ScmRepositoryConfigurator + + + + + org.apache.maven.shared.release.phase.ReleasePhase + input-variables + org.apache.maven.shared.release.phase.InputVariablesPhase + + false + default + + + + org.codehaus.plexus.components.interactivity.Prompter + default + + + org.apache.maven.shared.release.scm.ScmRepositoryConfigurator + + + org.apache.maven.shared.release.policy.naming.NamingPolicy + namingPolicies + + + + + org.apache.maven.shared.release.phase.ReleasePhase + branch-input-variables + org.apache.maven.shared.release.phase.InputVariablesPhase + + true + + + + org.codehaus.plexus.components.interactivity.Prompter + default + + + org.apache.maven.shared.release.scm.ScmRepositoryConfigurator + + + org.apache.maven.shared.release.policy.naming.NamingPolicy + namingPolicies + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/AbstractReleaseRequest.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/AbstractReleaseRequest.java new file mode 100644 index 000000000..470c6c24a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/AbstractReleaseRequest.java @@ -0,0 +1,87 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; + +/** + * + * @author Robert Scholte + * @since 2.3 + */ +public abstract class AbstractReleaseRequest +{ + private ReleaseDescriptorBuilder releaseDescriptorBuilder; + + private List reactorProjects; + + private ReleaseManagerListener releaseManagerListener; + + /** + * @return the releaseDescriptor + */ + public ReleaseDescriptorBuilder getReleaseDescriptorBuilder() + { + return releaseDescriptorBuilder; + } + + /** + * @param releaseDescriptor the releaseDescriptor to set + */ + public void setReleaseDescriptorBuilder( ReleaseDescriptorBuilder releaseDescriptor ) + { + this.releaseDescriptorBuilder = releaseDescriptor; + } + + /** + * @return the reactorProjects + */ + public List getReactorProjects() + { + return reactorProjects; + } + + /** + * @param reactorProjects the reactorProjects to set + */ + public void setReactorProjects( List reactorProjects ) + { + this.reactorProjects = reactorProjects; + } + + /** + * @return the releaseManagerListener + */ + public ReleaseManagerListener getReleaseManagerListener() + { + return releaseManagerListener; + } + + /** + * @param releaseManagerListener the releaseManagerListener to set + */ + public void setReleaseManagerListener( ReleaseManagerListener releaseManagerListener ) + { + this.releaseManagerListener = releaseManagerListener; + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java new file mode 100644 index 000000000..f023ab680 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java @@ -0,0 +1,699 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.commons.lang3.BooleanUtils; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder.BuilderReleaseDescriptor; +import org.apache.maven.shared.release.config.ReleaseDescriptorStore; +import org.apache.maven.shared.release.config.ReleaseDescriptorStoreException; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.phase.ReleasePhase; +import org.apache.maven.shared.release.phase.ResourceGenerator; +import org.apache.maven.shared.release.strategy.Strategy; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.logging.AbstractLogEnabled; +import org.codehaus.plexus.util.StringUtils; + +/** + * Implementation of the release manager. + * + * @author Brett Porter + */ +@Component( role = ReleaseManager.class ) +public class DefaultReleaseManager + extends AbstractLogEnabled + implements ReleaseManager +{ + @Requirement + private Map strategies; + + /** + * The available phases. + */ + @Requirement + private Map releasePhases; + + /** + * The configuration storage. + */ + @Requirement( hint = "properties" ) + private ReleaseDescriptorStore configStore; + + private static final int PHASE_SKIP = 0, PHASE_START = 1, PHASE_END = 2, GOAL_END = 12, ERROR = 99; + + @Override + public ReleaseResult prepareWithResult( ReleasePrepareRequest prepareRequest ) + { + ReleaseResult result = new ReleaseResult(); + + result.setStartTime( System.currentTimeMillis() ); + + try + { + prepare( prepareRequest, result ); + + result.setResultCode( ReleaseResult.SUCCESS ); + } + catch ( ReleaseExecutionException | ReleaseFailureException e ) + { + captureException( result, prepareRequest.getReleaseManagerListener(), e ); + } + finally + { + result.setEndTime( System.currentTimeMillis() ); + } + + return result; + } + + @Override + public void prepare( ReleasePrepareRequest prepareRequest ) + throws ReleaseExecutionException, ReleaseFailureException + { + prepare( prepareRequest, new ReleaseResult() ); + } + + private void prepare( ReleasePrepareRequest prepareRequest, ReleaseResult result ) + throws ReleaseExecutionException, ReleaseFailureException + { + + final ReleaseDescriptorBuilder builder = prepareRequest.getReleaseDescriptorBuilder(); + + // Create a config containing values from the session properties (ie command line properties with cli). + ReleaseUtils.copyPropertiesToReleaseDescriptor( prepareRequest.getUserProperties(), + new ReleaseDescriptorBuilder() + { + public ReleaseDescriptorBuilder addDevelopmentVersion( String key, + String value ) + { + builder.addDevelopmentVersion( key, value ); + return this; + } + + public ReleaseDescriptorBuilder addReleaseVersion( String key, + String value ) + { + builder.addReleaseVersion( key, value ); + return this; + } + + public ReleaseDescriptorBuilder addDependencyReleaseVersion( String dependencyKey, + String version ) + { + builder.addDependencyReleaseVersion( dependencyKey, version ); + return this; + } + + public ReleaseDescriptorBuilder addDependencyDevelopmentVersion( String dependencyKey, + String version ) + { + builder.addDependencyDevelopmentVersion( dependencyKey, version ); + return this; + } + } ); + + BuilderReleaseDescriptor config; + if ( BooleanUtils.isNotFalse( prepareRequest.getResume() ) ) + { + config = loadReleaseDescriptor( builder, prepareRequest.getReleaseManagerListener() ); + } + else + { + config = ReleaseUtils.buildReleaseDescriptor( builder ); + } + + Strategy releaseStrategy = getStrategy( config.getReleaseStrategyId() ); + + List preparePhases = getGoalPhases( releaseStrategy, "prepare" ); + + goalStart( prepareRequest.getReleaseManagerListener(), "prepare", preparePhases ); + + // Later, it would be a good idea to introduce a proper workflow tool so that the release can be made up of a + // more flexible set of steps. + + String completedPhase = config.getCompletedPhase(); + int index = preparePhases.indexOf( completedPhase ); + + for ( int idx = 0; idx <= index; idx++ ) + { + updateListener( prepareRequest.getReleaseManagerListener(), preparePhases.get( idx ), PHASE_SKIP ); + } + + if ( index == preparePhases.size() - 1 ) + { + logInfo( result, "Release preparation already completed. You can now continue with release:perform, " + + "or start again using the -Dresume=false flag" ); + } + else if ( index >= 0 ) + { + logInfo( result, "Resuming release from phase '" + preparePhases.get( index + 1 ) + "'" ); + } + + // start from next phase + for ( int i = index + 1; i < preparePhases.size(); i++ ) + { + String name = preparePhases.get( i ); + + ReleasePhase phase = releasePhases.get( name ); + + if ( phase == null ) + { + throw new ReleaseExecutionException( "Unable to find phase '" + name + "' to execute" ); + } + + updateListener( prepareRequest.getReleaseManagerListener(), name, PHASE_START ); + + ReleaseResult phaseResult = null; + try + { + if ( BooleanUtils.isTrue( prepareRequest.getDryRun() ) ) + { + phaseResult = phase.simulate( config, + prepareRequest.getReleaseEnvironment(), + prepareRequest.getReactorProjects() ); + } + else + { + phaseResult = phase.execute( config, + prepareRequest.getReleaseEnvironment(), + prepareRequest.getReactorProjects() ); + } + } + finally + { + if ( result != null && phaseResult != null ) + { + result.appendOutput( phaseResult.getOutput() ); + } + } + + config.setCompletedPhase( name ); + try + { + configStore.write( config ); + } + catch ( ReleaseDescriptorStoreException e ) + { + // TODO: rollback? + throw new ReleaseExecutionException( "Error writing release properties after completing phase", e ); + } + + updateListener( prepareRequest.getReleaseManagerListener(), name, PHASE_END ); + } + + updateListener( prepareRequest.getReleaseManagerListener(), "prepare", GOAL_END ); + } + + @Override + public void rollback( ReleaseRollbackRequest rollbackRequest ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseDescriptor releaseDescriptor = + loadReleaseDescriptor( rollbackRequest.getReleaseDescriptorBuilder(), null ); + + Strategy releaseStrategy = getStrategy( releaseDescriptor.getReleaseStrategyId() ); + + List rollbackPhases = getGoalPhases( releaseStrategy, "rollback" ); + + goalStart( rollbackRequest.getReleaseManagerListener(), "rollback", rollbackPhases ); + + for ( String name : rollbackPhases ) + { + ReleasePhase phase = releasePhases.get( name ); + + if ( phase == null ) + { + throw new ReleaseExecutionException( "Unable to find phase '" + name + "' to execute" ); + } + + updateListener( rollbackRequest.getReleaseManagerListener(), name, PHASE_START ); + phase.execute( releaseDescriptor, + rollbackRequest.getReleaseEnvironment(), + rollbackRequest.getReactorProjects() ); + updateListener( rollbackRequest.getReleaseManagerListener(), name, PHASE_END ); + } + + //call release:clean so that resume will not be possible anymore after a rollback + clean( rollbackRequest ); + updateListener( rollbackRequest.getReleaseManagerListener(), "rollback", GOAL_END ); + } + + @Override + public ReleaseResult performWithResult( ReleasePerformRequest performRequest ) + { + ReleaseResult result = new ReleaseResult(); + + try + { + result.setStartTime( System.currentTimeMillis() ); + + perform( performRequest, result ); + + result.setResultCode( ReleaseResult.SUCCESS ); + } + catch ( ReleaseExecutionException | ReleaseFailureException e ) + { + captureException( result, performRequest.getReleaseManagerListener(), e ); + } + finally + { + result.setEndTime( System.currentTimeMillis() ); + } + + return result; + } + + @Override + public void perform( ReleasePerformRequest performRequest ) + throws ReleaseExecutionException, ReleaseFailureException + { + perform( performRequest, new ReleaseResult() ); + } + + private void perform( ReleasePerformRequest performRequest, ReleaseResult result ) + throws ReleaseExecutionException, ReleaseFailureException + { + List specificProfiles = + ReleaseUtils.buildReleaseDescriptor( performRequest.getReleaseDescriptorBuilder() ) + .getActivateProfiles(); + + ReleaseDescriptor releaseDescriptor = + loadReleaseDescriptor( performRequest.getReleaseDescriptorBuilder(), + performRequest.getReleaseManagerListener() ); + + if ( specificProfiles != null && !specificProfiles.isEmpty() ) + { + for ( String specificProfile : specificProfiles ) + { + if ( !releaseDescriptor.getActivateProfiles().contains( specificProfile ) ) + { + releaseDescriptor.getActivateProfiles().add( specificProfile ); + } + } + } + + Strategy releaseStrategy = getStrategy( releaseDescriptor.getReleaseStrategyId() ); + + List performPhases = getGoalPhases( releaseStrategy, "perform" ); + + goalStart( performRequest.getReleaseManagerListener(), "perform", performPhases ); + + for ( String name : performPhases ) + { + ReleasePhase phase = releasePhases.get( name ); + + if ( phase == null ) + { + throw new ReleaseExecutionException( "Unable to find phase '" + name + "' to execute" ); + } + + updateListener( performRequest.getReleaseManagerListener(), name, PHASE_START ); + + ReleaseResult phaseResult = null; + try + { + if ( BooleanUtils.isTrue( performRequest.getDryRun() ) ) + { + phaseResult = phase.simulate( releaseDescriptor, + performRequest.getReleaseEnvironment(), + performRequest.getReactorProjects() ); + } + else + { + phaseResult = phase.execute( releaseDescriptor, + performRequest.getReleaseEnvironment(), + performRequest.getReactorProjects() ); + } + } + finally + { + if ( result != null && phaseResult != null ) + { + result.appendOutput( phaseResult.getOutput() ); + } + } + + updateListener( performRequest.getReleaseManagerListener(), name, PHASE_END ); + } + + if ( BooleanUtils.isNotFalse( performRequest.getClean() ) ) + { + // call release:clean so that resume will not be possible anymore after a perform + clean( performRequest ); + } + + updateListener( performRequest.getReleaseManagerListener(), "perform", GOAL_END ); + } + + @Override + public void branch( ReleaseBranchRequest branchRequest ) + throws ReleaseExecutionException, ReleaseFailureException + { + final ReleaseDescriptorBuilder builder = branchRequest.getReleaseDescriptorBuilder(); + + ReleaseUtils.copyPropertiesToReleaseDescriptor( branchRequest.getUserProperties(), + new ReleaseDescriptorBuilder() + { + public ReleaseDescriptorBuilder addDevelopmentVersion( String key, + String value ) + { + builder.addDevelopmentVersion( key, value ); + return this; + } + + public ReleaseDescriptorBuilder addReleaseVersion( String key, + String value ) + { + builder.addReleaseVersion( key, value ); + return this; + } + } ); + + ReleaseDescriptor releaseDescriptor = + loadReleaseDescriptor( builder, branchRequest.getReleaseManagerListener() ); + + boolean dryRun = BooleanUtils.isTrue( branchRequest.getDryRun() ); + + Strategy releaseStrategy = getStrategy( releaseDescriptor.getReleaseStrategyId() ); + + List branchPhases = getGoalPhases( releaseStrategy, "branch" ); + + goalStart( branchRequest.getReleaseManagerListener(), "branch", branchPhases ); + + for ( String name : branchPhases ) + { + ReleasePhase phase = releasePhases.get( name ); + + if ( phase == null ) + { + throw new ReleaseExecutionException( "Unable to find phase '" + name + "' to execute" ); + } + + updateListener( branchRequest.getReleaseManagerListener(), name, PHASE_START ); + + if ( dryRun ) + { + phase.simulate( releaseDescriptor, + branchRequest.getReleaseEnvironment(), + branchRequest.getReactorProjects() ); + } + else // getDryRun is null or FALSE + { + phase.execute( releaseDescriptor, + branchRequest.getReleaseEnvironment(), + branchRequest.getReactorProjects() ); + } + updateListener( branchRequest.getReleaseManagerListener(), name, PHASE_END ); + } + + if ( !dryRun ) + { + clean( branchRequest ); + } + + updateListener( branchRequest.getReleaseManagerListener(), "branch", GOAL_END ); + } + + @Override + public void updateVersions( ReleaseUpdateVersionsRequest updateVersionsRequest ) + throws ReleaseExecutionException, ReleaseFailureException + { + final ReleaseDescriptorBuilder builder = updateVersionsRequest.getReleaseDescriptorBuilder(); + + // Create a config containing values from the session properties (ie command line properties with cli). + ReleaseUtils.copyPropertiesToReleaseDescriptor( updateVersionsRequest.getUserProperties(), + new ReleaseDescriptorBuilder() + { + public ReleaseDescriptorBuilder addDevelopmentVersion( String key, + String value ) + { + builder.addDevelopmentVersion( key, value ); + return this; + } + + public ReleaseDescriptorBuilder addReleaseVersion( String key, + String value ) + { + builder.addReleaseVersion( key, value ); + return this; + } + } ); + + ReleaseDescriptor releaseDescriptor = + loadReleaseDescriptor( builder, updateVersionsRequest.getReleaseManagerListener() ); + + Strategy releaseStrategy = getStrategy( releaseDescriptor.getReleaseStrategyId() ); + + List updateVersionsPhases = getGoalPhases( releaseStrategy, "updateVersions" ); + + goalStart( updateVersionsRequest.getReleaseManagerListener(), "updateVersions", updateVersionsPhases ); + + for ( String name : updateVersionsPhases ) + { + ReleasePhase phase = releasePhases.get( name ); + + if ( phase == null ) + { + throw new ReleaseExecutionException( "Unable to find phase '" + name + "' to execute" ); + } + + updateListener( updateVersionsRequest.getReleaseManagerListener(), name, PHASE_START ); + phase.execute( releaseDescriptor, + updateVersionsRequest.getReleaseEnvironment(), + updateVersionsRequest.getReactorProjects() ); + updateListener( updateVersionsRequest.getReleaseManagerListener(), name, PHASE_END ); + } + + clean( updateVersionsRequest ); + + updateListener( updateVersionsRequest.getReleaseManagerListener(), "updateVersions", GOAL_END ); + } + + /** + * Determines the path of the working directory. By default, this is the + * checkout directory. For some SCMs, the project root directory is not the + * checkout directory itself, but a SCM-specific subdirectory. + * + * @param checkoutDirectory The checkout directory as java.io.File + * @param relativePathProjectDirectory The relative path of the project directory within the checkout + * directory or "" + * @return The working directory + */ + protected File determineWorkingDirectory( File checkoutDirectory, String relativePathProjectDirectory ) + { + if ( StringUtils.isNotEmpty( relativePathProjectDirectory ) ) + { + return new File( checkoutDirectory, relativePathProjectDirectory ); + } + else + { + return checkoutDirectory; + } + } + + private BuilderReleaseDescriptor loadReleaseDescriptor( ReleaseDescriptorBuilder builder, + ReleaseManagerListener listener ) + throws ReleaseExecutionException + { + try + { + updateListener( listener, "verify-release-configuration", PHASE_START ); + BuilderReleaseDescriptor descriptor = ReleaseUtils.buildReleaseDescriptor( configStore.read( builder ) ); + updateListener( listener, "verify-release-configuration", PHASE_END ); + return descriptor; + } + catch ( ReleaseDescriptorStoreException e ) + { + updateListener( listener, e.getMessage(), ERROR ); + + throw new ReleaseExecutionException( "Error reading stored configuration: " + e.getMessage(), e ); + } + } + + + protected void clean( AbstractReleaseRequest releaseRequest ) throws ReleaseFailureException + { + ReleaseCleanRequest cleanRequest = new ReleaseCleanRequest(); + cleanRequest.setReleaseDescriptorBuilder( releaseRequest.getReleaseDescriptorBuilder() ); + cleanRequest.setReleaseManagerListener( releaseRequest.getReleaseManagerListener() ); + cleanRequest.setReactorProjects( releaseRequest.getReactorProjects() ); + + clean( cleanRequest ); + } + + @Override + public void clean( ReleaseCleanRequest cleanRequest ) throws ReleaseFailureException + { + updateListener( cleanRequest.getReleaseManagerListener(), "cleanup", PHASE_START ); + + getLogger().info( "Cleaning up after release..." ); + + ReleaseDescriptor releaseDescriptor = + ReleaseUtils.buildReleaseDescriptor( cleanRequest.getReleaseDescriptorBuilder() ); + + configStore.delete( releaseDescriptor ); + + Strategy releaseStrategy = getStrategy( releaseDescriptor.getReleaseStrategyId() ); + + Set phases = new LinkedHashSet<>(); + phases.addAll( getGoalPhases( releaseStrategy, "prepare" ) ); + phases.addAll( getGoalPhases( releaseStrategy, "branch" ) ); + + for ( String name : phases ) + { + ReleasePhase phase = releasePhases.get( name ); + + if ( phase instanceof ResourceGenerator ) + { + ( (ResourceGenerator) phase ).clean( cleanRequest.getReactorProjects() ); + } + } + + updateListener( cleanRequest.getReleaseManagerListener(), "cleanup", PHASE_END ); + } + + void setConfigStore( ReleaseDescriptorStore configStore ) + { + this.configStore = configStore; + } + + void goalStart( ReleaseManagerListener listener, String goal, List phases ) + { + if ( listener != null ) + { + listener.goalStart( goal, phases ); + } + } + + void updateListener( ReleaseManagerListener listener, String name, int state ) + { + if ( listener != null ) + { + switch ( state ) + { + case GOAL_END: + listener.goalEnd(); + break; + case PHASE_SKIP: + listener.phaseSkip( name ); + break; + case PHASE_START: + listener.phaseStart( name ); + break; + case PHASE_END: + listener.phaseEnd(); + break; + default: + listener.error( name ); + } + } + } + + private Strategy getStrategy( String strategyId ) throws ReleaseFailureException + { + Strategy strategy = strategies.get( strategyId ); + if ( strategy == null ) + { + throw new ReleaseFailureException( "Unknown strategy: " + strategyId ); + } + return strategy; + } + + private List getGoalPhases( Strategy strategy, String goal ) + { + List phases; + + if ( "prepare".equals( goal ) ) + { + phases = strategy.getPreparePhases(); + if ( phases == null ) + { + phases = strategies.get( "default" ).getPreparePhases(); + } + } + else if ( "perform".equals( goal ) ) + { + phases = strategy.getPerformPhases(); + if ( phases == null ) + { + phases = strategies.get( "default" ).getPerformPhases(); + } + } + else if ( "rollback".equals( goal ) ) + { + phases = strategy.getRollbackPhases(); + if ( phases == null ) + { + phases = strategies.get( "default" ).getRollbackPhases(); + } + } + else if ( "branch".equals( goal ) ) + { + phases = strategy.getBranchPhases(); + if ( phases == null ) + { + phases = strategies.get( "default" ).getBranchPhases(); + } + } + else if ( "updateVersions".equals( goal ) ) + { + phases = strategy.getUpdateVersionsPhases(); + if ( phases == null ) + { + phases = strategies.get( "default" ).getUpdateVersionsPhases(); + } + } + else + { + phases = null; + } + + return Collections.unmodifiableList( phases ); + } + + private void logInfo( ReleaseResult result, String message ) + { + if ( result != null ) + { + result.appendInfo( message ); + } + + getLogger().info( message ); + } + + private void captureException( ReleaseResult result, ReleaseManagerListener listener, Exception e ) + { + updateListener( listener, e.getMessage(), ERROR ); + + result.appendError( e ); + + result.setResultCode( ReleaseResult.ERROR ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManagerListener.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManagerListener.java new file mode 100644 index 000000000..b8bbb2315 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManagerListener.java @@ -0,0 +1,109 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.plugin.logging.Log; +import org.codehaus.plexus.util.StringUtils; + +import static org.apache.maven.shared.utils.logging.MessageUtils.buffer; + +/** + * @author Hervé Boutemy + */ +public class DefaultReleaseManagerListener + implements ReleaseManagerListener +{ + private final Log log; + + private final boolean dryRun; + + private String goal; + + private List phases; + + private int currentPhase; + + public DefaultReleaseManagerListener( Log log ) + { + this( log, false ); + } + + public DefaultReleaseManagerListener( Log log, boolean dryRun ) + { + this.log = log; + this.dryRun = dryRun; + } + + private void nextPhase( String name ) + { + currentPhase++; + if ( !name.equals( phases.get( currentPhase ) ) ) + { + log.warn( "inconsistent phase name: expected '" + phases.get( currentPhase ) + "' but got '" + name + "'" ); + } + } + + public void goalStart( String goal, List phases ) + { + log.info( "starting " + buffer().strong( goal ) + " goal" + ( dryRun ? " in dry-run mode" : "" ) + + ", composed of " + phases.size() + " phases: " + StringUtils.join( phases.iterator(), ", " ) ); + currentPhase = -1; + this.phases = phases; + this.goal = goal; + } + + public void phaseStart( String name ) + { + if ( goal == null || ( ( currentPhase + 1 ) >= phases.size() ) ) + { + // out of goal phase + log.info( "phase " + buffer().strong( name ) + ( dryRun ? " (dry-run)" : "" ) ); + return; + } + + nextPhase( name ); + log.info( buffer().strong( "[" + goal + ( dryRun ? " dry-run" : "" ) + "] " ).toString() + ( currentPhase + 1 ) + + "/" + phases.size() + " " + buffer().strong( name ) ); + } + + public void phaseEnd() + { + // NOOP + } + + public void phaseSkip( String name ) + { + nextPhase( name ); + } + + public void goalEnd() + { + goal = null; + phases = null; + } + + public void error( String reason ) + { + log.error( "error during phase " + ( currentPhase + 1 ) + "/" + phases.size() + " " + phases.get( currentPhase ) + + ": " + reason ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseBranchRequest.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseBranchRequest.java new file mode 100644 index 000000000..45b69c85e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseBranchRequest.java @@ -0,0 +1,80 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.shared.release.env.ReleaseEnvironment; + +/** + * + * @author Robert Scholte + * @since 2.3 + */ +public class ReleaseBranchRequest extends AbstractReleaseRequest +{ + // using Boolean to detect if has been set explicitly + private Boolean dryRun; + + private ReleaseEnvironment releaseEnvironment; + + private Properties userProperties; + + /** + * @return the dryRun + */ + public Boolean getDryRun() + { + return dryRun; + } + + /** + * @param dryRun the dryRun to set + */ + public void setDryRun( Boolean dryRun ) + { + this.dryRun = dryRun; + } + + /** + * @return the releaseEnvironment + */ + public ReleaseEnvironment getReleaseEnvironment() + { + return releaseEnvironment; + } + + /** + * @param releaseEnvironment the releaseEnvironment to set + */ + public void setReleaseEnvironment( ReleaseEnvironment releaseEnvironment ) + { + this.releaseEnvironment = releaseEnvironment; + } + + public Properties getUserProperties() + { + return userProperties; + } + + public void setUserProperties( Properties userProperties ) + { + this.userProperties = userProperties; + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseCleanRequest.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseCleanRequest.java new file mode 100644 index 000000000..a1a32d0df --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseCleanRequest.java @@ -0,0 +1,30 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 Robert Scholte + * @since 2.3 + */ +public class ReleaseCleanRequest + extends AbstractReleaseRequest +{ +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseManager.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseManager.java new file mode 100644 index 000000000..fdfb89ffe --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseManager.java @@ -0,0 +1,94 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Release management classes. + * + * @author Brett Porter + */ +public interface ReleaseManager +{ + /** + * Prepare a release. + * + * @param prepareRequest all prepare arguments + * @throws ReleaseExecutionException if there is a problem performing the release + * @throws ReleaseFailureException if there is a problem performing the release + * @since 2.3 + */ + void prepare( ReleasePrepareRequest prepareRequest ) throws ReleaseExecutionException, ReleaseFailureException; + + ReleaseResult prepareWithResult( ReleasePrepareRequest prepareRequest ); + + ReleaseResult performWithResult( ReleasePerformRequest performRequest ); + + /** + * Perform a release + * + * @param performRequest all perform arguments + * @throws ReleaseExecutionException if there is a problem performing the release + * @throws ReleaseFailureException if there is a problem performing the release + * @since 2.3 + */ + void perform( ReleasePerformRequest performRequest ) + throws ReleaseExecutionException, ReleaseFailureException; + + /** + * Clean a release. + * + * @param cleanRequest all clean arguments + * @throws ReleaseFailureException if exception when releasing + * @since 2.3 + */ + void clean( ReleaseCleanRequest cleanRequest ) throws ReleaseFailureException; + + /** + * Rollback changes made by the previous release + * + * @param rollbackRequest all rollback arguments + * @throws ReleaseExecutionException if there is a problem during release rollback + * @throws ReleaseFailureException if there is a problem during release rollback + * @since 2.3 + */ + void rollback( ReleaseRollbackRequest rollbackRequest ) + throws ReleaseExecutionException, ReleaseFailureException; + + /** + * Branch a project + * + * @param branchRequest all branch arguments + * @throws ReleaseExecutionException if there is a problem during release branch + * @throws ReleaseFailureException if there is a problem during release branch + * @since 2.3 + */ + void branch( ReleaseBranchRequest branchRequest ) throws ReleaseExecutionException, ReleaseFailureException; + + /** + * Update version numbers for a project + * + * @param updateVersionsRequest all update versions arguments + * @throws ReleaseExecutionException if there is a problem during update versions + * @throws ReleaseFailureException if there is a problem during update versions + * @since 2.3 + */ + void updateVersions( ReleaseUpdateVersionsRequest updateVersionsRequest ) + throws ReleaseExecutionException, ReleaseFailureException; +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseManagerListener.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseManagerListener.java new file mode 100644 index 000000000..755e3e7df --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseManagerListener.java @@ -0,0 +1,40 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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; + +/** + * @author Edwin Punzalan + */ +public interface ReleaseManagerListener +{ + void goalStart( String goal, List phases ); + + void phaseStart( String name ); + + void phaseEnd(); + + void phaseSkip( String name ); + + void goalEnd(); + + void error( String reason ); +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleasePerformRequest.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleasePerformRequest.java new file mode 100644 index 000000000..5a0f51631 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleasePerformRequest.java @@ -0,0 +1,87 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.env.ReleaseEnvironment; + +/** + * + * @author Robert Scholte + * @since 2.3 + */ +public class ReleasePerformRequest + extends AbstractReleaseRequest +{ + // using Boolean to detect if has been set explicitly + private Boolean dryRun; + + // using Boolean to detect if has been set explicitly + private Boolean clean; + + private ReleaseEnvironment releaseEnvironment; + + /** + * @return the dryRun + */ + public Boolean getDryRun() + { + return dryRun; + } + + /** + * @param dryRun the dryRun to set + */ + public void setDryRun( Boolean dryRun ) + { + this.dryRun = dryRun; + } + + /** + * @return the clean + */ + public Boolean getClean() + { + return clean; + } + + /** + * @param clean the clean to set + */ + public void setClean( Boolean clean ) + { + this.clean = clean; + } + + /** + * @return the releaseEnvironment + */ + public ReleaseEnvironment getReleaseEnvironment() + { + return releaseEnvironment; + } + + /** + * @param releaseEnvironment the releaseEnvironment to set + */ + public void setReleaseEnvironment( ReleaseEnvironment releaseEnvironment ) + { + this.releaseEnvironment = releaseEnvironment; + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleasePrepareRequest.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleasePrepareRequest.java new file mode 100644 index 000000000..7ac691559 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleasePrepareRequest.java @@ -0,0 +1,101 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.shared.release.env.ReleaseEnvironment; + +/** + * + * @author Robert Scholte + * @since 2.3 + */ +public class ReleasePrepareRequest + extends AbstractReleaseRequest +{ + // using Boolean to detect if has been set explicitly + private Boolean dryRun; + + // using Boolean to detect if has been set explicitly + private Boolean resume; + + private ReleaseEnvironment releaseEnvironment; + + private Properties userProperties; + + /** + * @return the dryRun + */ + public Boolean getDryRun() + { + return dryRun; + } + + /** + * @param dryRun the dryRun to set + */ + public void setDryRun( Boolean dryRun ) + { + this.dryRun = dryRun; + } + + /** + * @return the resume + */ + public Boolean getResume() + { + return resume; + } + + /** + * @param resume the resume to set + */ + public void setResume( Boolean resume ) + { + this.resume = resume; + } + + /** + * @return the releaseEnvironment + */ + public ReleaseEnvironment getReleaseEnvironment() + { + return releaseEnvironment; + } + + /** + * @param releaseEnvironment the releaseEnvironment to set + */ + public void setReleaseEnvironment( ReleaseEnvironment releaseEnvironment ) + { + this.releaseEnvironment = releaseEnvironment; + } + + public Properties getUserProperties() + { + return userProperties; + } + + public void setUserProperties( Properties userProperties ) + { + this.userProperties = userProperties; + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseRollbackRequest.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseRollbackRequest.java new file mode 100644 index 000000000..d91dd3a2c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseRollbackRequest.java @@ -0,0 +1,49 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.env.ReleaseEnvironment; + +/** + * + * @author Robert Scholte + * @since 2.3 + */ +public class ReleaseRollbackRequest + extends AbstractReleaseRequest +{ + private ReleaseEnvironment releaseEnvironment; + + /** + * @return the releaseEnvironment + */ + public ReleaseEnvironment getReleaseEnvironment() + { + return releaseEnvironment; + } + + /** + * @param releaseEnvironment the releaseEnvironment to set + */ + public void setReleaseEnvironment( ReleaseEnvironment releaseEnvironment ) + { + this.releaseEnvironment = releaseEnvironment; + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseUpdateVersionsRequest.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseUpdateVersionsRequest.java new file mode 100644 index 000000000..81c768c35 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/ReleaseUpdateVersionsRequest.java @@ -0,0 +1,63 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.shared.release.env.ReleaseEnvironment; + +/** + * + * @author Robert Scholte + * @since 2.3 + */ +public class ReleaseUpdateVersionsRequest + extends AbstractReleaseRequest +{ + private ReleaseEnvironment releaseEnvironment; + + private Properties userProperties; + + /** + * @return the releaseEnvironment + */ + public ReleaseEnvironment getReleaseEnvironment() + { + return releaseEnvironment; + } + + /** + * @param releaseEnvironment the releaseEnvironment to set + */ + public void setReleaseEnvironment( ReleaseEnvironment releaseEnvironment ) + { + this.releaseEnvironment = releaseEnvironment; + } + + public Properties getUserProperties() + { + return userProperties; + } + + public void setUserProperties( Properties userProperties ) + { + this.userProperties = userProperties; + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java new file mode 100644 index 000000000..a7506b8fa --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java @@ -0,0 +1,425 @@ +package org.apache.maven.shared.release.config; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Map; +import java.util.Properties; + +import org.apache.maven.model.Scm; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder.BuilderReleaseDescriptor; +import org.apache.maven.shared.release.scm.IdentifiedScm; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.logging.AbstractLogEnabled; +import org.codehaus.plexus.util.StringUtils; +import org.sonatype.plexus.components.cipher.DefaultPlexusCipher; +import org.sonatype.plexus.components.cipher.PlexusCipherException; +import org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher; +import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher; +import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; +import org.sonatype.plexus.components.sec.dispatcher.SecUtil; +import org.sonatype.plexus.components.sec.dispatcher.model.SettingsSecurity; + +/** + * Read and write release configuration and state from a properties file. + * + * @author Brett Porter + */ +@Component( role = ReleaseDescriptorStore.class, hint = "properties" ) +public class PropertiesReleaseDescriptorStore + extends AbstractLogEnabled + implements ReleaseDescriptorStore +{ + + /** + * When this plugin requires Maven 3.0 as minimum, this component can be removed and o.a.m.s.c.SettingsDecrypter be + * used instead. + */ + @Requirement( role = SecDispatcher.class, hint = "mng-4384" ) + private DefaultSecDispatcher secDispatcher; + + @Override + public ReleaseDescriptorBuilder read( ReleaseDescriptorBuilder mergeDescriptor ) + throws ReleaseDescriptorStoreException + { + return read( mergeDescriptor, getDefaultReleasePropertiesFile( mergeDescriptor.build() ) ); + } + + public ReleaseDescriptorBuilder read( File file ) + throws ReleaseDescriptorStoreException + { + return read( null, file ); + } + + public ReleaseDescriptorBuilder read( ReleaseDescriptorBuilder mergeDescriptor, File file ) + throws ReleaseDescriptorStoreException + { + Properties properties = new Properties(); + + try ( InputStream inStream = new FileInputStream( file ) ) + { + properties.load( inStream ); + } + catch ( FileNotFoundException e ) + { + getLogger().debug( file.getName() + " not found - using empty properties" ); + } + catch ( IOException e ) + { + throw new ReleaseDescriptorStoreException( + "Error reading properties file '" + file.getName() + "': " + e.getMessage(), e ); + } + + try + { + decryptProperties( properties ); + } + catch ( IllegalStateException | SecDispatcherException | PlexusCipherException e ) + { + getLogger().debug( e.getMessage() ); + } + + ReleaseDescriptorBuilder builder; + if ( mergeDescriptor != null ) + { + builder = mergeDescriptor; + } + else + { + builder = new ReleaseDescriptorBuilder(); + } + + ReleaseUtils.copyPropertiesToReleaseDescriptor( properties, builder ); + + return builder; + } + + @Override + public void write( ReleaseDescriptor config ) + throws ReleaseDescriptorStoreException + { + write( (BuilderReleaseDescriptor) config, getDefaultReleasePropertiesFile( config ) ); + } + + @Override + public void delete( ReleaseDescriptor config ) + { + File file = getDefaultReleasePropertiesFile( config ); + if ( file.exists() ) + { + file.delete(); + } + } + + public void write( BuilderReleaseDescriptor config, File file ) + throws ReleaseDescriptorStoreException + { + Properties properties = new Properties(); + properties.setProperty( "completedPhase", config.getCompletedPhase() ); + if ( config.isCommitByProject() ) //default is false + { + properties.setProperty( "commitByProject", "true" ); + } + properties.setProperty( "scm.url", config.getScmSourceUrl() ); + if ( config.getScmId() != null ) + { + properties.setProperty( "scm.id", config.getScmId() ); + } + if ( config.getScmUsername() != null ) + { + properties.setProperty( "scm.username", config.getScmUsername() ); + } + if ( config.getScmPassword() != null ) + { + String password = config.getScmPassword(); + try + { + password = encryptAndDecorate( password ); + } + catch ( IllegalStateException | SecDispatcherException | PlexusCipherException e ) + { + getLogger().debug( e.getMessage() ); + } + properties.setProperty( "scm.password", password ); + } + if ( config.getScmPrivateKey() != null ) + { + properties.setProperty( "scm.privateKey", config.getScmPrivateKey() ); + } + if ( config.getScmPrivateKeyPassPhrase() != null ) + { + String passPhrase = config.getScmPrivateKeyPassPhrase(); + try + { + passPhrase = encryptAndDecorate( passPhrase ); + } + catch ( IllegalStateException | SecDispatcherException | PlexusCipherException e ) + { + getLogger().debug( e.getMessage() ); + } + properties.setProperty( "scm.passphrase", passPhrase ); + } + if ( config.getScmTagBase() != null ) + { + properties.setProperty( "scm.tagBase", config.getScmTagBase() ); + } + if ( config.getScmBranchBase() != null ) + { + properties.setProperty( "scm.branchBase", config.getScmBranchBase() ); + } + if ( config.getScmReleaseLabel() != null ) + { + properties.setProperty( "scm.tag", config.getScmReleaseLabel() ); + } + if ( config.getScmTagNameFormat() != null ) + { + properties.setProperty( "scm.tagNameFormat", config.getScmTagNameFormat() ); + } + if ( config.getScmCommentPrefix() != null ) + { + properties.setProperty( "scm.commentPrefix", config.getScmCommentPrefix() ); + } + if ( config.getScmDevelopmentCommitComment() != null ) + { + properties.setProperty( "scm.developmentCommitComment", config.getScmDevelopmentCommitComment() ); + } + if ( config.getScmReleaseCommitComment() != null ) + { + properties.setProperty( "scm.releaseCommitComment", config.getScmReleaseCommitComment() ); + } + if ( config.getScmBranchCommitComment() != null ) + { + properties.setProperty( "scm.branchCommitComment", config.getScmBranchCommitComment() ); + } + if ( config.getScmRollbackCommitComment() != null ) + { + properties.setProperty( "scm.rollbackCommitComment", config.getScmRollbackCommitComment() ); + } + if ( config.getAdditionalArguments() != null ) + { + properties.setProperty( "exec.additionalArguments", config.getAdditionalArguments() ); + } + if ( config.getPomFileName() != null ) + { + properties.setProperty( "exec.pomFileName", config.getPomFileName() ); + } + if ( !config.getActivateProfiles().isEmpty() ) + { + properties.setProperty( "exec.activateProfiles", + StringUtils.join( config.getActivateProfiles().iterator(), "," ) ); + } + if ( config.getPreparationGoals() != null ) + { + properties.setProperty( "preparationGoals", config.getPreparationGoals() ); + } + if ( config.getCompletionGoals() != null ) + { + properties.setProperty( "completionGoals", config.getCompletionGoals() ); + } + if ( config.getProjectVersionPolicyId() != null ) + { + properties.setProperty( "projectVersionPolicyId", config.getProjectVersionPolicyId() ); + } + if ( config.getProjectNamingPolicyId() != null ) + { + properties.setProperty( "projectNamingPolicyId", config.getProjectNamingPolicyId() ); + } + if ( config.getReleaseStrategyId() != null ) + { + properties.setProperty( "releaseStrategyId", config.getReleaseStrategyId() ); + } + + properties.setProperty( "exec.snapshotReleasePluginAllowed", + Boolean.toString( config.isSnapshotReleasePluginAllowed() ) ); + + properties.setProperty( "remoteTagging", Boolean.toString( config.isRemoteTagging() ) ); + + properties.setProperty( "pinExternals", Boolean.toString( config.isPinExternals() ) ); + + properties.setProperty( "pushChanges", Boolean.toString( config.isPushChanges() ) ); + + if ( config.getWorkItem() != null ) + { + properties.setProperty( "workItem", config.getWorkItem() ); + } + + if ( config.getAutoResolveSnapshots() != null ) + { + properties.setProperty( "autoResolveSnapshots", config.getAutoResolveSnapshots() ); + } + + // others boolean properties are not written to the properties file because the value from the caller is always + // used + + + for ( Map.Entry entry : config.getProjectVersions().entrySet() ) + { + if ( entry.getValue().getRelease() != null ) + { + properties.setProperty( "project.rel." + entry.getKey(), entry.getValue().getRelease() ); + } + if ( entry.getValue().getDevelopment() != null ) + { + properties.setProperty( "project.dev." + entry.getKey(), entry.getValue().getDevelopment() ); + } + } + + for ( Map.Entry entry : config.getOriginalScmInfo().entrySet() ) + { + Scm scm = entry.getValue(); + String prefix = "project.scm." + entry.getKey(); + if ( scm != null ) + { + if ( scm.getConnection() != null ) + { + properties.setProperty( prefix + ".connection", scm.getConnection() ); + } + if ( scm.getDeveloperConnection() != null ) + { + properties.setProperty( prefix + ".developerConnection", scm.getDeveloperConnection() ); + } + if ( scm.getUrl() != null ) + { + properties.setProperty( prefix + ".url", scm.getUrl() ); + } + if ( scm.getTag() != null ) + { + properties.setProperty( prefix + ".tag", scm.getTag() ); + } + if ( scm instanceof IdentifiedScm ) + { + IdentifiedScm identifiedScm = (IdentifiedScm) scm; + if ( identifiedScm.getId() != null ) + { + properties.setProperty( prefix + ".id", identifiedScm.getId() ); + } + } + } + else + { + properties.setProperty( prefix + ".empty", "true" ); + } + } + + if ( ( config.getResolvedSnapshotDependencies() != null ) + && ( config.getResolvedSnapshotDependencies().size() > 0 ) ) + { + processResolvedDependencies( properties, config.getResolvedSnapshotDependencies() ); + } + + try ( OutputStream outStream = new FileOutputStream( file ) ) + { + properties.store( outStream, "release configuration" ); + } + catch ( IOException e ) + { + throw new ReleaseDescriptorStoreException( + "Error writing properties file '" + file.getName() + "': " + e.getMessage(), e ); + } + } + + private void processResolvedDependencies( Properties prop, Map resolvedDependencies ) + { + for ( Map.Entry currentEntry : resolvedDependencies.entrySet() ) + { + ReleaseStageVersions versionMap = currentEntry.getValue(); + + prop.setProperty( "dependency." + currentEntry.getKey() + ".release", + versionMap.getRelease() ); + prop.setProperty( "dependency." + currentEntry.getKey() + ".development", + versionMap.getDevelopment() ); + } + } + + private static File getDefaultReleasePropertiesFile( ReleaseDescriptor mergeDescriptor ) + { + return new File( mergeDescriptor.getWorkingDirectory(), "release.properties" ); + } + + private void decryptProperties( Properties properties ) + throws IllegalStateException, SecDispatcherException, PlexusCipherException + { + String[] keys = new String[] { "scm.password", "scm.passphrase" }; + + for ( String key : keys ) + { + String value = properties.getProperty( key ); + if ( value != null ) + { + properties.put( key, decrypt( value ) ); + } + } + } + + // From org.apache.maven.cli.MavenCli.encryption(CliRequest) + private String encryptAndDecorate( String passwd ) + throws IllegalStateException, SecDispatcherException, PlexusCipherException + { + final String master = getMaster(); + + DefaultPlexusCipher cipher = new DefaultPlexusCipher(); + String masterPasswd = cipher.decryptDecorated( master, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ); + return cipher.encryptAndDecorate( passwd, masterPasswd ); + } + + private String decrypt( String value ) throws IllegalStateException, SecDispatcherException, PlexusCipherException + { + final String master = getMaster(); + + DefaultPlexusCipher cipher = new DefaultPlexusCipher(); + String masterPasswd = cipher.decryptDecorated( master, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ); + return cipher.decryptDecorated( value, masterPasswd ); + } + + private String getMaster() throws SecDispatcherException + { + String configurationFile = secDispatcher.getConfigurationFile(); + + if ( configurationFile.startsWith( "~" ) ) + { + configurationFile = System.getProperty( "user.home" ) + configurationFile.substring( 1 ); + } + + String file = System.getProperty( DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION, configurationFile ); + + String master = null; + + SettingsSecurity sec = SecUtil.read( file, true ); + if ( sec != null ) + { + master = sec.getMaster(); + } + + if ( master == null ) + { + throw new IllegalStateException( "Master password is not set in the setting security file: " + file ); + } + + return master; + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorBuilder.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorBuilder.java new file mode 100644 index 000000000..7ff677ae8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorBuilder.java @@ -0,0 +1,459 @@ +package org.apache.maven.shared.release.config; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.model.Scm; + +/** + * + * @author Robert Scholte + * @since 3.0.0 + */ +public class ReleaseDescriptorBuilder +{ + /** + * Hides inner logic of the release descriptor + * + * @author Robert Scholte + * + */ + public static final class BuilderReleaseDescriptor extends ModelloReleaseDescriptor implements ReleaseDescriptor + { + private BuilderReleaseDescriptor() + { + } + } + + private final BuilderReleaseDescriptor releaseDescriptor; + + public ReleaseDescriptorBuilder() + { + this.releaseDescriptor = new BuilderReleaseDescriptor(); + } + + public ReleaseDescriptorBuilder addCheckModificationExclude( String string ) + { + releaseDescriptor.addCheckModificationExclude( string ); + return this; + } + + public ReleaseDescriptorBuilder setActivateProfiles( List profiles ) + { + releaseDescriptor.setActivateProfiles( profiles ); + return this; + } + + public ReleaseDescriptorBuilder setAddSchema( boolean addSchema ) + { + releaseDescriptor.setAddSchema( addSchema ); + return this; + } + + public ReleaseDescriptorBuilder setAdditionalArguments( String additionalArguments ) + { + releaseDescriptor.setAdditionalArguments( additionalArguments ); + return this; + } + + public ReleaseDescriptorBuilder setAllowTimestampedSnapshots( boolean allowTimestampedSnapshots ) + { + releaseDescriptor.setAllowTimestampedSnapshots( allowTimestampedSnapshots ); + return this; + } + + public ReleaseDescriptorBuilder setAutoVersionSubmodules( boolean autoVersionSubmodules ) + { + releaseDescriptor.setAutoVersionSubmodules( autoVersionSubmodules ); + return this; + } + + public ReleaseDescriptorBuilder setBranchCreation( boolean branchCreation ) + { + releaseDescriptor.setBranchCreation( branchCreation ); + return this; + } + + public ReleaseDescriptorBuilder setCheckModificationExcludes( List checkModificationExcludes ) + { + releaseDescriptor.setCheckModificationExcludes( checkModificationExcludes ); + return this; + } + + public ReleaseDescriptorBuilder setCheckoutDirectory( String checkoutDirectory ) + { + releaseDescriptor.setCheckoutDirectory( checkoutDirectory ); + return this; + } + + public ReleaseDescriptorBuilder setCommitByProject( boolean commitByProject ) + { + releaseDescriptor.setCommitByProject( commitByProject ); + return this; + } + + public ReleaseDescriptorBuilder setCompletedPhase( String completedPhase ) + { + releaseDescriptor.setCompletedPhase( completedPhase ); + return this; + } + + public ReleaseDescriptorBuilder setCompletionGoals( String completionGoals ) + { + releaseDescriptor.setCompletionGoals( completionGoals ); + return this; + } + + public ReleaseDescriptorBuilder setDefaultDevelopmentVersion( String defaultDevelopmentVersion ) + { + releaseDescriptor.setDefaultDevelopmentVersion( defaultDevelopmentVersion ); + return this; + } + + public ReleaseDescriptorBuilder setDefaultReleaseVersion( String defaultReleaseVersion ) + { + releaseDescriptor.setDefaultReleaseVersion( defaultReleaseVersion ); + return this; + } + + public ReleaseDescriptorBuilder setDescription( String description ) + { + releaseDescriptor.setDescription( description ); + return this; + } + + public ReleaseDescriptorBuilder setGenerateReleasePoms( boolean generateReleasePoms ) + { + releaseDescriptor.setGenerateReleasePoms( generateReleasePoms ); + return this; + } + + public ReleaseDescriptorBuilder setInteractive( boolean interactive ) + { + releaseDescriptor.setInteractive( interactive ); + return this; + } + + public ReleaseDescriptorBuilder setLocalCheckout( boolean localCheckout ) + { + releaseDescriptor.setLocalCheckout( localCheckout ); + return this; + } + + public ReleaseDescriptorBuilder setModelEncoding( String modelEncoding ) + { + releaseDescriptor.setModelEncoding( modelEncoding ); + return this; + } + + public ReleaseDescriptorBuilder setName( String name ) + { + releaseDescriptor.setName( name ); + return this; + } + + public ReleaseDescriptorBuilder setPerformGoals( String performGoals ) + { + releaseDescriptor.setPerformGoals( performGoals ); + return this; + } + + public ReleaseDescriptorBuilder setPomFileName( String pomFileName ) + { + releaseDescriptor.setPomFileName( pomFileName ); + return this; + } + + public ReleaseDescriptorBuilder setPreparationGoals( String preparationGoals ) + { + releaseDescriptor.setPreparationGoals( preparationGoals ); + return this; + } + + public ReleaseDescriptorBuilder setProjectNamingPolicyId( String projectNamingPolicyId ) + { + releaseDescriptor.setProjectNamingPolicyId( projectNamingPolicyId ); + return this; + } + + public ReleaseDescriptorBuilder setProjectVersionPolicyId( String projectVersionPolicyId ) + { + releaseDescriptor.setProjectVersionPolicyId( projectVersionPolicyId ); + return this; + } + + public ReleaseDescriptorBuilder setPushChanges( boolean pushChanges ) + { + releaseDescriptor.setPushChanges( pushChanges ); + return this; + } + + public ReleaseDescriptorBuilder setWorkItem( String workItem ) + { + releaseDescriptor.setWorkItem( workItem ); + return this; + } + + public ReleaseDescriptorBuilder setReleaseStrategyId( String releaseStrategyId ) + { + releaseDescriptor.setReleaseStrategyId( releaseStrategyId ); + return this; + } + + public ReleaseDescriptorBuilder setRemoteTagging( boolean remoteTagging ) + { + releaseDescriptor.setRemoteTagging( remoteTagging ); + return this; + } + + public ReleaseDescriptorBuilder setScmBranchBase( String scmBranchBase ) + { + releaseDescriptor.setScmBranchBase( scmBranchBase ); + return this; + } + + public ReleaseDescriptorBuilder setScmCommentPrefix( String scmCommentPrefix ) + { + releaseDescriptor.setScmCommentPrefix( scmCommentPrefix ); + return this; + } + + /** + * @since 3.0.0-M1 + */ + public ReleaseDescriptorBuilder setScmReleaseCommitComment( String scmReleaseCommitComment ) + { + releaseDescriptor.setScmReleaseCommitComment( scmReleaseCommitComment ); + return this; + } + + /** + * @since 3.0.0-M1 + */ + public ReleaseDescriptorBuilder setScmDevelopmentCommitComment( String scmDevelopmentCommitComment ) + { + releaseDescriptor.setScmDevelopmentCommitComment( scmDevelopmentCommitComment ); + return this; + } + + /** + * @since 3.0.0-M1 + */ + public ReleaseDescriptorBuilder setScmBranchCommitComment( String scmBranchCommitComment ) + { + releaseDescriptor.setScmBranchCommitComment( scmBranchCommitComment ); + return this; + } + + /** + * @since 3.0.0-M1 + */ + public ReleaseDescriptorBuilder setScmRollbackCommitComment( String scmRollbackCommitComment ) + { + releaseDescriptor.setScmRollbackCommitComment( scmRollbackCommitComment ); + return this; + } + + public ReleaseDescriptorBuilder setScmId( String scmId ) + { + releaseDescriptor.setScmId( scmId ); + return this; + } + + public ReleaseDescriptorBuilder setScmPassword( String scmPassword ) + { + releaseDescriptor.setScmPassword( scmPassword ); + return this; + } + + public ReleaseDescriptorBuilder setScmPrivateKey( String scmPrivateKey ) + { + releaseDescriptor.setScmPrivateKey( scmPrivateKey ); + return this; + } + + public ReleaseDescriptorBuilder setScmPrivateKeyPassPhrase( String scmPrivateKeyPassPhrase ) + { + releaseDescriptor.setScmPrivateKeyPassPhrase( scmPrivateKeyPassPhrase ); + return this; + } + + public ReleaseDescriptorBuilder setScmRelativePathProjectDirectory( String scmRelativePathProjectDirectory ) + { + releaseDescriptor.setScmRelativePathProjectDirectory( scmRelativePathProjectDirectory ); + return this; + } + + public ReleaseDescriptorBuilder setScmReleaseLabel( String scmReleaseLabel ) + { + releaseDescriptor.setScmReleaseLabel( scmReleaseLabel ); + return this; + } + + public ReleaseDescriptorBuilder setScmReleasedPomRevision( String scmReleasedPomRevision ) + { + releaseDescriptor.setScmReleasedPomRevision( scmReleasedPomRevision ); + return this; + } + + public ReleaseDescriptorBuilder setScmSourceUrl( String scmSourceUrl ) + { + releaseDescriptor.setScmSourceUrl( scmSourceUrl ); + return this; + } + + public ReleaseDescriptorBuilder setScmTagBase( String scmTagBase ) + { + releaseDescriptor.setScmTagBase( scmTagBase ); + return this; + } + + public ReleaseDescriptorBuilder setScmTagNameFormat( String scmTagNameFormat ) + { + releaseDescriptor.setScmTagNameFormat( scmTagNameFormat ); + return this; + } + + public ReleaseDescriptorBuilder setScmUseEditMode( boolean scmUseEditMode ) + { + releaseDescriptor.setScmUseEditMode( scmUseEditMode ); + return this; + } + + public ReleaseDescriptorBuilder setScmUsername( String scmUsername ) + { + releaseDescriptor.setScmUsername( scmUsername ); + return this; + } + + public ReleaseDescriptorBuilder setSnapshotReleasePluginAllowed( boolean snapshotReleasePluginAllowed ) + { + releaseDescriptor.setSnapshotReleasePluginAllowed( snapshotReleasePluginAllowed ); + return this; + } + + public ReleaseDescriptorBuilder setSuppressCommitBeforeTagOrBranch( boolean suppressCommitBeforeTagOrBranch ) + { + releaseDescriptor.setSuppressCommitBeforeTagOrBranch( suppressCommitBeforeTagOrBranch ); + return this; + } + + public ReleaseDescriptorBuilder setUpdateBranchVersions( boolean updateBranchVersions ) + { + releaseDescriptor.setUpdateBranchVersions( updateBranchVersions ); + return this; + } + + public ReleaseDescriptorBuilder setUpdateDependencies( boolean updateDependencies ) + { + releaseDescriptor.setUpdateDependencies( updateDependencies ); + return this; + } + + public ReleaseDescriptorBuilder setUpdateVersionsToSnapshot( boolean updateVersionsToSnapshot ) + { + releaseDescriptor.setUpdateVersionsToSnapshot( updateVersionsToSnapshot ); + return this; + } + + public ReleaseDescriptorBuilder setUpdateWorkingCopyVersions( boolean updateWorkingCopyVersions ) + { + releaseDescriptor.setUpdateWorkingCopyVersions( updateWorkingCopyVersions ); + return this; + } + + public ReleaseDescriptorBuilder setUseReleaseProfile( boolean useReleaseProfile ) + { + releaseDescriptor.setUseReleaseProfile( useReleaseProfile ); + return this; + } + + public ReleaseDescriptorBuilder setWaitBeforeTagging( int waitBeforeTagging ) + { + releaseDescriptor.setWaitBeforeTagging( waitBeforeTagging ); + return this; + } + + public ReleaseDescriptorBuilder setWorkingDirectory( String workingDirectory ) + { + releaseDescriptor.setWorkingDirectory( workingDirectory ); + return this; + } + + public ReleaseDescriptorBuilder addReleaseVersion( String key, String value ) + { + releaseDescriptor.addReleaseVersion( key, value ); + return this; + } + + public ReleaseDescriptorBuilder addDevelopmentVersion( String key, String value ) + { + releaseDescriptor.addDevelopmentVersion( key, value ); + return this; + } + + public ReleaseDescriptorBuilder addOriginalScmInfo( String key, Scm value ) + { + releaseDescriptor.addOriginalScmInfo( key, value ); + return this; + } + + public void putOriginalVersion( String projectKey, String version ) + { + releaseDescriptor.addOriginalVersion( projectKey, version ); + } + + public ReleaseDescriptorBuilder addDependencyOriginalVersion( String dependencyKey, String version ) + { + releaseDescriptor.addDependencyOriginalVersion( dependencyKey, version ); + return this; + + } + + public ReleaseDescriptorBuilder addDependencyReleaseVersion( String dependencyKey, String version ) + { + releaseDescriptor.addDependencyReleaseVersion( dependencyKey, version ); + return this; + } + + public ReleaseDescriptorBuilder addDependencyDevelopmentVersion( String dependencyKey, String version ) + { + releaseDescriptor.addDependencyDevelopmentVersion( dependencyKey, version ); + return this; + } + + public ReleaseDescriptorBuilder setAutoResolveSnapshots( String autoResolveSnapshots ) + { + releaseDescriptor.setAutoResolveSnapshots( autoResolveSnapshots ); + return this; + } + + public ReleaseDescriptorBuilder setPinExternals( boolean pinExternals ) + { + releaseDescriptor.setPinExternals( pinExternals ); + return this; + } + + BuilderReleaseDescriptor build() + { + return releaseDescriptor; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorStore.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorStore.java new file mode 100644 index 000000000..69092c174 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorStore.java @@ -0,0 +1,53 @@ +package org.apache.maven.shared.release.config; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Storage for reading and writing release configuration. + * + * @author Brett Porter + */ +public interface ReleaseDescriptorStore +{ + /** + * Read a configuration. + * + * @param mergeDescriptor configuration to merge with the loaded configuration. Some values are used as defaults, + * while others are used to override + * @return the configuration + */ + ReleaseDescriptorBuilder read( ReleaseDescriptorBuilder mergeDescriptor ) + throws ReleaseDescriptorStoreException; + + /** + * Save a configuration. + * + * @param config the configuration + */ + void write( ReleaseDescriptor config ) + throws ReleaseDescriptorStoreException; + + /** + * Remove a configuration. + * + * @param config the location of the configuration + */ + void delete( ReleaseDescriptor config ); +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorStoreException.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorStoreException.java new file mode 100644 index 000000000..443da6c45 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorStoreException.java @@ -0,0 +1,34 @@ +package org.apache.maven.shared.release.config; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Exception occurring within the configuration store. + * + * @author Brett Porter + */ +public class ReleaseDescriptorStoreException + extends Exception +{ + public ReleaseDescriptorStoreException( String message, Throwable t ) + { + super( message, t ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java new file mode 100644 index 000000000..ed31afe1a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java @@ -0,0 +1,292 @@ +package org.apache.maven.shared.release.config; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.Iterator; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.Set; + +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder.BuilderReleaseDescriptor; +import org.apache.maven.shared.release.scm.IdentifiedScm; + +/** + * Class providing utility methods used during the release process + * + * @author Jeremy Whitlock + */ +public class ReleaseUtils +{ + private static final String DEVELOPMENT_KEY = "dev"; + + private static final String RELEASE_KEY = "rel"; + + private ReleaseUtils() + { + // nothing to see here + } + + public static BuilderReleaseDescriptor buildReleaseDescriptor( ReleaseDescriptorBuilder builder ) + { + return builder.build(); + } + + public static void copyPropertiesToReleaseDescriptor( Properties properties, ReleaseDescriptorBuilder builder ) + { + if ( properties.containsKey( "completedPhase" ) ) + { + builder.setCompletedPhase( properties.getProperty( "completedPhase" ) ); + } + if ( properties.containsKey( "commitByProject" ) ) + { + builder.setCommitByProject( Boolean.parseBoolean( properties.getProperty( "commitByProject" ) ) ); + } + if ( properties.containsKey( "scm.id" ) ) + { + builder.setScmId( properties.getProperty( "scm.id" ) ); + } + if ( properties.containsKey( "scm.url" ) ) + { + builder.setScmSourceUrl( properties.getProperty( "scm.url" ) ); + } + if ( properties.containsKey( "scm.username" ) ) + { + builder.setScmUsername( properties.getProperty( "scm.username" ) ); + } + if ( properties.containsKey( "scm.password" ) ) + { + builder.setScmPassword( properties.getProperty( "scm.password" ) ); + } + if ( properties.containsKey( "scm.privateKey" ) ) + { + builder.setScmPrivateKey( properties.getProperty( "scm.privateKey" ) ); + } + if ( properties.containsKey( "scm.passphrase" ) ) + { + builder.setScmPrivateKeyPassPhrase( properties.getProperty( "scm.passphrase" ) ); + } + if ( properties.containsKey( "scm.tagBase" ) ) + { + builder.setScmTagBase( properties.getProperty( "scm.tagBase" ) ); + } + if ( properties.containsKey( "scm.tagNameFormat" ) ) + { + builder.setScmTagNameFormat( properties.getProperty( "scm.tagNameFormat" ) ); + } + if ( properties.containsKey( "scm.branchBase" ) ) + { + builder.setScmBranchBase( properties.getProperty( "scm.branchBase" ) ); + } + if ( properties.containsKey( "scm.tag" ) ) + { + builder.setScmReleaseLabel( properties.getProperty( "scm.tag" ) ); + } + if ( properties.containsKey( "scm.commentPrefix" ) ) + { + builder.setScmCommentPrefix( properties.getProperty( "scm.commentPrefix" ) ); + } + if ( properties.containsKey( "scm.developmentCommitComment" ) ) + { + builder.setScmDevelopmentCommitComment( properties.getProperty( "scm.developmentCommitComment" ) ); + } + if ( properties.containsKey( "scm.releaseCommitComment" ) ) + { + builder.setScmReleaseCommitComment( properties.getProperty( "scm.releaseCommitComment" ) ); + } + if ( properties.containsKey( "scm.branchCommitComment" ) ) + { + builder.setScmBranchCommitComment( properties.getProperty( "scm.branchCommitComment" ) ); + } + if ( properties.containsKey( "scm.rollbackCommitComment" ) ) + { + builder.setScmRollbackCommitComment( properties.getProperty( "scm.rollbackCommitComment" ) ); + } + if ( properties.containsKey( "exec.additionalArguments" ) ) + { + builder.setAdditionalArguments( properties.getProperty( "exec.additionalArguments" ) ); + } + if ( properties.containsKey( "exec.pomFileName" ) ) + { + builder.setPomFileName( properties.getProperty( "exec.pomFileName" ) ); + } + if ( properties.containsKey( "exec.activateProfiles" ) ) + { + builder.setActivateProfiles( + Arrays.asList( properties.getProperty( "exec.activateProfiles" ).split( "," ) ) ); + } + if ( properties.containsKey( "preparationGoals" ) ) + { + builder.setPreparationGoals( properties.getProperty( "preparationGoals" ) ); + } + if ( properties.containsKey( "completionGoals" ) ) + { + builder.setCompletionGoals( properties.getProperty( "completionGoals" ) ); + } + if ( properties.containsKey( "projectVersionPolicyId" ) ) + { + builder.setProjectVersionPolicyId( properties.getProperty( "projectVersionPolicyId" ) ); + } + if ( properties.containsKey( "projectNamingPolicyId" ) ) + { + builder.setProjectNamingPolicyId( properties.getProperty( "projectNamingPolicyId" ) ); + } + if ( properties.containsKey( "releaseStrategyId" ) ) + { + builder.setReleaseStrategyId( properties.getProperty( "releaseStrategyId" ) ); + } + if ( properties.containsKey( "exec.snapshotReleasePluginAllowed" ) ) + { + String snapshotReleasePluginAllowedStr = properties.getProperty( "exec.snapshotReleasePluginAllowed" ); + builder.setSnapshotReleasePluginAllowed( Boolean.valueOf( snapshotReleasePluginAllowedStr ) ); + } + if ( properties.containsKey( "remoteTagging" ) ) + { + String remoteTaggingStr = properties.getProperty( "remoteTagging" ); + builder.setRemoteTagging( Boolean.valueOf( remoteTaggingStr ) ); + } + if ( properties.containsKey( "pinExternals" ) ) + { + String pinExternals = properties.getProperty( "pinExternals" ); + builder.setPinExternals( Boolean.valueOf( pinExternals ) ); + } + if ( properties.containsKey( "pushChanges" ) ) + { + String pushChanges = properties.getProperty( "pushChanges" ); + builder.setPushChanges( Boolean.valueOf( pushChanges ) ); + } + if ( properties.containsKey( "workItem" ) ) + { + builder.setWorkItem( properties.getProperty( "workItem" ) ); + } + if ( properties.containsKey( "autoResolveSnapshots" ) ) + { + String resolve = properties.getProperty( "autoResolveSnapshots" ); + builder.setAutoResolveSnapshots( resolve ); + } + + loadResolvedDependencies( properties, builder ); + + // boolean properties are not written to the properties file because the value from the caller is always used + + for ( Iterator i = properties.keySet().iterator(); i.hasNext(); ) + { + String property = (String) i.next(); + if ( property.startsWith( "project.rel." ) ) + { + builder.addReleaseVersion( property.substring( "project.rel.".length() ), + properties.getProperty( property ) ); + } + else if ( property.startsWith( "project.dev." ) ) + { + builder.addDevelopmentVersion( property.substring( "project.dev.".length() ), + properties.getProperty( property ) ); + } + else if ( property.startsWith( "dependency.rel." ) ) + { + builder.addDependencyReleaseVersion( property.substring( "dependency.rel.".length() ), + properties.getProperty( property ) ); + } + else if ( property.startsWith( "dependency.dev." ) ) + { + builder.addDependencyDevelopmentVersion( property.substring( "dependency.dev.".length() ), + properties.getProperty( property ) ); + } + else if ( property.startsWith( "project.scm." ) ) + { + int index = property.lastIndexOf( '.' ); + if ( index > "project.scm.".length() ) + { + String key = property.substring( "project.scm.".length(), index ); + + if ( builder.build().getOriginalScmInfo( key ) == null ) + { + if ( properties.getProperty( "project.scm." + key + ".empty" ) != null ) + { + builder.addOriginalScmInfo( key, null ); + } + else + { + IdentifiedScm scm = new IdentifiedScm(); + scm.setConnection( properties.getProperty( "project.scm." + key + ".connection" ) ); + scm.setDeveloperConnection( + properties.getProperty( "project.scm." + key + ".developerConnection" ) ); + scm.setUrl( properties.getProperty( "project.scm." + key + ".url" ) ); + scm.setTag( properties.getProperty( "project.scm." + key + ".tag" ) ); + scm.setId( properties.getProperty( "project.scm." + key + ".id" ) ); + + builder.addOriginalScmInfo( key, scm ); + } + } + } + } + } + } + + private static void loadResolvedDependencies( Properties prop, ReleaseDescriptorBuilder builder ) + { + Set entries = prop.entrySet(); + Iterator> iterator = entries.iterator(); + String propertyName; + Entry currentEntry; + + while ( iterator.hasNext() ) + { + currentEntry = iterator.next(); + propertyName = currentEntry.getKey(); + + if ( propertyName.startsWith( "dependency." ) ) + { + String artifactVersionlessKey; + int startIndex = "dependency.".length(); + int endIndex; + String versionType; + + if ( propertyName.indexOf( ".development" ) != -1 ) + { + endIndex = propertyName.lastIndexOf( ".development" ); + versionType = DEVELOPMENT_KEY; + } + else if ( propertyName.indexOf( ".release" ) != -1 ) + { + endIndex = propertyName.lastIndexOf( ".release" ); + versionType = RELEASE_KEY; + } + else + { + // MRELEASE-834, probably a maven-dependency-plugin property + continue; + } + + artifactVersionlessKey = propertyName.substring( startIndex, endIndex ); + + if ( RELEASE_KEY.equals( versionType ) ) + { + builder.addDependencyReleaseVersion( artifactVersionlessKey, currentEntry.getValue() ); + } + else if ( DEVELOPMENT_KEY.equals( versionType ) ) + { + builder.addDependencyDevelopmentVersion( artifactVersionlessKey, currentEntry.getValue() ); + } + } + } + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/env/DefaultReleaseEnvironment.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/env/DefaultReleaseEnvironment.java new file mode 100644 index 000000000..3305756f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/env/DefaultReleaseEnvironment.java @@ -0,0 +1,124 @@ +package org.apache.maven.shared.release.env; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.Locale; + +import org.apache.maven.settings.Settings; + +/** + * + */ +public class DefaultReleaseEnvironment + implements ReleaseEnvironment +{ + + private File mavenHome; + + private File javaHome; + + private File localRepositoryDirectory; + + private Settings settings; + + private String mavenExecutorId = DEFAULT_MAVEN_EXECUTOR_ID; + + private Locale locale = Locale.ENGLISH; + + @Override + public File getMavenHome() + { + return mavenHome; + } + + @Override + public Settings getSettings() + { + return settings; + } + + public DefaultReleaseEnvironment setMavenHome( File mavenHome ) + { + this.mavenHome = mavenHome; + return this; + } + + public DefaultReleaseEnvironment setSettings( Settings settings ) + { + this.settings = settings; + return this; + } + + @Override + public String getMavenExecutorId() + { + return mavenExecutorId; + } + + public DefaultReleaseEnvironment setMavenExecutorId( String mavenExecutorId ) + { + this.mavenExecutorId = mavenExecutorId; + return this; + } + + @Override + public File getJavaHome() + { + return javaHome; + } + + public DefaultReleaseEnvironment setJavaHome( File javaHome ) + { + this.javaHome = javaHome; + return this; + } + + @Override + public File getLocalRepositoryDirectory() + { + File localRepo = localRepositoryDirectory; + + if ( localRepo == null && settings != null && settings.getLocalRepository() != null ) + { + localRepo = new File( settings.getLocalRepository() ).getAbsoluteFile(); + } + + return localRepo; + } + + public DefaultReleaseEnvironment setLocalRepositoryDirectory( File localRepositoryDirectory ) + { + this.localRepositoryDirectory = localRepositoryDirectory; + return this; + } + + @Override + public Locale getLocale() + { + return locale; + } + + public DefaultReleaseEnvironment setLocale( Locale locale ) + { + this.locale = locale; + return this; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/AbstractMavenExecutor.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/AbstractMavenExecutor.java new file mode 100644 index 000000000..e70fa0e1e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/AbstractMavenExecutor.java @@ -0,0 +1,202 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.maven.settings.Proxy; +import org.apache.maven.settings.Server; +import org.apache.maven.settings.Settings; +import org.apache.maven.settings.SettingsUtils; +import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.logging.LogEnabled; +import org.codehaus.plexus.logging.Logger; +import org.codehaus.plexus.util.StringUtils; +import org.sonatype.plexus.components.cipher.DefaultPlexusCipher; +import org.sonatype.plexus.components.cipher.PlexusCipher; +import org.sonatype.plexus.components.cipher.PlexusCipherException; +import org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher; +import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher; +import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; +import org.sonatype.plexus.components.sec.dispatcher.SecUtil; +import org.sonatype.plexus.components.sec.dispatcher.model.SettingsSecurity; + +/** + * + */ +public abstract class AbstractMavenExecutor + implements MavenExecutor, LogEnabled +{ + + private Logger logger; + + /** + * When this plugin requires Maven 3.0 as minimum, this component can be removed and o.a.m.s.c.SettingsDecrypter be + * used instead. + */ + @Requirement( role = SecDispatcher.class, hint = "mng-4384" ) + private DefaultSecDispatcher secDispatcher; + + /** + * + */ + @Requirement + private PlexusCipher cipher; + + protected AbstractMavenExecutor() + { + } + + @Override + public void executeGoals( File workingDirectory, String goals, ReleaseEnvironment releaseEnvironment, + boolean interactive, String additionalArguments, String pomFileName, + ReleaseResult result ) + throws MavenExecutorException + { + List goalsList = new ArrayList<>(); + if ( goals != null ) + { + // accept both space and comma, so the old way still work + // also accept line separators, so that goal lists can be spread + // across multiple lines in the POM. + for ( String token : StringUtils.split( goals, ", \n\r\t" ) ) + { + goalsList.add( token ); + } + } + executeGoals( workingDirectory, goalsList, releaseEnvironment, interactive, additionalArguments, pomFileName, + result ); + } + + protected abstract void executeGoals( File workingDirectory, List goals, + ReleaseEnvironment releaseEnvironment, boolean interactive, + String additionalArguments, String pomFileName, ReleaseResult result ) + throws MavenExecutorException; + + protected final Logger getLogger() + { + return logger; + } + + @Override + public void enableLogging( Logger logger ) + { + this.logger = logger; + } + + + protected Settings encryptSettings( Settings settings ) + { + Settings encryptedSettings = SettingsUtils.copySettings( settings ); + + for ( Server server : encryptedSettings.getServers() ) + { + String password = server.getPassword(); + if ( password != null && !isEncryptedString( password ) ) + { + try + { + server.setPassword( encryptAndDecorate( password ) ); + } + catch ( IllegalStateException | SecDispatcherException | PlexusCipherException e ) + { + // ignore + } + } + + String passphrase = server.getPassphrase(); + if ( passphrase != null && !isEncryptedString( passphrase ) ) + { + try + { + server.setPassphrase( encryptAndDecorate( passphrase ) ); + } + catch ( IllegalStateException | SecDispatcherException | PlexusCipherException e ) + { + // ignore + } + } + } + + for ( Proxy proxy : encryptedSettings.getProxies() ) + { + String password = proxy.getPassword(); + if ( password != null && !isEncryptedString( password ) ) + { + try + { + proxy.setPassword( encryptAndDecorate( password ) ); + } + catch ( IllegalStateException | SecDispatcherException | PlexusCipherException e ) + { + // ignore + } + } + } + + return encryptedSettings; + } + + // From org.apache.maven.cli.MavenCli.encryption(CliRequest) + private String encryptAndDecorate( String passwd ) + throws IllegalStateException, SecDispatcherException, PlexusCipherException + { + String configurationFile = secDispatcher.getConfigurationFile(); + + if ( configurationFile.startsWith( "~" ) ) + { + configurationFile = System.getProperty( "user.home" ) + configurationFile.substring( 1 ); + } + + String file = System.getProperty( DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION, configurationFile ); + + String master = null; + + SettingsSecurity sec = SecUtil.read( file, true ); + if ( sec != null ) + { + master = sec.getMaster(); + } + + if ( master == null ) + { + throw new IllegalStateException( "Master password is not set in the setting security file: " + file ); + } + + DefaultPlexusCipher cipher = new DefaultPlexusCipher(); + String masterPasswd = cipher.decryptDecorated( master, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ); + return cipher.encryptAndDecorate( passwd, masterPasswd ); + } + + private boolean isEncryptedString( String str ) + { + return cipher.isEncryptedString( str ); + } + + protected SettingsXpp3Writer getSettingsWriter() + { + return new SettingsXpp3Writer(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/CommandLineFactory.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/CommandLineFactory.java new file mode 100644 index 000000000..3699f68a4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/CommandLineFactory.java @@ -0,0 +1,40 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.cli.Commandline; + +/** + * Create a command line for execution. Componentised to allow mocking. + * + * @author Brett Porter + */ +public interface CommandLineFactory +{ + /** + * Create a command line object with default environment for the given executable. + * + * @param executable the executable + * @return the command line + * @throws MavenExecutorException if there was a problem creating the command line + */ + Commandline createCommandLine( String executable ) + throws MavenExecutorException; +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/DefaultCommandLineFactory.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/DefaultCommandLineFactory.java new file mode 100644 index 000000000..e89b42bdc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/DefaultCommandLineFactory.java @@ -0,0 +1,52 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.util.cli.Commandline; + +/** + * Create a command line instance. + * + * @author Brett Porter + */ +@Component( role = CommandLineFactory.class ) +public class DefaultCommandLineFactory + implements CommandLineFactory +{ + @Override + public Commandline createCommandLine( String executable ) + throws MavenExecutorException + { + Commandline commandline = new Commandline(); + commandline.setExecutable( executable ); + + try + { + commandline.addSystemEnvironment(); + } + catch ( Exception e ) + { + throw new MavenExecutorException( e.getMessage(), e ); + } + + return commandline; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/ForkedMavenExecutor.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/ForkedMavenExecutor.java new file mode 100644 index 000000000..af0051fb2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/ForkedMavenExecutor.java @@ -0,0 +1,256 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; + +import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.cli.CommandLineException; +import org.codehaus.plexus.util.cli.Commandline; + +/** + * Fork Maven to executed a series of goals. + * + * @author Brett Porter + */ +@Component( role = MavenExecutor.class, hint = "forked-path" ) +public class ForkedMavenExecutor + extends AbstractMavenExecutor +{ + /** + * Command line factory. + */ + @Requirement + private CommandLineFactory commandLineFactory; + + /* + * @noinspection UseOfSystemOutOrSystemErr + */ + @Override + public void executeGoals( File workingDirectory, List goals, ReleaseEnvironment releaseEnvironment, + boolean interactive, String additionalArguments, String pomFileName, + ReleaseResult relResult ) + throws MavenExecutorException + { + String mavenPath = null; + // if null we use the current one + if ( releaseEnvironment.getMavenHome() != null ) + { + mavenPath = releaseEnvironment.getMavenHome().getAbsolutePath(); + } + else + { + mavenPath = System.getProperty( "maven.home" ); + } + + File settingsFile = null; + if ( releaseEnvironment.getSettings() != null ) + { + // Have to serialize to a file as if Maven is embedded, there may not actually be a settings.xml on disk + try + { + settingsFile = File.createTempFile( "release-settings", ".xml" ); + SettingsXpp3Writer writer = getSettingsWriter(); + + try ( FileWriter fileWriter = new FileWriter( settingsFile ) ) + { + writer.write( fileWriter, encryptSettings( releaseEnvironment.getSettings() ) ); + } + } + catch ( IOException e ) + { + throw new MavenExecutorException( "Could not create temporary file for release settings.xml", e ); + } + } + try + { + + Commandline cl = + commandLineFactory.createCommandLine( mavenPath + File.separator + "bin" + File.separator + "mvn" ); + + cl.setWorkingDirectory( workingDirectory.getAbsolutePath() ); + + cl.addEnvironment( "MAVEN_TERMINATE_CMD", "on" ); + + cl.addEnvironment( "M2_HOME", mavenPath ); + + if ( settingsFile != null ) + { + cl.createArg().setValue( "-s" ); + cl.createArg().setFile( settingsFile ); + } + + if ( pomFileName != null ) + { + cl.createArg().setValue( "-f" ); + cl.createArg().setValue( pomFileName ); + } + + for ( String goal : goals ) + { + cl.createArg().setValue( goal ); + } + + if ( !interactive ) + { + cl.createArg().setValue( "--batch-mode" ); + } + + if ( !StringUtils.isEmpty( additionalArguments ) ) + { + cl.createArg().setLine( additionalArguments ); + } + + TeeOutputStream stdOut = new TeeOutputStream( System.out ); + + TeeOutputStream stdErr = new TeeOutputStream( System.err ); + + try + { + relResult.appendInfo( "Executing: " + cl.toString() ); + getLogger().info( "Executing: " + cl.toString() ); + + int result = executeCommandLine( cl, System.in, stdOut, stdErr ); + + if ( result != 0 ) + { + throw new MavenExecutorException( "Maven execution failed, exit code: \'" + result + "\'", result ); + } + } + catch ( CommandLineException e ) + { + throw new MavenExecutorException( "Can't run goal " + goals, e ); + } + finally + { + relResult.appendOutput( stdOut.toString() ); + } + } + finally + { + if ( settingsFile != null && settingsFile.exists() && !settingsFile.delete() ) + { + settingsFile.deleteOnExit(); + } + } + } + + public void setCommandLineFactory( CommandLineFactory commandLineFactory ) + { + this.commandLineFactory = commandLineFactory; + } + + + public static int executeCommandLine( Commandline cl, InputStream systemIn, OutputStream systemOut, + OutputStream systemErr ) + throws CommandLineException + { + if ( cl == null ) + { + throw new IllegalArgumentException( "cl cannot be null." ); + } + + Process p = cl.execute(); + + //processes.put( new Long( cl.getPid() ), p ); + + RawStreamPumper inputFeeder = null; + + if ( systemIn != null ) + { + inputFeeder = new RawStreamPumper( systemIn, p.getOutputStream(), true ); + } + + RawStreamPumper outputPumper = new RawStreamPumper( p.getInputStream(), systemOut ); + RawStreamPumper errorPumper = new RawStreamPumper( p.getErrorStream(), systemErr ); + + if ( inputFeeder != null ) + { + inputFeeder.start(); + } + + outputPumper.start(); + + errorPumper.start(); + + try + { + int returnValue = p.waitFor(); + + if ( inputFeeder != null ) + { + inputFeeder.setDone(); + } + outputPumper.setDone(); + errorPumper.setDone(); + + //processes.remove( new Long( cl.getPid() ) ); + + return returnValue; + } + catch ( InterruptedException ex ) + { + //killProcess( cl.getPid() ); + throw new CommandLineException( "Error while executing external command, process killed.", ex ); + } + finally + { + try + { + errorPumper.closeInput(); + } + catch ( IOException e ) + { + //ignore + } + try + { + outputPumper.closeInput(); + } + catch ( IOException e ) + { + //ignore + } + if ( inputFeeder != null ) + { + try + { + inputFeeder.closeOutput(); + } + catch ( IOException e ) + { + //ignore + } + } + } + } + + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/InvokerMavenExecutor.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/InvokerMavenExecutor.java new file mode 100644 index 000000000..eb9e04487 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/InvokerMavenExecutor.java @@ -0,0 +1,554 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.FileWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; + +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.OptionBuilder; +import org.apache.commons.cli.Options; +import org.apache.commons.cli.PosixParser; +import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer; +import org.apache.maven.shared.invoker.DefaultInvocationRequest; +import org.apache.maven.shared.invoker.DefaultInvoker; +import org.apache.maven.shared.invoker.InvocationOutputHandler; +import org.apache.maven.shared.invoker.InvocationRequest; +import org.apache.maven.shared.invoker.InvocationResult; +import org.apache.maven.shared.invoker.Invoker; +import org.apache.maven.shared.invoker.InvokerLogger; +import org.apache.maven.shared.invoker.MavenInvocationException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.logging.Logger; +import org.codehaus.plexus.util.cli.CommandLineUtils; + +/** + * Fork Maven using the maven-invoker shared library. + */ +@Component( role = MavenExecutor.class, hint = "invoker" ) +@SuppressWarnings( "static-access" ) +public class InvokerMavenExecutor + extends AbstractMavenExecutor +{ + + private static final Options OPTIONS = new Options(); + + private static final char SET_SYSTEM_PROPERTY = 'D'; + + private static final char OFFLINE = 'o'; + + private static final char REACTOR = 'r'; + + private static final char QUIET = 'q'; + + private static final char DEBUG = 'X'; + + private static final char ERRORS = 'e'; + + private static final char NON_RECURSIVE = 'N'; + + private static final char UPDATE_SNAPSHOTS = 'U'; + + private static final char ACTIVATE_PROFILES = 'P'; + + private static final char CHECKSUM_FAILURE_POLICY = 'C'; + + private static final char CHECKSUM_WARNING_POLICY = 'c'; + + private static final char ALTERNATE_USER_SETTINGS = 's'; + + private static final String ALTERNATE_GLOBAL_SETTINGS = "gs"; + + private static final String FAIL_FAST = "ff"; + + private static final String FAIL_AT_END = "fae"; + + private static final String FAIL_NEVER = "fn"; + + private static final String ALTERNATE_POM_FILE = "f"; + + private static final String THREADS = "T"; + + private static final String BATCH_MODE = "B"; + + public static final char ALTERNATE_USER_TOOLCHAINS = 't'; + + static + { + OPTIONS.addOption( + OptionBuilder.withLongOpt( "define" ).hasArg().withDescription( "Define a system property" ).create( + SET_SYSTEM_PROPERTY ) ); + + OPTIONS.addOption( OptionBuilder.withLongOpt( "offline" ).withDescription( "Work offline" ).create( OFFLINE ) ); + + OPTIONS.addOption( + OptionBuilder.withLongOpt( "quiet" ).withDescription( "Quiet output - only show errors" ).create( QUIET ) ); + + OPTIONS.addOption( + OptionBuilder.withLongOpt( "debug" ).withDescription( "Produce execution debug output" ).create( DEBUG ) ); + + OPTIONS.addOption( + OptionBuilder.withLongOpt( "errors" ).withDescription( "Produce execution error messages" ).create( + ERRORS ) ); + + OPTIONS.addOption( OptionBuilder.withLongOpt( "reactor" ).withDescription( + "Execute goals for project found in the reactor" ).create( REACTOR ) ); + + OPTIONS.addOption( + OptionBuilder.withLongOpt( "non-recursive" ).withDescription( "Do not recurse into sub-projects" ).create( + NON_RECURSIVE ) ); + + OPTIONS.addOption( OptionBuilder.withLongOpt( "update-snapshots" ).withDescription( + "Forces a check for updated releases and snapshots on remote repositories" ).create( UPDATE_SNAPSHOTS ) ); + + OPTIONS.addOption( OptionBuilder.withLongOpt( "activate-profiles" ).withDescription( + "Comma-delimited list of profiles to activate" ).hasArg().create( ACTIVATE_PROFILES ) ); + + OPTIONS.addOption( OptionBuilder.withLongOpt( "strict-checksums" ).withDescription( + "Fail the build if checksums don't match" ).create( CHECKSUM_FAILURE_POLICY ) ); + + OPTIONS.addOption( + OptionBuilder.withLongOpt( "lax-checksums" ).withDescription( "Warn if checksums don't match" ).create( + CHECKSUM_WARNING_POLICY ) ); + + OPTIONS.addOption( OptionBuilder.withLongOpt( "settings" ).withDescription( + "Alternate path for the user settings file" ).hasArg().create( ALTERNATE_USER_SETTINGS ) ); + + OPTIONS.addOption( OptionBuilder.withLongOpt( "global-settings" ).withDescription( + " Alternate path for the global settings file" ).hasArg().create( ALTERNATE_GLOBAL_SETTINGS ) ); + + OPTIONS.addOption( OptionBuilder.withLongOpt( "fail-fast" ).withDescription( + "Stop at first failure in reactorized builds" ).create( FAIL_FAST ) ); + + OPTIONS.addOption( OptionBuilder.withLongOpt( "fail-at-end" ).withDescription( + "Only fail the build afterwards; allow all non-impacted builds to continue" ).create( FAIL_AT_END ) ); + + OPTIONS.addOption( OptionBuilder.withLongOpt( "fail-never" ).withDescription( + "NEVER fail the build, regardless of project result" ).create( FAIL_NEVER ) ); + + OPTIONS.addOption( OptionBuilder.withLongOpt( "file" ).withDescription( + "Force the use of an alternate POM file." ).hasArg().create( ALTERNATE_POM_FILE ) ); + + OPTIONS.addOption( OptionBuilder.withLongOpt( "threads" ).withDescription( + "Thread count, for instance 2.0C where C is core multiplied" ).hasArg().create( THREADS ) ); + + OPTIONS.addOption( OptionBuilder.withLongOpt( "batch-mode" ).withDescription( + "Run in non-interactive (batch) mode" ).create( BATCH_MODE ) ); + + OPTIONS.addOption( OptionBuilder.withLongOpt( "toolchains" ).withDescription( + "Alternate path for the user toolchains file" ).hasArg().create( ALTERNATE_USER_TOOLCHAINS ) ); + } + + // TODO: Configuring an invocation request from a command line could as well be part of the Invoker API + protected void setupRequest( InvocationRequest req, + InvokerLogger bridge, + String additionalArguments ) + throws MavenExecutorException + { + try + { + String[] args = CommandLineUtils.translateCommandline( additionalArguments ); + CommandLine cli = new PosixParser().parse( OPTIONS, args ); + + if ( cli.hasOption( SET_SYSTEM_PROPERTY ) ) + { + String[] properties = cli.getOptionValues( SET_SYSTEM_PROPERTY ); + Properties props = new Properties(); + for ( int i = 0; i < properties.length; i++ ) + { + String property = properties[i]; + String name, value; + int sep = property.indexOf( "=" ); + if ( sep <= 0 ) + { + name = property.trim(); + value = "true"; + } + else + { + name = property.substring( 0, sep ).trim(); + value = property.substring( sep + 1 ).trim(); + } + props.setProperty( name, value ); + } + + req.setProperties( props ); + } + + if ( cli.hasOption( OFFLINE ) ) + { + req.setOffline( true ); + } + + if ( cli.hasOption( QUIET ) ) + { + // TODO: setQuiet() currently not supported by InvocationRequest + req.setDebug( false ); + } + else if ( cli.hasOption( DEBUG ) ) + { + req.setDebug( true ); + } + else if ( cli.hasOption( ERRORS ) ) + { + req.setShowErrors( true ); + } + + if ( cli.hasOption( REACTOR ) ) + { + req.setRecursive( true ); + } + else if ( cli.hasOption( NON_RECURSIVE ) ) + { + req.setRecursive( false ); + } + + if ( cli.hasOption( UPDATE_SNAPSHOTS ) ) + { + req.setUpdateSnapshots( true ); + } + + if ( cli.hasOption( ACTIVATE_PROFILES ) ) + { + String[] profiles = cli.getOptionValues( ACTIVATE_PROFILES ); + + if ( profiles != null ) + { + req.setProfiles( Arrays.asList( profiles ) ); + } + } + + if ( cli.hasOption( CHECKSUM_FAILURE_POLICY ) ) + { + req.setGlobalChecksumPolicy( InvocationRequest.CHECKSUM_POLICY_FAIL ); + } + else if ( cli.hasOption( CHECKSUM_WARNING_POLICY ) ) + { + req.setGlobalChecksumPolicy( InvocationRequest.CHECKSUM_POLICY_WARN ); + } + + if ( cli.hasOption( ALTERNATE_USER_SETTINGS ) ) + { + req.setUserSettingsFile( new File( cli.getOptionValue( ALTERNATE_USER_SETTINGS ) ) ); + } + + if ( cli.hasOption( ALTERNATE_GLOBAL_SETTINGS ) ) + { + req.setGlobalSettingsFile( new File( cli.getOptionValue( ALTERNATE_GLOBAL_SETTINGS ) ) ); + } + + if ( cli.hasOption( FAIL_AT_END ) ) + { + req.setFailureBehavior( InvocationRequest.REACTOR_FAIL_AT_END ); + } + else if ( cli.hasOption( FAIL_FAST ) ) + { + req.setFailureBehavior( InvocationRequest.REACTOR_FAIL_FAST ); + } + if ( cli.hasOption( FAIL_NEVER ) ) + { + req.setFailureBehavior( InvocationRequest.REACTOR_FAIL_NEVER ); + } + if ( cli.hasOption( ALTERNATE_POM_FILE ) ) + { + if ( req.getPomFileName() != null ) + { + getLogger().info( "pomFileName is already set, ignoring the -f argument" ); + } + else + { + req.setPomFileName( cli.getOptionValue( ALTERNATE_POM_FILE ) ); + } + } + + if ( cli.hasOption( THREADS ) ) + { + req.setThreads( cli.getOptionValue( THREADS ) ); + } + + if ( cli.hasOption( BATCH_MODE ) ) + { + req.setInteractive( false ); + } + + if ( cli.hasOption( ALTERNATE_USER_TOOLCHAINS ) ) + { + req.setToolchainsFile( new File( cli.getOptionValue( ALTERNATE_USER_TOOLCHAINS ) ) ); + } + + } + catch ( Exception e ) + { + throw new MavenExecutorException( "Failed to re-parse additional arguments for Maven invocation.", e ); + } + } + + @Override + public void executeGoals( File workingDirectory, List goals, ReleaseEnvironment releaseEnvironment, + boolean interactive, String additionalArguments, String pomFileName, + ReleaseResult result ) + throws MavenExecutorException + { + InvocationOutputHandler handler = getOutputHandler(); + InvokerLogger bridge = getInvokerLogger(); + + File mavenPath = null; + // if null we use the current one + if ( releaseEnvironment.getMavenHome() != null ) + { + mavenPath = releaseEnvironment.getMavenHome(); + } + else + { + String mavenHome = System.getProperty( "maven.home" ); + if ( mavenHome == null ) + { + mavenHome = System.getenv( "MAVEN_HOME" ); + } + if ( mavenHome == null ) + { + mavenHome = System.getenv( "M2_HOME" ); + } + mavenPath = mavenHome == null ? null : new File( mavenHome ); + } + Invoker invoker = + new DefaultInvoker().setMavenHome( mavenPath ).setLogger( bridge ) + .setOutputHandler( handler ).setErrorHandler( handler ); + + InvocationRequest req = + new DefaultInvocationRequest().setDebug( getLogger().isDebugEnabled() ) + .setBaseDirectory( workingDirectory ).setInteractive( interactive ); + + if ( pomFileName != null ) + { + req.setPomFileName( pomFileName ); + } + + File settingsFile = null; + if ( releaseEnvironment.getSettings() != null ) + { + // Have to serialize to a file as if Maven is embedded, there may not actually be a settings.xml on disk + try + { + settingsFile = File.createTempFile( "release-settings", ".xml" ); + SettingsXpp3Writer writer = getSettingsWriter(); + + try ( FileWriter fileWriter = new FileWriter( settingsFile ) ) + { + writer.write( fileWriter, encryptSettings( releaseEnvironment.getSettings() ) ); + } + req.setUserSettingsFile( settingsFile ); + } + catch ( IOException e ) + { + throw new MavenExecutorException( "Could not create temporary file for release settings.xml", e ); + } + } + try + { + File localRepoDir = releaseEnvironment.getLocalRepositoryDirectory(); + if ( localRepoDir != null ) + { + req.setLocalRepositoryDirectory( localRepoDir ); + } + + setupRequest( req, bridge, additionalArguments ); + + req.setGoals( goals ); + + try + { + InvocationResult invocationResult = invoker.execute( req ); + + if ( invocationResult.getExecutionException() != null ) + { + throw new MavenExecutorException( "Error executing Maven.", + invocationResult.getExecutionException() ); + } + if ( invocationResult.getExitCode() != 0 ) + { + throw new MavenExecutorException( + "Maven execution failed, exit code: \'" + invocationResult.getExitCode() + "\'", + invocationResult.getExitCode() ); + } + } + catch ( MavenInvocationException e ) + { + throw new MavenExecutorException( "Failed to invoke Maven build.", e ); + } + } + finally + { + if ( settingsFile != null && settingsFile.exists() && !settingsFile.delete() ) + { + settingsFile.deleteOnExit(); + } + } + } + + protected InvokerLogger getInvokerLogger() + { + return new LoggerBridge( getLogger() ); + } + + protected InvocationOutputHandler getOutputHandler() + { + return new Handler( getLogger() ); + } + + private static final class Handler + implements InvocationOutputHandler + { + private Logger logger; + + Handler( Logger logger ) + { + this.logger = logger; + } + + public void consumeLine( String line ) + { + logger.info( line ); + } + } + + private static final class LoggerBridge + implements InvokerLogger + { + + private Logger logger; + + LoggerBridge( Logger logger ) + { + this.logger = logger; + } + + @Override + public void debug( String message, Throwable error ) + { + logger.debug( message, error ); + } + + @Override + public void debug( String message ) + { + logger.debug( message ); + } + + @Override + public void error( String message, Throwable error ) + { + logger.error( message, error ); + } + + @Override + public void error( String message ) + { + logger.error( message ); + } + + @Override + public void fatalError( String message, Throwable error ) + { + logger.fatalError( message, error ); + } + + @Override + public void fatalError( String message ) + { + logger.fatalError( message ); + } + + @Override + public int getThreshold() + { + return logger.getThreshold(); + } + + @Override + public void info( String message, Throwable error ) + { + logger.info( message, error ); + } + + @Override + public void info( String message ) + { + logger.info( message ); + } + + @Override + public boolean isDebugEnabled() + { + return logger.isDebugEnabled(); + } + + @Override + public boolean isErrorEnabled() + { + return logger.isErrorEnabled(); + } + + @Override + public boolean isFatalErrorEnabled() + { + return logger.isFatalErrorEnabled(); + } + + @Override + public boolean isInfoEnabled() + { + return logger.isInfoEnabled(); + } + + @Override + public boolean isWarnEnabled() + { + return logger.isWarnEnabled(); + } + + @Override + public void setThreshold( int level ) + { + // NOTE: + // logger.setThreadhold( level ) + // is not supported in plexus-container-default:1.0-alpha-9 as used in Maven 2.x + } + + @Override + public void warn( String message, Throwable error ) + { + logger.warn( message, error ); + } + + @Override + public void warn( String message ) + { + logger.warn( message ); + } + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/MavenExecutor.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/MavenExecutor.java new file mode 100644 index 000000000..e1fe9f54d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/MavenExecutor.java @@ -0,0 +1,49 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.ReleaseResult; +import org.apache.maven.shared.release.env.ReleaseEnvironment; + +import java.io.File; + +/** + * Execute Maven. May be implemented as a forked instance, or embedded. + * + * @author Brett Porter + */ +public interface MavenExecutor +{ + /** + * Execute goals using Maven. + * + * @param workingDirectory the directory to execute in + * @param goals the goals to run (space delimited) + * @param releaseEnvironment the environmental settings, maven-home, etc used for this release + * @param interactive whether to execute in interactive mode, or the default batch mode + * @param additionalArguments additional arguments to pass to the Maven command + * @param pomFileName the file name of the POM to execute on + * @param result holds all results of the execution + * @throws MavenExecutorException if an error occurred executing Maven + */ + void executeGoals( File workingDirectory, String goals, ReleaseEnvironment releaseEnvironment, + boolean interactive, String additionalArguments, String pomFileName, ReleaseResult result ) + throws MavenExecutorException; +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/MavenExecutorException.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/MavenExecutorException.java new file mode 100644 index 000000000..74300c730 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/MavenExecutorException.java @@ -0,0 +1,48 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Exception executing Maven. + * + * @author Brett Porter + */ +public class MavenExecutorException + extends Exception +{ + private int exitCode; + + public MavenExecutorException( String message, int exitCode ) + { + super( message ); + + this.exitCode = exitCode; + } + + public MavenExecutorException( String message, Throwable cause ) + { + super( message, cause ); + } + + public int getExitCode() + { + return exitCode; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/RawStreamPumper.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/RawStreamPumper.java new file mode 100644 index 000000000..f75b69e51 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/RawStreamPumper.java @@ -0,0 +1,128 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +/** + * + */ +public class RawStreamPumper + extends Thread +{ + private InputStream in; + + private OutputStream out; + + boolean done; + + boolean poll; + + byte buffer[] = new byte[256]; + + public RawStreamPumper( InputStream in , OutputStream out, boolean poll ) + { + this.in = in; + this.out = out; + this.poll = poll; + } + + public RawStreamPumper( InputStream in , OutputStream out ) + { + this.in = in; + this.out = out; + this.poll = false; + } + + public void setDone() + { + done = true; + } + + public void closeInput() + throws IOException + { + in.close(); + } + + public void closeOutput() + throws IOException + { + out.close(); + } + + @Override + public void run() + { + try + { + if ( poll ) + { + while ( !done ) + { + if ( in.available() > 0 ) + { + int i = in.read( buffer ); + if ( i != -1 ) + { + out.write( buffer, 0, i ); + out.flush(); + } + else + { + done = true; + } + } + else + { + Thread.sleep( 1 ); + } + } + } + else + { + int i = in.read( buffer ); + while ( i != -1 && !done ) + { + if ( i != -1 ) + { + out.write( buffer, 0, i ); + out.flush(); + } + else + { + done = true; + } + i = in.read( buffer ); + } + } + } + catch ( Throwable e ) + { + // Catched everything + } + finally + { + done = true; + } + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/TeeConsumer.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/TeeConsumer.java new file mode 100644 index 000000000..1ca009244 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/TeeConsumer.java @@ -0,0 +1,76 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.cli.StreamConsumer; + +import java.io.PrintStream; + +/** + * Consumer that both funnels to System.out/err, and stores in an internal buffer. + * + * @author Brett Porter + */ +public class TeeConsumer + implements StreamConsumer +{ + private PrintStream stream; + + /** + * @noinspection StringBufferField + */ + private StringBuffer content = new StringBuffer(); + + private static final String LS = System.getProperty( "line.separator" ); + + private String indent; + + public TeeConsumer( PrintStream stream ) + { + this( stream, " " ); + } + + public TeeConsumer( PrintStream stream, String indent ) + { + this.stream = stream; + + this.indent = indent; + } + + @Override + public void consumeLine( String line ) + { + stream.println( indent + line ); + + content.append( line ); + content.append( LS ); + } + + public String getContent() + { + return content.toString(); + } + + @Override + public String toString() + { + return getContent(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/TeeOutputStream.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/TeeOutputStream.java new file mode 100644 index 000000000..e06fa1337 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/TeeOutputStream.java @@ -0,0 +1,94 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.ByteArrayOutputStream; +import java.io.FilterOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +/** + * + */ +public class TeeOutputStream + extends FilterOutputStream +{ + private ByteArrayOutputStream bout = new ByteArrayOutputStream( 1024 * 8 ); + private byte indent[]; + private int last = '\n'; + + public TeeOutputStream( OutputStream out ) + { + this( out, " " ); + } + + public TeeOutputStream( OutputStream out, String i ) + { + super( out ); + indent = i.getBytes(); + } + + @Override + public void write( byte[] b, int off, int len ) + throws IOException + { + for ( int x = 0; x < len; x++ ) + { + int c = b[off + x]; + if ( last == '\n' || ( last == '\r' && c != '\n' ) ) + { + out.write( b, off, x ); + bout.write( b, off, x ); + out.write( indent ); + off += x; + len -= x; + x = 0; + } + last = c; + } + out.write( b, off, len ); + bout.write( b, off, len ); + } + + @Override + public void write( int b ) + throws IOException + { + if ( last == '\n' || ( last == '\r' && b != '\n' ) ) + { + out.write( indent ); + } + out.write( b ); + bout.write( b ); + last = b; + } + + @Override + public String toString() + { + return bout.toString(); + } + + public String getContent() + { + return bout.toString(); + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractBackupPomsPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractBackupPomsPhase.java new file mode 100644 index 000000000..b2a7e8edf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractBackupPomsPhase.java @@ -0,0 +1,58 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.util.ReleaseUtil; + +import java.io.File; + +/** + * @author Edwin Punzalan + */ +public abstract class AbstractBackupPomsPhase + extends AbstractReleasePhase +{ + private final String backupSuffix = ".releaseBackup"; + + protected File getPomBackup( MavenProject project ) + { + File pomFile = ReleaseUtil.getStandardPom( project ); + + if ( pomFile != null ) + { + return new File( pomFile.getAbsolutePath() + backupSuffix ); + } + else + { + return null; + } + } + + protected void deletePomBackup( MavenProject project ) + { + File pomBackup = getPomBackup( project ); + + if ( pomBackup != null && pomBackup.exists() ) + { + pomBackup.delete(); + } + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractReleasePomsPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractReleasePomsPhase.java new file mode 100644 index 000000000..0555c08c9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractReleasePomsPhase.java @@ -0,0 +1,80 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator; +import org.codehaus.plexus.component.annotations.Requirement; + +/** + * Abstract release POM phase. + * + * @author Mark Hobson + */ +public abstract class AbstractReleasePomsPhase extends AbstractReleasePhase +{ + /** + * Tool that gets a configured SCM repository from release configuration. + */ + @Requirement + private ScmRepositoryConfigurator scmRepositoryConfigurator; + + protected ScmRepository getScmRepository( ReleaseDescriptor releaseDescriptor, + ReleaseEnvironment releaseEnvironment ) + throws ReleaseFailureException, ReleaseExecutionException + { + try + { + return scmRepositoryConfigurator.getConfiguredRepository( releaseDescriptor, + releaseEnvironment.getSettings() ); + } + catch ( ScmRepositoryException exception ) + { + throw new ReleaseScmRepositoryException( exception.getMessage(), exception.getValidationMessages() ); + } + catch ( NoSuchScmProviderException exception ) + { + throw new ReleaseExecutionException( "Unable to configure SCM repository: " + exception.getMessage(), + exception ); + } + } + + protected ScmProvider getScmProvider( ScmRepository scmRepository ) + throws ReleaseExecutionException + { + try + { + return scmRepositoryConfigurator.getRepositoryProvider( scmRepository ); + } + catch ( NoSuchScmProviderException exception ) + { + throw new ReleaseExecutionException( "Unable to configure SCM repository: " + exception.getMessage(), + exception ); + } + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java new file mode 100644 index 000000000..4da819909 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java @@ -0,0 +1,682 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.TimeZone; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.model.Build; +import org.apache.maven.model.BuildBase; +import org.apache.maven.model.Model; +import org.apache.maven.model.ModelBase; +import org.apache.maven.model.Plugin; +import org.apache.maven.model.Profile; +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.command.edit.EditScmResult; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator; +import org.apache.maven.shared.release.scm.ScmTranslator; +import org.apache.maven.shared.release.transform.ModelETLRequest; +import org.apache.maven.shared.release.transform.MavenCoordinate; +import org.apache.maven.shared.release.transform.ModelETL; +import org.apache.maven.shared.release.transform.ModelETLFactory; +import org.apache.maven.shared.release.transform.jdom.JDomModelETLFactory; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.util.StringUtils; + +/** + * Base class for rewriting phases. + * + * @author Brett Porter + */ +public abstract class AbstractRewritePomsPhase + extends AbstractReleasePhase implements ResourceGenerator +{ + /** + * Tool that gets a configured SCM repository from release configuration. + */ + @Requirement + private ScmRepositoryConfigurator scmRepositoryConfigurator; + + @Requirement( role = ModelETLFactory.class ) + private Map modelETLFactories; + + /** + * Use jdom-sax as default + */ + private String modelETL = JDomModelETLFactory.ROLE_HINT; + + /** + * SCM URL translators mapped by provider name. + */ + @Requirement( role = ScmTranslator.class ) + private Map scmTranslators; + + protected final Map getScmTranslators() + { + return scmTranslators; + } + + private String ls = ReleaseUtil.LS; + + public void setLs( String ls ) + { + this.ls = ls; + } + + public void setModelETL( String modelETL ) + { + this.modelETL = modelETL; + } + + private long startTime = -1 * 1000; + + public void setStartTime( long startTime ) + { + this.startTime = startTime; + } + + protected abstract String getPomSuffix(); + + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = new ReleaseResult(); + + transform( releaseDescriptor, releaseEnvironment, reactorProjects, false, result ); + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = new ReleaseResult(); + + transform( releaseDescriptor, releaseEnvironment, reactorProjects, true, result ); + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + @Override + public ReleaseResult clean( List reactorProjects ) + { + ReleaseResult result = new ReleaseResult(); + + if ( reactorProjects != null ) + { + for ( MavenProject project : reactorProjects ) + { + File pomFile = ReleaseUtil.getStandardPom( project ); + // MRELEASE-273 : if no pom + if ( pomFile != null ) + { + File file = new File( pomFile.getParentFile(), pomFile.getName() + "." + getPomSuffix() ); + if ( file.exists() ) + { + file.delete(); + } + } + } + } + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + private void transform( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects, boolean simulate, ReleaseResult result ) + throws ReleaseExecutionException, ReleaseFailureException + { + result.setStartTime( ( startTime >= 0 ) ? startTime : System.currentTimeMillis() ); + + for ( MavenProject project : reactorProjects ) + { + logInfo( result, "Transforming '" + project.getName() + "'..." ); + + transformProject( project, releaseDescriptor, releaseEnvironment, simulate, result ); + } + } + + private void transformProject( MavenProject project, ReleaseDescriptor releaseDescriptor, + ReleaseEnvironment releaseEnvironment, boolean simulate, + ReleaseResult result ) + throws ReleaseExecutionException, ReleaseFailureException + { + File pomFile = ReleaseUtil.getStandardPom( project ); + + ModelETLRequest request = new ModelETLRequest(); + request.setLineSeparator( ls ); + request.setProject( project ); + request.setReleaseDescriptor( releaseDescriptor ); + + ModelETL etl = modelETLFactories.get( modelETL ).newInstance( request ); + + etl.extract( pomFile ); + + ScmRepository scmRepository = null; + ScmProvider provider = null; + + if ( isUpdateScm() ) + { + try + { + scmRepository = scmRepositoryConfigurator.getConfiguredRepository( releaseDescriptor, + releaseEnvironment.getSettings() ); + + provider = scmRepositoryConfigurator.getRepositoryProvider( scmRepository ); + } + catch ( ScmRepositoryException e ) + { + throw new ReleaseScmRepositoryException( e.getMessage(), e.getValidationMessages() ); + } + catch ( NoSuchScmProviderException e ) + { + throw new ReleaseExecutionException( "Unable to configure SCM repository: " + e.getMessage(), e ); + } + } + + transformDocument( project, etl.getModel(), releaseDescriptor, scmRepository, result, + simulate ); + + File outputFile; + if ( simulate ) + { + outputFile = new File( pomFile.getParentFile(), pomFile.getName() + "." + getPomSuffix() ); + } + else + { + outputFile = pomFile; + prepareScm( pomFile, releaseDescriptor, scmRepository, provider ); + } + etl.load( outputFile ); + + } + + private void transformDocument( MavenProject project, Model modelTarget, ReleaseDescriptor releaseDescriptor, + ScmRepository scmRepository, ReleaseResult result, + boolean simulate ) + throws ReleaseExecutionException, ReleaseFailureException + { + Model model = project.getModel(); + + Properties properties = modelTarget.getProperties(); + + String parentVersion = rewriteParent( project, modelTarget, releaseDescriptor, simulate ); + + String projectId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ); + + rewriteVersion( modelTarget, releaseDescriptor, projectId, project, parentVersion ); + + Build buildTarget = modelTarget.getBuild(); + if ( buildTarget != null ) + { + // profile.build.extensions doesn't exist, so only rewrite project.build.extensions + rewriteArtifactVersions( toMavenCoordinates( buildTarget.getExtensions() ), + model, properties, result, releaseDescriptor, simulate ); + + rewriteArtifactVersions( toMavenCoordinates( buildTarget.getPlugins() ), + model, properties, result, releaseDescriptor, simulate ); + + for ( Plugin plugin : buildTarget.getPlugins() ) + { + rewriteArtifactVersions( toMavenCoordinates( plugin.getDependencies() ), + model, properties, + result, releaseDescriptor, simulate ); + } + + if ( buildTarget.getPluginManagement() != null ) + { + rewriteArtifactVersions( toMavenCoordinates( buildTarget.getPluginManagement().getPlugins() ), model, + properties, result, releaseDescriptor, simulate ); + + for ( Plugin plugin : buildTarget.getPluginManagement().getPlugins() ) + { + rewriteArtifactVersions( toMavenCoordinates( plugin.getDependencies() ), model, properties, result, + releaseDescriptor, simulate ); + } + } + } + + for ( Profile profile : modelTarget.getProfiles() ) + { + BuildBase profileBuild = profile.getBuild(); + if ( profileBuild != null ) + { + rewriteArtifactVersions( toMavenCoordinates( profileBuild.getPlugins() ), model, properties, result, + releaseDescriptor, simulate ); + + for ( Plugin plugin : profileBuild.getPlugins() ) + { + rewriteArtifactVersions( toMavenCoordinates( plugin.getDependencies() ), model, properties, result, + releaseDescriptor, simulate ); + } + + if ( profileBuild.getPluginManagement() != null ) + { + rewriteArtifactVersions( toMavenCoordinates( profileBuild.getPluginManagement().getPlugins() ), + model, properties, result, releaseDescriptor, simulate ); + + for ( Plugin plugin : profileBuild.getPluginManagement().getPlugins() ) + { + rewriteArtifactVersions( toMavenCoordinates( plugin.getDependencies() ), model, properties, + result, releaseDescriptor, simulate ); + } + } + } + } + + List modelBases = new ArrayList<>(); + modelBases.add( modelTarget ); + modelBases.addAll( modelTarget.getProfiles() ); + + for ( ModelBase modelBase : modelBases ) + { + rewriteArtifactVersions( toMavenCoordinates( modelBase.getDependencies() ), model, properties, result, + releaseDescriptor, simulate ); + + if ( modelBase.getDependencyManagement() != null ) + { + rewriteArtifactVersions( toMavenCoordinates( modelBase.getDependencyManagement().getDependencies() ), + model, properties, result, releaseDescriptor, simulate ); + } + + if ( modelBase.getReporting() != null ) + { + rewriteArtifactVersions( toMavenCoordinates( modelBase.getReporting().getPlugins() ), model, properties, + result, releaseDescriptor, simulate ); + } + } + + transformScm( project, modelTarget, releaseDescriptor, projectId, scmRepository, result ); + + if ( properties != null ) + { + rewriteBuildOutputTimestampProperty( properties, result ); + } + } + + private void rewriteBuildOutputTimestampProperty( Properties properties, ReleaseResult result ) + { + String buildOutputTimestamp = properties.getProperty( "project.build.outputTimestamp" ); + if ( buildOutputTimestamp == null ) + { + // no Reproducible Builds output timestamp defined + return; + } + if ( buildOutputTimestamp.length() <= 1 ) + { + // value length == 1 means disable Reproducible Builds + return; + } + + if ( StringUtils.isNumeric( buildOutputTimestamp ) ) + { + // int representing seconds since the epoch, like SOURCE_DATE_EPOCH + buildOutputTimestamp = String.valueOf( result.getStartTime() / 1000 ); + } + else + { + // ISO-8601 + DateFormat df = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss'Z'" ); + df.setTimeZone( TimeZone.getTimeZone( "UTC" ) ); + buildOutputTimestamp = df.format( new Date( result.getStartTime() ) ); + } + properties.setProperty( "project.build.outputTimestamp", buildOutputTimestamp ); + } + + private void rewriteVersion( Model modelTarget, ReleaseDescriptor releaseDescriptor, String projectId, + MavenProject project, String parentVersion ) + throws ReleaseFailureException + { + String version = getNextVersion( releaseDescriptor, projectId ); + if ( version == null ) + { + throw new ReleaseFailureException( "Version for '" + project.getName() + "' was not mapped" ); + } + + modelTarget.setVersion( version ); + } + + private String rewriteParent( MavenProject project, Model targetModel, + ReleaseDescriptor releaseDescriptor, boolean simulate ) + throws ReleaseFailureException + { + String parentVersion = null; + if ( project.hasParent() ) + { + MavenProject parent = project.getParent(); + String key = ArtifactUtils.versionlessKey( parent.getGroupId(), parent.getArtifactId() ); + parentVersion = getNextVersion( releaseDescriptor, key ); + if ( parentVersion == null ) + { + //MRELEASE-317 + parentVersion = getResolvedSnapshotVersion( key, releaseDescriptor ); + } + if ( parentVersion == null ) + { + String original = getOriginalVersion( releaseDescriptor, key, simulate ); + if ( parent.getVersion().equals( original ) ) + { + throw new ReleaseFailureException( "Version for parent '" + parent.getName() + "' was not mapped" ); + } + } + else + { + targetModel.getParent().setVersion( parentVersion ); + } + } + return parentVersion; + } + + private void rewriteArtifactVersions( Collection elements, Model projectModel, + Properties properties, ReleaseResult result, + ReleaseDescriptor releaseDescriptor, boolean simulate ) + throws ReleaseExecutionException, ReleaseFailureException + { + if ( elements == null ) + { + return; + } + String projectId = ArtifactUtils.versionlessKey( projectModel.getGroupId(), projectModel.getArtifactId() ); + for ( MavenCoordinate coordinate : elements ) + { + String rawVersion = coordinate.getVersion(); + if ( rawVersion == null ) + { + // managed dependency or unversioned plugin + continue; + } + + String rawGroupId = coordinate.getGroupId(); + if ( rawGroupId == null ) + { + if ( "plugin".equals( coordinate.getName() ) ) + { + rawGroupId = "org.apache.maven.plugins"; + } + else + { + // incomplete dependency + continue; + } + } + String groupId = ReleaseUtil.interpolate( rawGroupId, projectModel ); + + String rawArtifactId = coordinate.getArtifactId(); + if ( rawArtifactId == null ) + { + // incomplete element + continue; + } + String artifactId = ReleaseUtil.interpolate( rawArtifactId, projectModel ); + + String key = ArtifactUtils.versionlessKey( groupId, artifactId ); + String resolvedSnapshotVersion = getResolvedSnapshotVersion( key, releaseDescriptor ); + String mappedVersion = getNextVersion( releaseDescriptor, key ); + String originalVersion = getOriginalVersion( releaseDescriptor, key, simulate ); + if ( originalVersion == null ) + { + originalVersion = getOriginalResolvedSnapshotVersion( key, releaseDescriptor ); + } + + // MRELEASE-220 + if ( mappedVersion != null && mappedVersion.endsWith( Artifact.SNAPSHOT_VERSION ) + && !rawVersion.endsWith( Artifact.SNAPSHOT_VERSION ) && !releaseDescriptor.isUpdateDependencies() ) + { + continue; + } + + if ( mappedVersion != null ) + { + if ( rawVersion.equals( originalVersion ) ) + { + logInfo( result, " Updating " + artifactId + " to " + mappedVersion ); + coordinate.setVersion( mappedVersion ); + } + else if ( rawVersion.matches( "\\$\\{.+\\}" ) ) + { + String expression = rawVersion.substring( 2, rawVersion.length() - 1 ); + + if ( expression.startsWith( "project." ) || expression.startsWith( "pom." ) + || "version".equals( expression ) ) + { + if ( !mappedVersion.equals( getNextVersion( releaseDescriptor, projectId ) ) ) + { + logInfo( result, " Updating " + artifactId + " to " + mappedVersion ); + coordinate.setVersion( mappedVersion ); + } + else + { + logInfo( result, " Ignoring artifact version update for expression " + rawVersion ); + } + } + else if ( properties != null ) + { + // version is an expression, check for properties to update instead + + String propertyValue = properties.getProperty( expression ); + + if ( propertyValue != null ) + { + if ( propertyValue.equals( originalVersion ) ) + { + logInfo( result, " Updating " + rawVersion + " to " + mappedVersion ); + // change the property only if the property is the same as what's in the reactor + properties.setProperty( expression, mappedVersion ); + } + else if ( mappedVersion.equals( propertyValue ) ) + { + // this property may have been updated during processing a sibling. + logInfo( result, " Ignoring artifact version update for expression " + rawVersion + + " because it is already updated" ); + } + else if ( !mappedVersion.equals( rawVersion ) ) + { + if ( mappedVersion.matches( "\\$\\{project.+\\}" ) + || mappedVersion.matches( "\\$\\{pom.+\\}" ) + || "${version}".equals( mappedVersion ) ) + { + logInfo( result, " Ignoring artifact version update for expression " + + mappedVersion ); + // ignore... we cannot update this expression + } + else + { + // the value of the expression conflicts with what the user wanted to release + throw new ReleaseFailureException( "The artifact (" + key + ") requires a " + + "different version (" + mappedVersion + ") than what is found (" + + propertyValue + ") for the expression (" + expression + ") in the " + + "project (" + projectId + ")." ); + } + } + } + else + { + // the expression used to define the version of this artifact may be inherited + // TODO needs a better error message, what pom? what dependency? + throw new ReleaseFailureException( "The version could not be updated: " + rawVersion ); + } + } + } + else + { + // different/previous version not related to current release + } + } + else if ( resolvedSnapshotVersion != null ) + { + logInfo( result, " Updating " + artifactId + " to " + resolvedSnapshotVersion ); + + coordinate.setVersion( resolvedSnapshotVersion ); + } + else + { + // artifact not related to current release + } + } + } + + private void prepareScm( File pomFile, ReleaseDescriptor releaseDescriptor, ScmRepository repository, + ScmProvider provider ) + throws ReleaseExecutionException, ReleaseScmCommandException + { + try + { + if ( isUpdateScm() && ( releaseDescriptor.isScmUseEditMode() || provider.requiresEditMode() ) ) + { + EditScmResult result = provider.edit( repository, new ScmFileSet( + new File( releaseDescriptor.getWorkingDirectory() ), pomFile ) ); + + if ( !result.isSuccess() ) + { + throw new ReleaseScmCommandException( "Unable to enable editing on the POM", result ); + } + } + } + catch ( ScmException e ) + { + throw new ReleaseExecutionException( "An error occurred enabling edit mode: " + e.getMessage(), e ); + } + } + + + protected abstract String getResolvedSnapshotVersion( String artifactVersionlessKey, + ReleaseDescriptor releaseDscriptor ); + + protected abstract String getOriginalVersion( ReleaseDescriptor releaseDescriptor, String projectKey, + boolean simulate ); + + protected abstract String getNextVersion( ReleaseDescriptor releaseDescriptor, String key ); + + protected abstract void transformScm( MavenProject project, Model modelTarget, ReleaseDescriptor releaseDescriptor, + String projectId, ScmRepository scmRepository, + ReleaseResult result ) + throws ReleaseExecutionException; + + /** + * + * @return {@code true} if the SCM-section should be updated, otherwise {@code false} + * @since 2.4 + */ + protected boolean isUpdateScm() + { + return true; + } + + protected String getOriginalResolvedSnapshotVersion( String artifactVersionlessKey, + ReleaseDescriptor releaseDescriptor ) + { + return releaseDescriptor.getDependencyOriginalVersion( artifactVersionlessKey ); + } + + /** + * Determines the relative path from trunk to tag, and adds this relative path + * to the url. + * + * @param trunkPath - The trunk url + * @param tagPath - The tag base + * @param urlPath - scm.url or scm.connection + * @return The url path for the tag. + */ + protected static String translateUrlPath( String trunkPath, String tagPath, String urlPath ) + { + trunkPath = trunkPath.trim(); + tagPath = tagPath.trim(); + //Strip the slash at the end if one is present + if ( trunkPath.endsWith( "/" ) ) + { + trunkPath = trunkPath.substring( 0, trunkPath.length() - 1 ); + } + if ( tagPath.endsWith( "/" ) ) + { + tagPath = tagPath.substring( 0, tagPath.length() - 1 ); + } + char[] tagPathChars = trunkPath.toCharArray(); + char[] trunkPathChars = tagPath.toCharArray(); + // Find the common path between trunk and tags + int i = 0; + while ( ( i < tagPathChars.length ) && ( i < trunkPathChars.length ) && tagPathChars[i] == trunkPathChars[i] ) + { + ++i; + } + // If there is nothing common between trunk and tags, or the relative + // path does not exist in the url, then just return the tag. + if ( i == 0 || urlPath.indexOf( trunkPath.substring( i ) ) < 0 ) + { + return tagPath; + } + else + { + return StringUtils.replace( urlPath, trunkPath.substring( i ), tagPath.substring( i ) ); + } + } + + private Collection toMavenCoordinates( List objects ) + { + Collection coordinates = new ArrayList<>( objects.size() ); + for ( Object object : objects ) + { + if ( object instanceof MavenCoordinate ) + { + coordinates.add( (MavenCoordinate) object ); + } + else + { + throw new UnsupportedOperationException(); + } + } + return coordinates; + } + + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRunGoalsPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRunGoalsPhase.java new file mode 100644 index 000000000..23d4cce71 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRunGoalsPhase.java @@ -0,0 +1,139 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.exec.MavenExecutor; +import org.apache.maven.shared.release.exec.MavenExecutorException; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.util.StringUtils; + +/** + * Run the integration tests for the project to verify that it builds before committing. + * + * @author Brett Porter + */ +public abstract class AbstractRunGoalsPhase + extends AbstractReleasePhase +{ + /** + * Component to assist in executing Maven. + */ + @Requirement( role = MavenExecutor.class ) + private Map mavenExecutors; + + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + File workingDirectory, String additionalArguments ) + throws ReleaseExecutionException + { + ReleaseResult result = new ReleaseResult(); + + try + { + String goals = getGoals( releaseDescriptor ); + if ( !StringUtils.isEmpty( goals ) ) + { + logInfo( result, "Executing goals '" + goals + "'..." ); + + MavenExecutor mavenExecutor = mavenExecutors.get( releaseEnvironment.getMavenExecutorId() ); + + if ( mavenExecutor == null ) + { + throw new ReleaseExecutionException( + "Cannot find Maven executor with id: " + releaseEnvironment.getMavenExecutorId() ); + } + + File executionRoot; + String pomFileName; + if ( releaseDescriptor.getPomFileName() != null ) + { + File rootPom = new File( workingDirectory, releaseDescriptor.getPomFileName() ); + executionRoot = rootPom.getParentFile(); + pomFileName = rootPom.getName(); + } + else + { + executionRoot = workingDirectory; + pomFileName = null; + } + + mavenExecutor.executeGoals( executionRoot, goals, releaseEnvironment, + releaseDescriptor.isInteractive(), additionalArguments, + pomFileName, result ); + } + } + catch ( MavenExecutorException e ) + { + throw new ReleaseExecutionException( e.getMessage(), e ); + } + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + protected abstract String getGoals( ReleaseDescriptor releaseDescriptor ); + + protected String getAdditionalArguments( ReleaseDescriptor releaseDescriptor ) + { + StringBuilder builder = new StringBuilder(); + + if ( releaseDescriptor.getAdditionalArguments() != null ) + { + builder.append( releaseDescriptor.getAdditionalArguments() ); + } + + if ( !releaseDescriptor.getActivateProfiles().isEmpty() ) + { + builder.append( " -P " ) + .append( StringUtils.join( releaseDescriptor.getActivateProfiles().iterator(), "," ) ); + } + + return builder.length() > 0 ? builder.toString().trim() : null; + } + + /** + * Determines the path of the working directory. By default, this is the + * checkout directory. For some SCMs, the project root directory is not the + * checkout directory itself, but a SCM-specific subdirectory. + * + * @param checkoutDirectory The checkout directory as java.io.File + * @param relativePathProjectDirectory The relative path of the project directory within the checkout + * directory or "" + * @return The working directory + */ + protected File determineWorkingDirectory( File checkoutDirectory, String relativePathProjectDirectory ) + { + File workingDirectory = checkoutDirectory; + + if ( StringUtils.isNotEmpty( relativePathProjectDirectory ) ) + { + workingDirectory = new File( checkoutDirectory, relativePathProjectDirectory ); + } + + return workingDirectory; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhase.java new file mode 100644 index 000000000..3ae72acab --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhase.java @@ -0,0 +1,259 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmVersion; +import org.apache.maven.scm.command.checkin.CheckInScmResult; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator; +import org.apache.maven.shared.release.util.ReleaseUtil; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * Holds the basic concept of committing changes to the current working copy. + * + * @author Brett Porter + * @author Lars Corneliussen + */ +public abstract class AbstractScmCommitPhase + extends AbstractReleasePhase +{ + protected boolean beforeBranchOrTag = false; + + protected boolean afterBranchOrTag = false; + + /** + * Tool that gets a configured SCM repository from release configuration. + */ + protected ScmRepositoryConfigurator scmRepositoryConfigurator; + + /** + * The getter in the descriptor for the comment. + */ + protected String descriptorCommentGetter; + + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult relResult = new ReleaseResult(); + + validateConfiguration( releaseDescriptor ); + + runLogic( releaseDescriptor, releaseEnvironment, reactorProjects, relResult, false ); + + relResult.setResultCode( ReleaseResult.SUCCESS ); + + return relResult; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = new ReleaseResult(); + + validateConfiguration( releaseDescriptor ); + + runLogic( releaseDescriptor, releaseEnvironment, reactorProjects, result, true ); + + result.setResultCode( ReleaseResult.SUCCESS ); + return result; + } + + protected abstract void runLogic( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects, ReleaseResult result, boolean simulating ) + throws ReleaseScmCommandException, ReleaseExecutionException, ReleaseScmRepositoryException; + + protected void performCheckins( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects, String message ) + throws ReleaseScmRepositoryException, ReleaseExecutionException, ReleaseScmCommandException + { + + getLogger().info( "Checking in modified POMs..." ); + + ScmRepository repository; + ScmProvider provider; + try + { + repository = scmRepositoryConfigurator.getConfiguredRepository( releaseDescriptor, + releaseEnvironment.getSettings() ); + + repository.getProviderRepository().setPushChanges( releaseDescriptor.isPushChanges() ); + + repository.getProviderRepository().setWorkItem( releaseDescriptor.getWorkItem() ); + + provider = scmRepositoryConfigurator.getRepositoryProvider( repository ); + } + catch ( ScmRepositoryException e ) + { + throw new ReleaseScmRepositoryException( e.getMessage(), e.getValidationMessages() ); + } + catch ( NoSuchScmProviderException e ) + { + throw new ReleaseExecutionException( "Unable to configure SCM repository: " + e.getMessage(), e ); + } + + if ( releaseDescriptor.isCommitByProject() ) + { + for ( MavenProject project : reactorProjects ) + { + List pomFiles = createPomFiles( releaseDescriptor, project ); + ScmFileSet fileSet = new ScmFileSet( project.getFile().getParentFile(), pomFiles ); + + checkin( provider, repository, fileSet, releaseDescriptor, message ); + } + } + else + { + List pomFiles = createPomFiles( releaseDescriptor, reactorProjects ); + ScmFileSet fileSet = new ScmFileSet( new File( releaseDescriptor.getWorkingDirectory() ), pomFiles ); + + checkin( provider, repository, fileSet, releaseDescriptor, message ); + } + } + + private void checkin( ScmProvider provider, ScmRepository repository, ScmFileSet fileSet, + ReleaseDescriptor releaseDescriptor, String message ) + throws ReleaseExecutionException, ReleaseScmCommandException + { + CheckInScmResult result; + try + { + result = provider.checkIn( repository, fileSet, (ScmVersion) null, message ); + } + catch ( ScmException e ) + { + throw new ReleaseExecutionException( "An error is occurred in the checkin process: " + e.getMessage(), e ); + } + + if ( !result.isSuccess() ) + { + throw new ReleaseScmCommandException( "Unable to commit files", result ); + } + if ( releaseDescriptor.isRemoteTagging() ) + { + releaseDescriptor.setScmReleasedPomRevision( result.getScmRevision() ); + } + } + + protected void simulateCheckins( ReleaseDescriptor releaseDescriptor, List reactorProjects, + ReleaseResult result, String message ) + { + Collection pomFiles = createPomFiles( releaseDescriptor, reactorProjects ); + logInfo( result, "Full run would be commit " + pomFiles.size() + " files with message: '" + message + "'" ); + } + + protected void validateConfiguration( ReleaseDescriptor releaseDescriptor ) + throws ReleaseFailureException + { + if ( releaseDescriptor.getScmReleaseLabel() == null ) + { + throw new ReleaseFailureException( "A release label is required for committing" ); + } + } + + protected String createMessage( List reactorProjects, + ReleaseDescriptor releaseDescriptor ) + throws ReleaseExecutionException + { + String comment; + boolean branch = false; + if ( "getScmReleaseCommitComment".equals( descriptorCommentGetter ) ) + { + comment = releaseDescriptor.getScmReleaseCommitComment(); + } + else if ( "getScmDevelopmentCommitComment".equals( descriptorCommentGetter ) ) + { + comment = releaseDescriptor.getScmDevelopmentCommitComment(); + } + else if ( "getScmBranchCommitComment".equals( descriptorCommentGetter ) ) + { + comment = releaseDescriptor.getScmBranchCommitComment(); + branch = true; + } + else if ( "getScmRollbackCommitComment".equals( descriptorCommentGetter ) ) + { + comment = releaseDescriptor.getScmRollbackCommitComment(); + } + else + { + throw new ReleaseExecutionException( "Invalid configuration in components-fragment.xml" ); + } + + MavenProject project = ReleaseUtil.getRootProject( reactorProjects ); + comment = comment.replace( "@{prefix}", releaseDescriptor.getScmCommentPrefix().trim() ); + comment = comment.replace( "@{groupId}", project.getGroupId() ); + comment = comment.replace( "@{artifactId}", project.getArtifactId() ); + if ( branch ) + { + comment = comment.replace( "@{branchName}", releaseDescriptor.getScmReleaseLabel() ); + } + else + { + comment = comment.replace( "@{releaseLabel}", releaseDescriptor.getScmReleaseLabel() ); + } + return comment; + } + + protected static List createPomFiles( ReleaseDescriptor releaseDescriptor, MavenProject project ) + { + List pomFiles = new ArrayList<>(); + + pomFiles.add( ReleaseUtil.getStandardPom( project ) ); + + if ( releaseDescriptor.isGenerateReleasePoms() && !releaseDescriptor.isSuppressCommitBeforeTagOrBranch() ) + { + pomFiles.add( ReleaseUtil.getReleasePom( project ) ); + } + + return pomFiles; + } + + protected static List createPomFiles( ReleaseDescriptor releaseDescriptor, + List reactorProjects ) + { + List pomFiles = new ArrayList<>(); + for ( MavenProject project : reactorProjects ) + { + pomFiles.addAll( createPomFiles( releaseDescriptor, project ) ); + } + return pomFiles; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckCompletedPreparePhasesPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckCompletedPreparePhasesPhase.java new file mode 100644 index 000000000..5f78c76c4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckCompletedPreparePhasesPhase.java @@ -0,0 +1,86 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.codehaus.plexus.component.annotations.Component; + +/** + * @author Emmanuel Venisse + * @version $Id$ + */ +@Component( role = ReleasePhase.class, hint = "verify-completed-prepare-phases" ) +public class CheckCompletedPreparePhasesPhase + extends AbstractReleasePhase +{ + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, + ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = new ReleaseResult(); + + // if we stopped mid-way through preparation - don't perform + if ( releaseDescriptor.getCompletedPhase() != null + && !"end-release".equals( releaseDescriptor.getCompletedPhase() ) ) + { + String message = "Cannot perform release - the preparation step was stopped mid-way. Please re-run " + + "release:prepare to continue, or perform the release from an SCM tag."; + + result.setResultCode( ReleaseResult.ERROR ); + + logError( result, message ); + + throw new ReleaseFailureException( message ); + } + + if ( releaseDescriptor.getScmSourceUrl() == null ) + { + String message = "No SCM URL was provided to perform the release from"; + + result.setResultCode( ReleaseResult.ERROR ); + + logError( result, message ); + + throw new ReleaseFailureException( message ); + } + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, + ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + return execute( releaseDescriptor, releaseEnvironment, reactorProjects ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhase.java new file mode 100644 index 000000000..0dc4c817b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhase.java @@ -0,0 +1,535 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.versions.DefaultVersionInfo; +import org.apache.maven.shared.release.versions.VersionInfo; +import org.apache.maven.shared.release.versions.VersionParseException; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.components.interactivity.Prompter; +import org.codehaus.plexus.components.interactivity.PrompterException; + +/** + * Check the dependencies of all projects being released to see if there are any unreleased snapshots. + * + * @author Brett Porter + */ + // TODO plugins with no version will be resolved to RELEASE which is not a snapshot, but remains unresolved to this point. This is a potential hole in the check, and should be revisited after the release pom writing is done and resolving versions to verify whether it is. + // TODO plugins injected by the lifecycle are not tested here. They will be injected with a RELEASE version so are covered under the above point. +@Component( role = ReleasePhase.class, hint = "check-dependency-snapshots" ) +public class CheckDependencySnapshotsPhase + extends AbstractReleasePhase +{ + public static final String RESOLVE_SNAPSHOT_MESSAGE = "There are still some remaining snapshot dependencies.\n"; + + public static final String RESOLVE_SNAPSHOT_PROMPT = "Do you want to resolve them now?"; + + public static final String RESOLVE_SNAPSHOT_TYPE_MESSAGE = "Dependency type to resolve,"; + + public static final String RESOLVE_SNAPSHOT_TYPE_PROMPT = + "specify the selection number ( 0:All 1:Project Dependencies 2:Plugins 3:Reports 4:Extensions ):"; + + /** + * Component used to prompt for input. + */ + @Requirement + private Prompter prompter; + + // Be aware of the difference between usedSnapshots and specifiedSnapshots: + // UsedSnapshots end up on the classpath. + // SpecifiedSnapshots are defined anywhere in the pom. + // We'll probably need to introduce specifiedSnapshots as well. + // @TODO MRELEASE-378: verify custom dependencies in plugins. Be aware of deprecated/removed Components in M3, such as PluginCollector + // @TODO MRELEASE-763: verify all dependencies in inactive profiles + + // Don't prompt for every project in reactor, remember state of questions + private String resolveSnapshot; + + private String resolveSnapshotType; + + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = new ReleaseResult(); + + if ( !releaseDescriptor.isAllowTimestampedSnapshots() ) + { + logInfo( result, "Checking dependencies and plugins for snapshots ..." ); + + for ( MavenProject project : reactorProjects ) + { + checkProject( project, releaseDescriptor ); + } + } + else + { + logInfo( result, "Ignoring SNAPSHOT depenedencies and plugins ..." ); + } + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + private void checkProject( MavenProject project, ReleaseDescriptor releaseDescriptor ) + throws ReleaseFailureException, ReleaseExecutionException + { + Map artifactMap = ArtifactUtils.artifactMapByVersionlessId( project.getArtifacts() ); + + Set usedSnapshotDependencies = new HashSet<>(); + + if ( project.getParentArtifact() != null ) + { + if ( checkArtifact( project.getParentArtifact(), artifactMap, releaseDescriptor ) ) + { + usedSnapshotDependencies.add( project.getParentArtifact() ); + } + } + + Set dependencyArtifacts = project.getDependencyArtifacts(); + usedSnapshotDependencies.addAll( checkDependencies( releaseDescriptor, artifactMap, dependencyArtifacts ) ); + + //@todo check dependencyManagement + + Set pluginArtifacts = project.getPluginArtifacts(); + Set usedSnapshotPlugins = checkPlugins( releaseDescriptor, artifactMap, pluginArtifacts ); + + //@todo check pluginManagement + + Set reportArtifacts = project.getReportArtifacts(); + Set usedSnapshotReports = checkReports( releaseDescriptor, artifactMap, reportArtifacts ); + + Set extensionArtifacts = project.getExtensionArtifacts(); + Set usedSnapshotExtensions = checkExtensions( releaseDescriptor, artifactMap, extensionArtifacts ); + + //@todo check profiles + + if ( !usedSnapshotDependencies.isEmpty() || !usedSnapshotReports.isEmpty() + || !usedSnapshotExtensions.isEmpty() || !usedSnapshotPlugins.isEmpty() ) + { + if ( releaseDescriptor.isInteractive() || null != releaseDescriptor.getAutoResolveSnapshots() ) + { + resolveSnapshots( usedSnapshotDependencies, usedSnapshotReports, usedSnapshotExtensions, + usedSnapshotPlugins, releaseDescriptor ); + } + + if ( !usedSnapshotDependencies.isEmpty() || !usedSnapshotReports.isEmpty() + || !usedSnapshotExtensions.isEmpty() || !usedSnapshotPlugins.isEmpty() ) + { + StringBuilder message = new StringBuilder(); + + printSnapshotDependencies( usedSnapshotDependencies, message ); + printSnapshotDependencies( usedSnapshotReports, message ); + printSnapshotDependencies( usedSnapshotExtensions, message ); + printSnapshotDependencies( usedSnapshotPlugins, message ); + message.append( "in project '" + project.getName() + "' (" + project.getId() + ")" ); + + throw new ReleaseFailureException( + "Can't release project due to non released dependencies :\n" + message ); + } + } + } + + private Set checkPlugins( ReleaseDescriptor releaseDescriptor, + Map artifactMap, Set pluginArtifacts ) + throws ReleaseExecutionException + { + Set usedSnapshotPlugins = new HashSet<>(); + for ( Artifact artifact : pluginArtifacts ) + { + if ( checkArtifact( artifact, artifactMap, releaseDescriptor ) ) + { + boolean addToFailures; + + if ( "org.apache.maven.plugins".equals( artifact.getGroupId() ) && "maven-release-plugin".equals( + artifact.getArtifactId() ) ) + { + // It's a snapshot of the release plugin. Maybe just testing - ask + // By default, we fail as for any other plugin + if ( releaseDescriptor.isSnapshotReleasePluginAllowed() ) + { + addToFailures = false; + } + else if ( releaseDescriptor.isInteractive() ) + { + try + { + String result; + if ( !releaseDescriptor.isSnapshotReleasePluginAllowed() ) + { + prompter.showMessage( "This project relies on a SNAPSHOT of the release plugin. " + + "This may be necessary during testing.\n" ); + result = prompter.prompt( "Do you want to continue with the release?", + Arrays.asList( "yes", "no" ), "no" ); + } + else + { + result = "yes"; + } + + if ( result.toLowerCase( Locale.ENGLISH ).startsWith( "y" ) ) + { + addToFailures = false; + } + else + { + addToFailures = true; + } + } + catch ( PrompterException e ) + { + throw new ReleaseExecutionException( e.getMessage(), e ); + } + } + else + { + addToFailures = true; + } + } + else + { + addToFailures = true; + } + + if ( addToFailures ) + { + usedSnapshotPlugins.add( artifact ); + } + } + } + return usedSnapshotPlugins; + } + + private Set checkDependencies( ReleaseDescriptor releaseDescriptor, + Map artifactMap, + Set dependencyArtifacts ) + { + Set usedSnapshotDependencies = new HashSet<>(); + for ( Artifact artifact : dependencyArtifacts ) + { + if ( checkArtifact( artifact, artifactMap, releaseDescriptor ) ) + { + usedSnapshotDependencies.add( getArtifactFromMap( artifact, artifactMap ) ); + } + } + return usedSnapshotDependencies; + } + + private Set checkReports( ReleaseDescriptor releaseDescriptor, + Map artifactMap, Set reportArtifacts ) + { + Set usedSnapshotReports = new HashSet<>(); + for ( Artifact artifact : reportArtifacts ) + { + if ( checkArtifact( artifact, artifactMap, releaseDescriptor ) ) + { + //snapshotDependencies.add( artifact ); + usedSnapshotReports.add( artifact ); + } + } + return usedSnapshotReports; + } + + private Set checkExtensions( ReleaseDescriptor releaseDescriptor, + Map artifactMap, Set extensionArtifacts ) + { + Set usedSnapshotExtensions = new HashSet<>(); + for ( Artifact artifact : extensionArtifacts ) + { + if ( checkArtifact( artifact, artifactMap, releaseDescriptor ) ) + { + usedSnapshotExtensions.add( artifact ); + } + } + return usedSnapshotExtensions; + } + + private static boolean checkArtifact( Artifact artifact, + Map artifactMapByVersionlessId, + ReleaseDescriptor releaseDescriptor ) + { + Artifact checkArtifact = getArtifactFromMap( artifact, artifactMapByVersionlessId ); + + return checkArtifact( checkArtifact, releaseDescriptor ); + } + + private static Artifact getArtifactFromMap( Artifact artifact, Map artifactMapByVersionlessId ) + { + String versionlessId = ArtifactUtils.versionlessKey( artifact ); + Artifact checkArtifact = artifactMapByVersionlessId.get( versionlessId ); + + if ( checkArtifact == null ) + { + checkArtifact = artifact; + } + return checkArtifact; + } + + private static boolean checkArtifact( Artifact artifact, ReleaseDescriptor releaseDescriptor ) + { + String versionlessKey = ArtifactUtils.versionlessKey( artifact.getGroupId(), artifact.getArtifactId() ); + String releaseDescriptorResolvedVersion = releaseDescriptor.getDependencyReleaseVersion( versionlessKey ); + + boolean releaseDescriptorResolvedVersionIsSnapshot = releaseDescriptorResolvedVersion == null + || releaseDescriptorResolvedVersion.contains( Artifact.SNAPSHOT_VERSION ); + + // We are only looking at dependencies external to the project - ignore anything found in the reactor as + // it's version will be updated + boolean bannedVersion = artifact.isSnapshot() + && !artifact.getBaseVersion().equals( releaseDescriptor.getProjectOriginalVersion( versionlessKey ) ) + && releaseDescriptorResolvedVersionIsSnapshot; + + // If we have a snapshot but allowTimestampedSnapshots is true, accept the artifact if the version + // indicates that it is a timestamped snapshot. + if ( bannedVersion && releaseDescriptor.isAllowTimestampedSnapshots() ) + { + bannedVersion = artifact.getVersion().indexOf( Artifact.SNAPSHOT_VERSION ) >= 0; + } + + return bannedVersion; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + // It makes no modifications, so simulate is the same as execute + return execute( releaseDescriptor, releaseEnvironment, reactorProjects ); + } + + public void setPrompter( Prompter prompter ) + { + this.prompter = prompter; + } + + private StringBuilder printSnapshotDependencies( Set snapshotsSet, StringBuilder message ) + { + List snapshotsList = new ArrayList<>( snapshotsSet ); + + Collections.sort( snapshotsList ); + + for ( Artifact artifact : snapshotsList ) + { + message.append( " " ); + + message.append( artifact ); + + message.append( "\n" ); + } + + return message; + } + + private void resolveSnapshots( Set projectDependencies, Set reportDependencies, + Set extensionDependencies, Set pluginDependencies, + ReleaseDescriptor releaseDescriptor ) + throws ReleaseExecutionException + { + try + { + String autoResolveSnapshots = releaseDescriptor.getAutoResolveSnapshots(); + if ( resolveSnapshot == null ) + { + prompter.showMessage( RESOLVE_SNAPSHOT_MESSAGE ); + if ( autoResolveSnapshots != null ) + { + resolveSnapshot = "yes"; + prompter.showMessage( RESOLVE_SNAPSHOT_PROMPT + " " + resolveSnapshot ); + } + else + { + resolveSnapshot = prompter.prompt( RESOLVE_SNAPSHOT_PROMPT, Arrays.asList( "yes", "no" ), "no" ); + } + } + + if ( resolveSnapshot.toLowerCase( Locale.ENGLISH ).startsWith( "y" ) ) + { + if ( resolveSnapshotType == null ) + { + prompter.showMessage( RESOLVE_SNAPSHOT_TYPE_MESSAGE ); + int defaultAnswer = -1; + if ( autoResolveSnapshots != null ) + { + if ( "all".equalsIgnoreCase( autoResolveSnapshots ) ) + { + defaultAnswer = 0; + } + else if ( "dependencies".equalsIgnoreCase( autoResolveSnapshots ) ) + { + defaultAnswer = 1; + } + else if ( "plugins".equalsIgnoreCase( autoResolveSnapshots ) ) + { + defaultAnswer = 2; + } + else if ( "reports".equalsIgnoreCase( autoResolveSnapshots ) ) + { + defaultAnswer = 3; + } + else if ( "extensions".equalsIgnoreCase( autoResolveSnapshots ) ) + { + defaultAnswer = 4; + } + else + { + try + { + defaultAnswer = Integer.parseInt( autoResolveSnapshots ); + } + catch ( NumberFormatException e ) + { + throw new ReleaseExecutionException( e.getMessage(), e ); + } + } + } + if ( defaultAnswer >= 0 && defaultAnswer <= 4 ) + { + prompter.showMessage( RESOLVE_SNAPSHOT_TYPE_PROMPT + " " + autoResolveSnapshots ); + resolveSnapshotType = Integer.toString( defaultAnswer ); + } + else + { + resolveSnapshotType = + prompter.prompt( RESOLVE_SNAPSHOT_TYPE_PROMPT, Arrays.asList( "0", "1", "2", "3" ), "1" ); + } + } + + switch ( Integer.parseInt( resolveSnapshotType.toLowerCase( Locale.ENGLISH ) ) ) + { + // all + case 0: + processSnapshot( projectDependencies, releaseDescriptor, autoResolveSnapshots ); + processSnapshot( pluginDependencies, releaseDescriptor, autoResolveSnapshots ); + processSnapshot( reportDependencies, releaseDescriptor, autoResolveSnapshots ); + processSnapshot( extensionDependencies, releaseDescriptor, autoResolveSnapshots ); + break; + + // project dependencies + case 1: + processSnapshot( projectDependencies, releaseDescriptor, autoResolveSnapshots ); + break; + + // plugins + case 2: + processSnapshot( pluginDependencies, releaseDescriptor, autoResolveSnapshots ); + break; + + // reports + case 3: + processSnapshot( reportDependencies, releaseDescriptor, autoResolveSnapshots ); + break; + + // extensions + case 4: + processSnapshot( extensionDependencies, releaseDescriptor, autoResolveSnapshots ); + break; + + default: + } + } + } + catch ( PrompterException | VersionParseException e ) + { + throw new ReleaseExecutionException( e.getMessage(), e ); + } + } + + private void processSnapshot( Set snapshotSet, ReleaseDescriptor releaseDescriptor, + String autoResolveSnapshots ) + throws PrompterException, VersionParseException + { + Iterator iterator = snapshotSet.iterator(); + + while ( iterator.hasNext() ) + { + Artifact currentArtifact = iterator.next(); + String versionlessKey = ArtifactUtils.versionlessKey( currentArtifact ); + + VersionInfo versionInfo = new DefaultVersionInfo( currentArtifact.getBaseVersion() ); + releaseDescriptor.addDependencyOriginalVersion( versionlessKey, versionInfo.toString() ); + + prompter.showMessage( + "Dependency '" + versionlessKey + "' is a snapshot (" + currentArtifact.getVersion() + ")\n" ); + String message = "Which release version should it be set to?"; + String result; + if ( null != autoResolveSnapshots ) + { + result = versionInfo.getReleaseVersionString(); + prompter.showMessage( message + " " + result ); + } + else + { + result = prompter.prompt( message, versionInfo.getReleaseVersionString() ); + } + + releaseDescriptor.addDependencyReleaseVersion( versionlessKey, result ); + + iterator.remove(); + + // by default, keep the same version for the dependency after release, unless it was previously newer + // the user may opt to type in something different + VersionInfo nextVersionInfo = new DefaultVersionInfo( result ); + + String nextVersion; + if ( nextVersionInfo.compareTo( versionInfo ) > 0 ) + { + nextVersion = nextVersionInfo.toString(); + } + else + { + nextVersion = versionInfo.toString(); + } + + message = "What version should the dependency be reset to for development?"; + if ( null != autoResolveSnapshots ) + { + result = nextVersion; + prompter.showMessage( message + " " + result ); + } + else + { + result = prompter.prompt( message, nextVersion ); + } + + releaseDescriptor.addDependencyDevelopmentVersion( versionlessKey, result ); + } + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckPomPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckPomPhase.java new file mode 100644 index 000000000..128721fd8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckPomPhase.java @@ -0,0 +1,120 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator; +import org.codehaus.plexus.util.StringUtils; + +import java.util.List; + +/** + * Phase that checks the validity of the POM before release. + * + * @author Brett Porter + */ +public class CheckPomPhase + extends AbstractReleasePhase +{ + + /** + * @since 2.4 + */ + private boolean scmRequired = true; + + /** + * @since 2.5.2 + */ + private boolean snapshotsRequired = true; + + private ScmRepositoryConfigurator scmRepositoryConfigurator; + + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = new ReleaseResult(); + + // Currently, we don't deal with multiple SCM locations in a multiproject + if ( scmRequired ) + { + if ( StringUtils.isEmpty( releaseDescriptor.getScmSourceUrl() ) ) + { + throw new ReleaseFailureException( + "Missing required setting: scm connection or developerConnection must be specified." ); + } + + try + { + scmRepositoryConfigurator.getConfiguredRepository( releaseDescriptor, + releaseEnvironment.getSettings() ); + } + catch ( ScmRepositoryException e ) + { + throw new ReleaseScmRepositoryException( e.getMessage(), e.getValidationMessages() ); + } + catch ( NoSuchScmProviderException e ) + { + throw new ReleaseFailureException( + "The provider given in the SCM URL could not be found: " + e.getMessage() ); + } + } + + boolean containsSnapshotProjects = false; + + for ( MavenProject project : reactorProjects ) + { + if ( ArtifactUtils.isSnapshot( project.getVersion() ) ) + { + containsSnapshotProjects = true; + + break; + } + } + + if ( snapshotsRequired && !containsSnapshotProjects && !releaseDescriptor.isBranchCreation() ) + { + throw new ReleaseFailureException( "You don't have a SNAPSHOT project in the reactor projects list." ); + } + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + // It makes no modifications, so simulate is the same as execute + return execute( releaseDescriptor, releaseEnvironment, reactorProjects ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScm.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScm.java new file mode 100644 index 000000000..17bc3f467 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScm.java @@ -0,0 +1,275 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.nio.file.LinkOption; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.CommandParameter; +import org.apache.maven.scm.CommandParameters; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmTag; +import org.apache.maven.scm.command.checkout.CheckOutScmResult; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.StringUtils; + +/** + * @author Emmanuel Venisse + * @version $Id$ + */ +@Component( role = ReleasePhase.class, hint = "checkout-project-from-scm" ) +public class CheckoutProjectFromScm + extends AbstractReleasePhase +{ + /** + * Tool that gets a configured SCM repository from release configuration. + */ + @Requirement + private ScmRepositoryConfigurator scmRepositoryConfigurator; + + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult releaseResult = null; + + if ( releaseDescriptor.isLocalCheckout() ) + { + // in the release phase we have to change the checkout URL + // to do a local checkout instead of going over the network. + + // the first step is a bit tricky, we need to know which provider! like e.g. "scm:jgit:http://" + // the offset of 4 is because 'scm:' has 4 characters... + String providerPart = releaseDescriptor.getScmSourceUrl() + .substring( 0, releaseDescriptor.getScmSourceUrl().indexOf( ':', 4 ) ); + + String scmPath = releaseDescriptor.getWorkingDirectory(); + + // now we iteratively try to checkout. + // if the local checkout fails, then we might be in a subdirectory + // and need to walk a few directories up. + do + { + try + { + if ( scmPath.startsWith( "/" ) ) + { + // cut off the first '/' + scmPath = scmPath.substring( 1 ); + } + + String scmUrl = providerPart + ":file:///" + scmPath; + releaseDescriptor.setScmSourceUrl( scmUrl ); + getLogger().info( "Performing a LOCAL checkout from " + releaseDescriptor.getScmSourceUrl() ); + + releaseResult = performCheckout( releaseDescriptor, releaseEnvironment, reactorProjects ); + } + catch ( ScmException scmEx ) + { + // the checkout from _this_ directory failed + releaseResult = null; + } + + if ( releaseResult == null || releaseResult.getResultCode() == ReleaseResult.ERROR ) + { + // this means that there is no SCM repo in this directory + // thus we try to step one directory up + releaseResult = null; + + // remove last sub-directory path + int lastSlashPos = scmPath.lastIndexOf( File.separator ); + if ( lastSlashPos > 0 ) + { + scmPath = scmPath.substring( 0, lastSlashPos ); + } + else + { + throw new ReleaseExecutionException( "could not perform a local checkout" ); + } + } + } + while ( releaseResult == null ); + } + else + { + // when there is no localCheckout, then we just do a standard SCM checkout. + try + { + releaseResult = performCheckout( releaseDescriptor, releaseEnvironment, reactorProjects ); + } + catch ( ScmException e ) + { + releaseResult = new ReleaseResult(); + releaseResult.setResultCode( ReleaseResult.ERROR ); + logError( releaseResult, e.getMessage() ); + + throw new ReleaseExecutionException( "An error is occurred in the checkout process: " + + e.getMessage(), e ); + } + + } + + return releaseResult; + } + + + private ReleaseResult performCheckout( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException, ScmException + { + ReleaseResult result = new ReleaseResult(); + + logInfo( result, "Checking out the project to perform the release ..." ); + + ScmRepository repository; + ScmProvider provider; + + try + { + repository = scmRepositoryConfigurator.getConfiguredRepository( releaseDescriptor, + releaseEnvironment.getSettings() ); + + provider = scmRepositoryConfigurator.getRepositoryProvider( repository ); + } + catch ( ScmRepositoryException e ) + { + result.setResultCode( ReleaseResult.ERROR ); + logError( result, e.getMessage() ); + + throw new ReleaseScmRepositoryException( e.getMessage(), e.getValidationMessages() ); + } + catch ( NoSuchScmProviderException e ) + { + result.setResultCode( ReleaseResult.ERROR ); + logError( result, e.getMessage() ); + + throw new ReleaseExecutionException( "Unable to configure SCM repository: " + e.getMessage(), e ); + } + + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + + // TODO: sanity check that it is not . or .. or lower + File checkoutDirectory = + FileUtils.resolveFile( rootProject.getBasedir(), releaseDescriptor.getCheckoutDirectory() ); + + if ( checkoutDirectory.exists() ) + { + try + { + FileUtils.deleteDirectory( checkoutDirectory ); + } + catch ( IOException e ) + { + result.setResultCode( ReleaseResult.ERROR ); + logError( result, e.getMessage() ); + + throw new ReleaseExecutionException( "Unable to remove old checkout directory: " + e.getMessage(), e ); + } + } + + checkoutDirectory.mkdirs(); + + CommandParameters commandParameters = new CommandParameters(); + commandParameters.setString( CommandParameter.SHALLOW, Boolean.TRUE.toString() ); + + CheckOutScmResult scmResult = provider.checkOut( repository, new ScmFileSet( checkoutDirectory ), + new ScmTag( releaseDescriptor.getScmReleaseLabel() ), commandParameters ); + + if ( releaseDescriptor.isLocalCheckout() && !scmResult.isSuccess() ) + { + // this is not beautiful but needed to indicate that the execute() method + // should continue in the parent directory + return null; + } + + String scmRelativePathProjectDirectory = scmResult.getRelativePathProjectDirectory(); + if ( StringUtils.isEmpty( scmRelativePathProjectDirectory ) ) + { + Path workingDirectory = Paths.get( releaseDescriptor.getWorkingDirectory() ); + + Path rootProjectBasedir; + try + { + rootProjectBasedir = rootProject.getBasedir().toPath().toRealPath( LinkOption.NOFOLLOW_LINKS ); + } + catch ( IOException e ) + { + throw new ReleaseExecutionException( e.getMessage(), e ); + } + + scmRelativePathProjectDirectory = workingDirectory.relativize( rootProjectBasedir ).toString(); + } + releaseDescriptor.setScmRelativePathProjectDirectory( scmRelativePathProjectDirectory ); + + if ( !scmResult.isSuccess() ) + { + result.setResultCode( ReleaseResult.ERROR ); + logError( result, scmResult.getProviderMessage() ); + + throw new ReleaseScmCommandException( "Unable to checkout from SCM", scmResult ); + } + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = new ReleaseResult(); + + if ( releaseDescriptor.isLocalCheckout() ) + { + logInfo( result, "This would be a LOCAL check out to perform the release ..." ); + } + else + { + logInfo( result, "The project would be checked out to perform the release ..." ); + } + + result.setResultCode( ReleaseResult.SUCCESS ); + return result; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CreateBackupPomsPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CreateBackupPomsPhase.java new file mode 100644 index 000000000..bf07fd629 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CreateBackupPomsPhase.java @@ -0,0 +1,100 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.util.FileUtils; + +/** + * @author Edwin Punzalan + */ +@Component( role = ReleasePhase.class, hint = "create-backup-poms" ) +public class CreateBackupPomsPhase + extends AbstractBackupPomsPhase implements ResourceGenerator +{ + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = new ReleaseResult(); + + // remove previous backups, if any + clean( reactorProjects ); + + for ( MavenProject project : reactorProjects ) + { + createPomBackup( project ); + } + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + @Override + public ReleaseResult clean( List reactorProjects ) + { + ReleaseResult result = new ReleaseResult(); + + for ( MavenProject project : reactorProjects ) + { + deletePomBackup( project ); + } + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + return execute( releaseDescriptor, releaseEnvironment, reactorProjects ); + } + + private void createPomBackup( MavenProject project ) + throws ReleaseExecutionException + { + // delete any existing backup first + deletePomBackup( project ); + + try + { + FileUtils.copyFile( ReleaseUtil.getStandardPom( project ), getPomBackup( project ) ); + } + catch ( IOException e ) + { + throw new ReleaseExecutionException( "Error creating backup POM: " + e.getMessage(), e ); + } + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/EndReleasePhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/EndReleasePhase.java new file mode 100644 index 000000000..123c0a35f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/EndReleasePhase.java @@ -0,0 +1,68 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.codehaus.plexus.component.annotations.Component; + +import java.util.List; + +/** + * Finalise release preparation so it can be flagged complete.. + * + * @author Brett Porter + */ +@Component( role = ReleasePhase.class, hint = "end-release" ) +public class EndReleasePhase + extends AbstractReleasePhase +{ + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = new ReleaseResult(); + + logInfo( result, "Release preparation complete." ); + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = new ReleaseResult(); + + logInfo( result, "Release preparation simulation complete." ); + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhase.java new file mode 100644 index 000000000..7b6004f89 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhase.java @@ -0,0 +1,700 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.IOException; +import java.io.Writer; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.model.Build; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.Extension; +import org.apache.maven.model.Model; +import org.apache.maven.model.Plugin; +import org.apache.maven.model.Profile; +import org.apache.maven.model.ReportPlugin; +import org.apache.maven.model.Reporting; +import org.apache.maven.model.Resource; +import org.apache.maven.model.Scm; +import org.apache.maven.model.building.DefaultModelBuildingRequest; +import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.interpolation.ModelInterpolator; +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; +import org.apache.maven.model.superpom.SuperPomProvider; +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.command.add.AddScmResult; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.scm.ScmTranslator; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.util.WriterFactory; + +/** + * Generate release POMs. + * + * @author Brett Porter + * @author Mark Hobson + */ +@Component( role = ReleasePhase.class, hint = "generate-release-poms" ) +public class GenerateReleasePomsPhase + extends AbstractReleasePomsPhase implements ResourceGenerator +{ + private static final String FINALNAME_EXPRESSION = "${project.artifactId}-${project.version}"; + + @Requirement + private SuperPomProvider superPomProvider; + + @Requirement + private ModelInterpolator modelInterpolator; + + /** + * SCM URL translators mapped by provider name. + */ + @Requirement( role = ScmTranslator.class ) + private Map scmTranslators; + + /* + * @see org.apache.maven.shared.release.phase.ReleasePhase#execute(org.apache.maven.shared.release.config.ReleaseDescriptor, + * org.apache.maven.settings.Settings, java.util.List) + */ + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + return execute( releaseDescriptor, releaseEnvironment, reactorProjects, false ); + } + + private ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects, boolean simulate ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = new ReleaseResult(); + + if ( releaseDescriptor.isGenerateReleasePoms() ) + { + logInfo( result, "Generating release POMs..." ); + + generateReleasePoms( releaseDescriptor, releaseEnvironment, reactorProjects, simulate, result ); + } + else + { + logInfo( result, "Not generating release POMs" ); + } + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + private void generateReleasePoms( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects, boolean simulate, ReleaseResult result ) + throws ReleaseExecutionException, ReleaseFailureException + { + List releasePoms = new ArrayList<>(); + + for ( MavenProject project : reactorProjects ) + { + logInfo( result, "Generating release POM for '" + project.getName() + "'..." ); + + releasePoms.add( generateReleasePom( project, releaseDescriptor, releaseEnvironment, reactorProjects, + simulate, result ) ); + } + + addReleasePomsToScm( releaseDescriptor, releaseEnvironment, reactorProjects, simulate, result, releasePoms ); + } + + private File generateReleasePom( MavenProject project, ReleaseDescriptor releaseDescriptor, + ReleaseEnvironment releaseEnvironment, List reactorProjects, + boolean simulate, ReleaseResult result ) + throws ReleaseExecutionException, ReleaseFailureException + { + // create release pom + + Model releasePom = createReleaseModel( project, releaseDescriptor, releaseEnvironment, reactorProjects, + result ); + + // write release pom to file + + MavenXpp3Writer pomWriter = new MavenXpp3Writer(); + + File releasePomFile = ReleaseUtil.getReleasePom( project ); + + // MRELEASE-273 : A release pom can be null + if ( releasePomFile == null ) + { + throw new ReleaseExecutionException( "Cannot generate release POM : pom file is null" ); + } + + + + try ( Writer fileWriter = WriterFactory.newXmlWriter( releasePomFile ) ) + { + pomWriter.write( fileWriter, releasePom ); + } + catch ( IOException exception ) + { + throw new ReleaseExecutionException( "Cannot generate release POM", exception ); + } + + return releasePomFile; + } + + private void addReleasePomsToScm( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects, boolean simulate, ReleaseResult result, + List releasePoms ) + throws ReleaseFailureException, ReleaseExecutionException + { + if ( simulate ) + { + logInfo( result, "Full run would be adding " + releasePoms ); + } + else + { + ScmRepository scmRepository = getScmRepository( releaseDescriptor, releaseEnvironment ); + ScmProvider scmProvider = getScmProvider( scmRepository ); + + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + ScmFileSet scmFileSet = new ScmFileSet( rootProject.getFile().getParentFile(), releasePoms ); + + try + { + AddScmResult scmResult = scmProvider.add( scmRepository, scmFileSet ); + + if ( !scmResult.isSuccess() ) + { + throw new ReleaseScmCommandException( "Cannot add release POM to SCM", scmResult ); + } + } + catch ( ScmException exception ) + { + throw new ReleaseExecutionException( "Cannot add release POM to SCM: " + exception.getMessage(), + exception ); + } + } + } + + private Model createReleaseModel( MavenProject project, ReleaseDescriptor releaseDescriptor, + ReleaseEnvironment releaseEnvironment, List reactorProjects, + ReleaseResult result ) + throws ReleaseFailureException, ReleaseExecutionException + { + MavenProject releaseProject = project.clone(); + Model releaseModel = releaseProject.getModel(); + + // the release POM should reflect bits of these which were injected at build time... + // we don't need these polluting the POM. + releaseModel.setParent( null ); + releaseModel.setProfiles( Collections.emptyList() ); + releaseModel.setDependencyManagement( null ); + releaseProject.getBuild().setPluginManagement( null ); + + // update project version + String projectVersion = releaseModel.getVersion(); + String releaseVersion = + getNextVersion( releaseDescriptor, project.getGroupId(), project.getArtifactId(), projectVersion ); + releaseModel.setVersion( releaseVersion ); + + String originalFinalName = releaseModel.getBuild().getFinalName(); + // update final name if implicit + if ( !FINALNAME_EXPRESSION.equals( originalFinalName ) ) + { + originalFinalName = findOriginalFinalName( project ); + + if ( originalFinalName == null ) + { + // as defined in super-pom + originalFinalName = FINALNAME_EXPRESSION; + } + } + + // make finalName always explicit + String finalName = ReleaseUtil.interpolate( originalFinalName, releaseModel ); + + // still required? + if ( finalName.indexOf( Artifact.SNAPSHOT_VERSION ) != -1 ) + { + throw new ReleaseFailureException( "Cannot reliably adjust the finalName of project: " + + releaseProject.getId() ); + } + releaseModel.getBuild().setFinalName( finalName ); + + + // update scm + Scm scm = releaseModel.getScm(); + + if ( scm != null ) + { + ScmRepository scmRepository = getScmRepository( releaseDescriptor, releaseEnvironment ); + ScmTranslator scmTranslator = getScmTranslator( scmRepository ); + + if ( scmTranslator != null ) + { + releaseModel.setScm( createReleaseScm( releaseModel.getScm(), scmTranslator, releaseDescriptor ) ); + } + else + { + String message = "No SCM translator found - skipping rewrite"; + + result.appendDebug( message ); + + getLogger().debug( message ); + } + } + + // rewrite dependencies + releaseModel.setDependencies( createReleaseDependencies( releaseDescriptor, releaseProject ) ); + + // rewrite plugins + releaseModel.getBuild().setPlugins( createReleasePlugins( releaseDescriptor, releaseProject ) ); + + // rewrite reports + releaseModel.getReporting().setPlugins( createReleaseReportPlugins( releaseDescriptor, + releaseProject ) ); + + // rewrite extensions + releaseModel.getBuild().setExtensions( createReleaseExtensions( releaseDescriptor, + releaseProject ) ); + + unalignFromBaseDirectory( releaseModel, project.getBasedir() ); + + return releaseModel; + } + + + private void unalignFromBaseDirectory( Model releaseModel, File basedir ) + { + Model rawSuperModel = superPomProvider.getSuperModel( releaseModel.getModelVersion() ); + + ModelBuildingRequest buildingRequest = new DefaultModelBuildingRequest(); + buildingRequest.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_STRICT ); + + // inject proper values used by project.build.finalName + Properties properties = new Properties(); + properties.put( "project.version", releaseModel.getVersion() ); + properties.put( "project.artifactId", releaseModel.getArtifactId() ); + buildingRequest.setUserProperties( properties ); + + Model interpolatedSuperModel = + modelInterpolator.interpolateModel( rawSuperModel.clone(), basedir, buildingRequest, null ); + + Build currentBuild = releaseModel.getBuild(); + Build interpolatedSuperBuild = interpolatedSuperModel.getBuild(); + Build rawSuperBuild = rawSuperModel.getBuild(); + + currentBuild.setSourceDirectory( resolvePath( basedir.toPath(), currentBuild.getSourceDirectory(), + interpolatedSuperBuild.getSourceDirectory(), + rawSuperBuild.getSourceDirectory() ) ); + currentBuild.setScriptSourceDirectory( resolvePath( basedir.toPath(), currentBuild.getScriptSourceDirectory(), + interpolatedSuperBuild.getScriptSourceDirectory(), + rawSuperBuild.getScriptSourceDirectory() ) ); + currentBuild.setTestSourceDirectory( resolvePath( basedir.toPath(), currentBuild.getTestSourceDirectory(), + interpolatedSuperBuild.getTestSourceDirectory(), + rawSuperBuild.getTestSourceDirectory() ) ); + currentBuild.setOutputDirectory( resolvePath( basedir.toPath(), currentBuild.getOutputDirectory(), + interpolatedSuperBuild.getOutputDirectory(), + rawSuperBuild.getOutputDirectory() ) ); + currentBuild.setTestOutputDirectory( resolvePath( basedir.toPath(), currentBuild.getTestOutputDirectory(), + interpolatedSuperBuild.getTestOutputDirectory(), + rawSuperBuild.getTestOutputDirectory() ) ); + currentBuild.setDirectory( resolvePath( basedir.toPath(), currentBuild.getDirectory(), + interpolatedSuperBuild.getDirectory(), + rawSuperBuild.getDirectory() ) ); + + for ( Resource currentResource : currentBuild.getResources() ) + { + Map superResourceDirectories = + new LinkedHashMap<>( interpolatedSuperBuild.getResources().size() ); + for ( int i = 0; i < interpolatedSuperBuild.getResources().size(); i++ ) + { + superResourceDirectories.put( interpolatedSuperBuild.getResources().get( i ).getDirectory(), + rawSuperBuild.getResources().get( i ).getDirectory() ); + } + currentResource.setDirectory( resolvePath( basedir.toPath(), currentResource.getDirectory(), + superResourceDirectories ) ); + } + + for ( Resource currentResource : currentBuild.getTestResources() ) + { + Map superResourceDirectories = + new LinkedHashMap<>( interpolatedSuperBuild.getTestResources().size() ); + for ( int i = 0; i < interpolatedSuperBuild.getTestResources().size(); i++ ) + { + superResourceDirectories.put( interpolatedSuperBuild.getTestResources().get( i ).getDirectory(), + rawSuperBuild.getTestResources().get( i ).getDirectory() ); + } + currentResource.setDirectory( resolvePath( basedir.toPath(), currentResource.getDirectory(), + superResourceDirectories ) ); + } + + + + releaseModel.getReporting().setOutputDirectory( resolvePath( basedir.toPath(), + releaseModel.getReporting().getOutputDirectory(), + interpolatedSuperModel.getReporting().getOutputDirectory(), + rawSuperModel.getReporting().getOutputDirectory() ) ); + } + + private String resolvePath( Path basedir, String current, String superInterpolated, String superRaw ) + { + return basedir.resolve( current ).equals( basedir.resolve( superInterpolated ) ) ? superRaw : current; + } + + private String resolvePath( Path basedir, + String current, + Map superValues ) + { + for ( Map.Entry superValue : superValues.entrySet() ) + { + if ( basedir.resolve( current ).equals( basedir.resolve( superValue.getKey() ) ) ) + { + return superValue.getValue(); + } + } + return current; + } + + private String findOriginalFinalName( MavenProject project ) + { + if ( project.getOriginalModel().getBuild() != null + && project.getOriginalModel().getBuild().getFinalName() != null ) + { + return project.getOriginalModel().getBuild().getFinalName(); + } + else if ( project.hasParent() ) + { + return findOriginalFinalName( project.getParent() ); + } + else + { + return null; + } + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + return execute( releaseDescriptor, releaseEnvironment, reactorProjects, true ); + } + + private String getNextVersion( ReleaseDescriptor releaseDescriptor, String groupId, String artifactId, + String version ) + throws ReleaseFailureException + { + // TODO: share with RewritePomsForReleasePhase.rewriteVersion + + String id = ArtifactUtils.versionlessKey( groupId, artifactId ); + + String nextVersion = releaseDescriptor.getProjectReleaseVersion( id ); + + if ( nextVersion == null ) + { + throw new ReleaseFailureException( "Version for '" + id + "' was not mapped" ); + } + + return nextVersion; + } + + private ScmTranslator getScmTranslator( ScmRepository scmRepository ) + { + return scmTranslators.get( scmRepository.getProvider() ); + } + + private Scm createReleaseScm( Scm scm, ScmTranslator scmTranslator, ReleaseDescriptor releaseDescriptor ) + { + // TODO: share with RewritePomsForReleasePhase.translateScm + + String tag = releaseDescriptor.getScmReleaseLabel(); + String tagBase = releaseDescriptor.getScmTagBase(); + + Scm releaseScm = new Scm(); + + if ( scm.getConnection() != null ) + { + String value = scmTranslator.translateTagUrl( scm.getConnection(), tag, tagBase ); + releaseScm.setConnection( value ); + } + + if ( scm.getDeveloperConnection() != null ) + { + String value = scmTranslator.translateTagUrl( scm.getDeveloperConnection(), tag, tagBase ); + releaseScm.setDeveloperConnection( value ); + } + + if ( scm.getUrl() != null ) + { + String value = scmTranslator.translateTagUrl( scm.getUrl(), tag, tagBase ); + releaseScm.setUrl( value ); + } + + if ( scm.getTag() != null ) + { + String value = scmTranslator.resolveTag( scm.getTag() ); + releaseScm.setTag( value ); + } + + return releaseScm; + } + + private List createReleaseDependencies( ReleaseDescriptor releaseDescriptor, + MavenProject project ) + throws ReleaseFailureException + { + Set artifacts = project.getArtifacts(); + + List releaseDependencies = null; + + if ( artifacts != null ) + { + // make dependency order deterministic for tests (related to MNG-1412) + List orderedArtifacts = new ArrayList<>(); + orderedArtifacts.addAll( artifacts ); + Collections.sort( orderedArtifacts ); + + releaseDependencies = new ArrayList<>(); + + for ( Artifact artifact : orderedArtifacts ) + { + Dependency releaseDependency = new Dependency(); + + releaseDependency.setGroupId( artifact.getGroupId() ); + releaseDependency.setArtifactId( artifact.getArtifactId() ); + + String version = getReleaseVersion( releaseDescriptor, artifact ); + + releaseDependency.setVersion( version ); + releaseDependency.setType( artifact.getType() ); + releaseDependency.setScope( artifact.getScope() ); + releaseDependency.setClassifier( artifact.getClassifier() ); + + releaseDependencies.add( releaseDependency ); + } + } + + return releaseDependencies; + } + + private String getReleaseVersion( ReleaseDescriptor releaseDescriptor, + Artifact artifact ) + throws ReleaseFailureException + { + String key = ArtifactUtils.versionlessKey( artifact ); + + String originalVersion = releaseDescriptor.getProjectOriginalVersion( key ); + String mappedVersion = releaseDescriptor.getProjectReleaseVersion( key ); + + String version = artifact.getVersion(); + + if ( version.equals( originalVersion ) ) + { + if ( mappedVersion != null ) + { + version = mappedVersion; + } + else + { + throw new ReleaseFailureException( "Version '" + version + "' for '" + key + "' was not mapped" ); + } + } + else + { + if ( !ArtifactUtils.isSnapshot( version ) ) + { + version = artifact.getBaseVersion(); + } + } + + return version; + } + + private List createReleasePlugins( ReleaseDescriptor releaseDescriptor, + MavenProject project ) + throws ReleaseFailureException + { + List releasePlugins = null; + + // Use original - don't want the lifecycle introduced ones + Build build = project.getOriginalModel().getBuild(); + + if ( build != null ) + { + List plugins = build.getPlugins(); + + if ( plugins != null ) + { + Map artifactsById = project.getPluginArtifactMap(); + + releasePlugins = new ArrayList<>(); + + for ( Plugin plugin : plugins ) + { + String id = ArtifactUtils.versionlessKey( plugin.getGroupId(), plugin.getArtifactId() ); + Artifact artifact = artifactsById.get( id ); + String version = getReleaseVersion( releaseDescriptor, artifact ); + + Plugin releasePlugin = new Plugin(); + releasePlugin.setGroupId( plugin.getGroupId() ); + releasePlugin.setArtifactId( plugin.getArtifactId() ); + releasePlugin.setVersion( version ); + if ( plugin.getExtensions() != null ) + { + releasePlugin.setExtensions( plugin.isExtensions() ); + } + releasePlugin.setExecutions( plugin.getExecutions() ); + releasePlugin.setDependencies( plugin.getDependencies() ); + releasePlugin.setGoals( plugin.getGoals() ); + releasePlugin.setInherited( plugin.getInherited() ); + releasePlugin.setConfiguration( plugin.getConfiguration() ); + + releasePlugins.add( releasePlugin ); + } + } + } + + return releasePlugins; + } + + private List createReleaseReportPlugins( ReleaseDescriptor releaseDescriptor, + MavenProject project ) + throws ReleaseFailureException + { + List releaseReportPlugins = null; + + Reporting reporting = project.getModel().getReporting(); + + if ( reporting != null ) + { + List reportPlugins = reporting.getPlugins(); + + if ( reportPlugins != null ) + { + Map artifactsById = project.getReportArtifactMap(); + + releaseReportPlugins = new ArrayList<>(); + + for ( ReportPlugin reportPlugin : reportPlugins ) + { + String id = ArtifactUtils.versionlessKey( reportPlugin.getGroupId(), reportPlugin.getArtifactId() ); + Artifact artifact = artifactsById.get( id ); + String version = getReleaseVersion( releaseDescriptor, artifact ); + + ReportPlugin releaseReportPlugin = new ReportPlugin(); + releaseReportPlugin.setGroupId( reportPlugin.getGroupId() ); + releaseReportPlugin.setArtifactId( reportPlugin.getArtifactId() ); + releaseReportPlugin.setVersion( version ); + releaseReportPlugin.setInherited( reportPlugin.getInherited() ); + releaseReportPlugin.setConfiguration( reportPlugin.getConfiguration() ); + releaseReportPlugin.setReportSets( reportPlugin.getReportSets() ); + + releaseReportPlugins.add( releaseReportPlugin ); + } + } + } + + return releaseReportPlugins; + } + + private List createReleaseExtensions( ReleaseDescriptor releaseDescriptor, + MavenProject project ) + throws ReleaseFailureException + { + List releaseExtensions = null; + + // Use original - don't want the lifecycle introduced ones + Build build = project.getOriginalModel().getBuild(); + + if ( build != null ) + { + List extensions = build.getExtensions(); + + if ( extensions != null ) + { + releaseExtensions = new ArrayList<>(); + + for ( Extension extension : extensions ) + { + String id = ArtifactUtils.versionlessKey( extension.getGroupId(), extension.getArtifactId() ); + Artifact artifact = project.getExtensionArtifactMap().get( id ); + String version = getReleaseVersion( releaseDescriptor, artifact ); + + Extension releaseExtension = new Extension(); + releaseExtension.setGroupId( extension.getGroupId() ); + releaseExtension.setArtifactId( extension.getArtifactId() ); + releaseExtension.setVersion( version ); + + releaseExtensions.add( releaseExtension ); + } + } + } + + return releaseExtensions; + } + + /* + * @see org.apache.maven.shared.release.phase.AbstractReleasePhase#clean(java.util.List) + */ + @Override + public ReleaseResult clean( List reactorProjects ) + { + ReleaseResult result = new ReleaseResult(); + + for ( MavenProject project : reactorProjects ) + { + File releasePom = ReleaseUtil.getReleasePom( project ); + + // MRELEASE-273 : A release pom can be null + if ( releasePom != null && releasePom.exists() ) + { + logInfo( result, "Deleting release POM for '" + project.getName() + "'..." ); + + if ( !releasePom.delete() ) + { + logWarn( result, "Cannot delete release POM: " + releasePom ); + } + } + } + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/InputVariablesPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/InputVariablesPhase.java new file mode 100644 index 000000000..c155e3c46 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/InputVariablesPhase.java @@ -0,0 +1,286 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.Properties; + +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.policy.PolicyException; +import org.apache.maven.shared.release.policy.naming.NamingPolicy; +import org.apache.maven.shared.release.policy.naming.NamingPolicyRequest; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.components.interactivity.Prompter; +import org.codehaus.plexus.components.interactivity.PrompterException; +import org.codehaus.plexus.interpolation.InterpolationException; +import org.codehaus.plexus.interpolation.Interpolator; +import org.codehaus.plexus.interpolation.PrefixAwareRecursionInterceptor; +import org.codehaus.plexus.interpolation.PrefixedPropertiesValueSource; +import org.codehaus.plexus.interpolation.RecursionInterceptor; +import org.codehaus.plexus.interpolation.StringSearchInterpolator; +import org.codehaus.plexus.util.StringUtils; + +/** + * Input any variables that were not yet configured. + * + * @author Brett Porter + */ +public class InputVariablesPhase + extends AbstractReleasePhase +{ + /** + * Component used to prompt for input. + */ + @Requirement + private Prompter prompter; + + /** + * Whether this is a branch or a tag operation. + */ + private boolean branchOperation; + + /** + * Tool that gets a configured SCM repository from release configuration. + */ + @Requirement + private ScmRepositoryConfigurator scmRepositoryConfigurator; + + /** + * Component used for custom or default naming policy + */ + @Requirement + private Map namingPolicies; + + /** + * The default naming policy to apply, if any + */ + private String defaultNamingPolicy; + + void setPrompter( Prompter prompter ) + { + this.prompter = prompter; + } + + boolean isBranchOperation() + { + return branchOperation; + } + + protected ScmProvider getScmProvider( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment ) + throws ReleaseScmRepositoryException, ReleaseExecutionException + { + try + { + ScmRepository repository = + scmRepositoryConfigurator.getConfiguredRepository( releaseDescriptor, + releaseEnvironment.getSettings() ); + + return scmRepositoryConfigurator.getRepositoryProvider( repository ); + } + catch ( ScmRepositoryException e ) + { + throw new ReleaseScmRepositoryException( + e.getMessage() + " for URL: " + releaseDescriptor.getScmSourceUrl(), e.getValidationMessages() ); + } + catch ( NoSuchScmProviderException e ) + { + throw new ReleaseExecutionException( "Unable to configure SCM repository: " + e.getMessage(), e ); + } + } + + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException + { + ReleaseResult result = new ReleaseResult(); + + // get the root project + MavenProject project = ReleaseUtil.getRootProject( reactorProjects ); + + String tag = releaseDescriptor.getScmReleaseLabel(); + + if ( tag == null ) + { + // Must get default version from mapped versions, as the project will be the incorrect snapshot + String key = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ); + String releaseVersion = releaseDescriptor.getProjectReleaseVersion( key ); + if ( releaseVersion == null ) + { + throw new ReleaseExecutionException( "Project tag cannot be selected if version is not yet mapped" ); + } + + String suggestedName; + String scmTagNameFormat = releaseDescriptor.getScmTagNameFormat(); + if ( releaseDescriptor.getProjectNamingPolicyId() != null ) + { + try + { + suggestedName = + resolveSuggestedName( releaseDescriptor.getProjectNamingPolicyId(), releaseVersion, project ); + } + catch ( PolicyException e ) + { + throw new ReleaseExecutionException( e.getMessage(), e ); + } + } + else if ( scmTagNameFormat != null ) + { + Interpolator interpolator = new StringSearchInterpolator( "@{", "}" ); + List possiblePrefixes = java.util.Arrays.asList( "project", "pom" ); + Properties values = new Properties(); + values.setProperty( "artifactId", project.getArtifactId() ); + values.setProperty( "groupId", project.getGroupId() ); + values.setProperty( "version", releaseVersion ); + interpolator.addValueSource( new PrefixedPropertiesValueSource( possiblePrefixes, values, true ) ); + RecursionInterceptor recursionInterceptor = new PrefixAwareRecursionInterceptor( possiblePrefixes ); + try + { + suggestedName = interpolator.interpolate( scmTagNameFormat, recursionInterceptor ); + } + catch ( InterpolationException e ) + { + throw new ReleaseExecutionException( + "Could not interpolate specified tag name format: " + scmTagNameFormat, e ); + } + } + else + { + try + { + suggestedName = resolveSuggestedName( defaultNamingPolicy, releaseVersion, project ); + } + catch ( PolicyException e ) + { + throw new ReleaseExecutionException( e.getMessage(), e ); + } + } + + ScmProvider provider = null; + try + { + provider = getScmProvider( releaseDescriptor, releaseEnvironment ); + } + catch ( ReleaseScmRepositoryException e ) + { + throw new ReleaseExecutionException( + "No scm provider can be found for url: " + releaseDescriptor.getScmSourceUrl(), e ); + } + + suggestedName = provider.sanitizeTagName( suggestedName ); + + if ( releaseDescriptor.isInteractive() ) + { + try + { + if ( branchOperation ) + { + tag = prompter.prompt( "What is the branch name for \"" + project.getName() + "\"? (" + + project.getGroupId() + ":" + project.getArtifactId() + ")" ); + if ( StringUtils.isEmpty( tag ) ) + { + throw new ReleaseExecutionException( "No branch name was given." ); + } + } + else + { + tag = prompter.prompt( "What is the SCM release tag or label for \"" + project.getName() + + "\"? (" + project.getGroupId() + ":" + project.getArtifactId() + ")", suggestedName ); + } + } + catch ( PrompterException e ) + { + throw new ReleaseExecutionException( "Error reading version from input handler: " + e.getMessage(), + e ); + } + } + else if ( suggestedName == null ) + { + if ( isBranchOperation() ) + { + throw new ReleaseExecutionException( "No branch name was given." ); + } + else + { + throw new ReleaseExecutionException( "No tag name was given." ); + } + } + else + { + tag = suggestedName; + } + releaseDescriptor.setScmReleaseLabel( tag ); + } + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException + { + ReleaseResult result = new ReleaseResult(); + + // It makes no modifications, so simulate is the same as execute + execute( releaseDescriptor, releaseEnvironment, reactorProjects ); + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + private String resolveSuggestedName( String policyId, String version, MavenProject project ) + throws PolicyException + { + if ( policyId == null ) + { + return null; + } + + NamingPolicy policy = namingPolicies.get( policyId ); + if ( policy == null ) + { + throw new PolicyException( "Policy '" + policyId + "' is unknown, available: " + + namingPolicies.keySet() ); + } + + NamingPolicyRequest request = new NamingPolicyRequest() + .setGroupId( project.getGroupId() ) + .setArtifactId( project.getArtifactId() ) + .setVersion( version ); + return policy.getName( request ).getName(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/MapVersionsPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/MapVersionsPhase.java new file mode 100644 index 000000000..68d2e7ab1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/MapVersionsPhase.java @@ -0,0 +1,396 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.MessageFormat; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.ResourceBundle; + +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.policy.PolicyException; +import org.apache.maven.shared.release.policy.version.VersionPolicy; +import org.apache.maven.shared.release.policy.version.VersionPolicyRequest; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.apache.maven.shared.release.versions.VersionParseException; +import org.codehaus.plexus.components.interactivity.Prompter; +import org.codehaus.plexus.components.interactivity.PrompterException; +import org.codehaus.plexus.util.StringUtils; + +/** + * Map projects to their new versions after release / into the next development cycle. + * + * The map-phases per goal are: + *
+ *
release:prepare
map-release-versions + map-development-versions; RD.isBranchCreation() = false
+ *
release:branch
map-branch-versions + map-development-versions; RD.isBranchCreation() = true
+ *
release:update-versions
map-development-versions; RD.isBranchCreation() = false
+ *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + *
MapVersionsPhase
MapVersionsPhase fieldmap-release-versionsmap-branch-versionsmap-development-versions
convertToSnapshot false true true
convertToBranch false true false
+ * + * @author Brett Porter + * @author Robert Scholte + */ +public class MapVersionsPhase + extends AbstractReleasePhase +{ + private ResourceBundle resourceBundle; + + /** + * Whether to convert to a snapshot or a release. + */ + private boolean convertToSnapshot; + + /** + * Whether to convert to a snapshot or a release. + */ + private boolean convertToBranch; + + /** + * Component used to prompt for input. + */ + private Prompter prompter; + + + /** + * Component used for custom or default version policy + */ + private Map versionPolicies; + + void setPrompter( Prompter prompter ) + { + this.prompter = prompter; + } + + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException + { + ReleaseResult result = new ReleaseResult(); + + resourceBundle = getResourceBundle( releaseEnvironment.getLocale() ); + + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + + if ( releaseDescriptor.isAutoVersionSubmodules() && ArtifactUtils.isSnapshot( rootProject.getVersion() ) ) + { + // get the root project + MavenProject project = rootProject; + + String projectId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ); + + String nextVersion = resolveNextVersion( project, projectId, releaseDescriptor, result ); + + if ( !convertToSnapshot ) + { + releaseDescriptor.addReleaseVersion( projectId, nextVersion ); + } + else if ( releaseDescriptor.isBranchCreation() && convertToBranch ) + { + releaseDescriptor.addReleaseVersion( projectId, nextVersion ); + } + else + { + releaseDescriptor.addDevelopmentVersion( projectId, nextVersion ); + } + + for ( MavenProject subProject : reactorProjects ) + { + String subProjectId = + ArtifactUtils.versionlessKey( subProject.getGroupId(), subProject.getArtifactId() ); + + if ( convertToSnapshot ) + { + String v; + if ( ArtifactUtils.isSnapshot( subProject.getVersion() ) ) + { + v = nextVersion; + } + else + { + v = subProject.getVersion(); + } + + if ( releaseDescriptor.isBranchCreation() && convertToBranch ) + { + releaseDescriptor.addReleaseVersion( subProjectId, v ); + } + else + { + releaseDescriptor.addDevelopmentVersion( subProjectId, v ); + } + } + else + { + releaseDescriptor.addReleaseVersion( subProjectId, nextVersion ); + } + } + } + else + { + for ( MavenProject project : reactorProjects ) + { + String projectId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ); + + String nextVersion = resolveNextVersion( project, projectId, releaseDescriptor, result ); + + if ( !convertToSnapshot ) + { + releaseDescriptor.addReleaseVersion( projectId, nextVersion ); + } + else if ( releaseDescriptor.isBranchCreation() && convertToBranch ) + { + releaseDescriptor.addReleaseVersion( projectId, nextVersion ); + } + else + { + releaseDescriptor.addDevelopmentVersion( projectId, nextVersion ); + } + } + } + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + private String resolveNextVersion( MavenProject project, + String projectId, + ReleaseDescriptor releaseDescriptor, + ReleaseResult result ) + throws ReleaseExecutionException + { + String defaultVersion; + if ( convertToBranch ) + { + // no branch modification + if ( !( releaseDescriptor.isUpdateBranchVersions() + && ( ArtifactUtils.isSnapshot( project.getVersion() ) + || releaseDescriptor.isUpdateVersionsToSnapshot() ) ) ) + { + return project.getVersion(); + } + + defaultVersion = getReleaseVersion( projectId, releaseDescriptor ); + } + else if ( !convertToSnapshot ) // map-release-version + { + defaultVersion = getReleaseVersion( projectId, releaseDescriptor ); + } + else if ( releaseDescriptor.isBranchCreation() ) + { + // no working copy modification + if ( !( ArtifactUtils.isSnapshot( project.getVersion() ) + && releaseDescriptor.isUpdateWorkingCopyVersions() ) ) + { + return project.getVersion(); + } + + defaultVersion = getDevelopmentVersion( projectId, releaseDescriptor ); + } + else + { + // no working copy modification + if ( !( releaseDescriptor.isUpdateWorkingCopyVersions() ) ) + { + return project.getVersion(); + } + + defaultVersion = getDevelopmentVersion( projectId, releaseDescriptor ); + } + //@todo validate default version, maybe with DefaultArtifactVersion + + String suggestedVersion = null; + String nextVersion = defaultVersion; + String messageKey = null; + try + { + while ( nextVersion == null || ArtifactUtils.isSnapshot( nextVersion ) != convertToSnapshot ) + { + if ( suggestedVersion == null ) + { + String baseVersion = null; + if ( convertToSnapshot ) + { + baseVersion = getReleaseVersion( projectId, releaseDescriptor ); + } + // unspecified and unmapped version, so use project version + if ( baseVersion == null ) + { + baseVersion = project.getVersion(); + } + + try + { + try + { + suggestedVersion = + resolveSuggestedVersion( baseVersion, releaseDescriptor.getProjectVersionPolicyId() ); + } + catch ( VersionParseException e ) + { + if ( releaseDescriptor.isInteractive() ) + { + suggestedVersion = + resolveSuggestedVersion( "1.0", releaseDescriptor.getProjectVersionPolicyId() ); + } + else + { + throw new ReleaseExecutionException( "Error parsing version, cannot determine next " + + "version: " + e.getMessage(), e ); + } + } + } + catch ( PolicyException | VersionParseException e ) + { + throw new ReleaseExecutionException( e.getMessage(), e ); + } + } + + if ( releaseDescriptor.isInteractive() ) + { + if ( messageKey == null ) + { + messageKey = getMapversionPromptKey( releaseDescriptor ); + } + String message = + MessageFormat.format( resourceBundle.getString( messageKey ), project.getName(), projectId ); + nextVersion = prompter.prompt( message, suggestedVersion ); + + //@todo validate next version, maybe with DefaultArtifactVersion + } + else if ( defaultVersion == null ) + { + nextVersion = suggestedVersion; + } + else if ( convertToSnapshot ) + { + throw new ReleaseExecutionException( defaultVersion + " is invalid, expected a snapshot" ); + } + else + { + throw new ReleaseExecutionException( defaultVersion + " is invalid, expected a non-snapshot" ); + } + } + } + catch ( PrompterException e ) + { + throw new ReleaseExecutionException( "Error reading version from input handler: " + e.getMessage(), e ); + } + return nextVersion; + } + + private String resolveSuggestedVersion( String baseVersion, String policyId ) + throws PolicyException, VersionParseException + { + VersionPolicy policy = versionPolicies.get( policyId ); + if ( policy == null ) + { + throw new PolicyException( "Policy '" + policyId + "' is unknown, available: " + versionPolicies.keySet() ); + } + + VersionPolicyRequest request = new VersionPolicyRequest().setVersion( baseVersion ); + return convertToSnapshot ? policy.getDevelopmentVersion( request ).getVersion() + : policy.getReleaseVersion( request ).getVersion(); + } + + private String getDevelopmentVersion( String projectId, ReleaseDescriptor releaseDescriptor ) + { + String defaultVersion = releaseDescriptor.getDefaultDevelopmentVersion(); + if ( StringUtils.isEmpty( defaultVersion ) ) + { + defaultVersion = releaseDescriptor.getProjectDevelopmentVersion( projectId ); + } + return defaultVersion; + } + + private String getReleaseVersion( String projectId, ReleaseDescriptor releaseDescriptor ) + { + String nextVersion = releaseDescriptor.getDefaultReleaseVersion(); + if ( StringUtils.isEmpty( nextVersion ) ) + { + nextVersion = releaseDescriptor.getProjectReleaseVersion( projectId ); + } + return nextVersion; + } + + + private String getMapversionPromptKey( ReleaseDescriptor releaseDescriptor ) + { + String messageKey; + if ( convertToBranch ) + { + messageKey = "mapversion.branch.prompt"; + } + else if ( !convertToSnapshot ) + { + messageKey = "mapversion.release.prompt"; + } + else if ( releaseDescriptor.isBranchCreation() ) + { + messageKey = "mapversion.workingcopy.prompt"; + } + else + { + messageKey = "mapversion.development.prompt"; + } + return messageKey; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException + { + ReleaseResult result = new ReleaseResult(); + + // It makes no modifications, so simulate is the same as execute + execute( releaseDescriptor, releaseEnvironment, reactorProjects ); + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + private ResourceBundle getResourceBundle( Locale locale ) + { + return ResourceBundle.getBundle( "release-messages", locale, MapVersionsPhase.class.getClassLoader() ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RemoveReleasePomsPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RemoveReleasePomsPhase.java new file mode 100644 index 000000000..e3f0cabaa --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RemoveReleasePomsPhase.java @@ -0,0 +1,157 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.project.MavenProject; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.command.remove.RemoveScmResult; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.component.annotations.Component; + +/** + * Remove release POMs. + * + * @author Brett Porter + * @author Mark Hobson + */ +@Component( role = ReleasePhase.class, hint = "remove-release-poms" ) +public class RemoveReleasePomsPhase + extends AbstractReleasePomsPhase +{ + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseFailureException, ReleaseExecutionException + { + return execute( releaseDescriptor, releaseEnvironment, reactorProjects, false ); + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseFailureException, ReleaseExecutionException + { + return execute( releaseDescriptor, releaseEnvironment, reactorProjects, true ); + } + + private ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects, boolean simulate ) + throws ReleaseFailureException, ReleaseExecutionException + { + ReleaseResult result = new ReleaseResult(); + + if ( releaseDescriptor.isGenerateReleasePoms() ) + { + removeReleasePoms( releaseDescriptor, releaseEnvironment, simulate, result, reactorProjects ); + } + else + { + logInfo( result, "Not removing release POMs" ); + } + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + private void removeReleasePoms( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + boolean simulate, ReleaseResult result, List projects ) + throws ReleaseFailureException, ReleaseExecutionException + { + List releasePoms = new ArrayList<>(); + + for ( MavenProject project : projects ) + { + logInfo( result, "Removing release POM for '" + project.getName() + "'..." ); + + releasePoms.add( ReleaseUtil.getReleasePom( project ) ); + } + + if ( releaseDescriptor.isSuppressCommitBeforeTagOrBranch() ) + { + removeReleasePomsFromFilesystem( simulate, result, releasePoms ); + } + else + { + removeReleasePomsFromScm( releaseDescriptor, releaseEnvironment, simulate, result, releasePoms ); + } + } + + private void removeReleasePomsFromFilesystem( boolean simulate, ReleaseResult result, List releasePoms ) + { + if ( simulate ) + { + logInfo( result, "Full run would be removing " + releasePoms ); + } + else + { + for ( File releasePom : releasePoms ) + { + releasePom.delete(); + } + } + } + + private void removeReleasePomsFromScm( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + boolean simulate, ReleaseResult result, List releasePoms ) + throws ReleaseFailureException, ReleaseExecutionException + { + if ( simulate ) + { + logInfo( result, "Full run would be removing " + releasePoms ); + } + else + { + ScmRepository scmRepository = getScmRepository( releaseDescriptor, releaseEnvironment ); + ScmProvider scmProvider = getScmProvider( scmRepository ); + + ScmFileSet scmFileSet = new ScmFileSet( new File( releaseDescriptor.getWorkingDirectory() ), releasePoms ); + + try + { + RemoveScmResult scmResult = + scmProvider.remove( scmRepository, scmFileSet, "Removing for next development iteration." ); + + if ( !scmResult.isSuccess() ) + { + throw new ReleaseScmCommandException( "Cannot remove release POMs from SCM", scmResult ); + } + } + catch ( ScmException exception ) + { + throw new ReleaseExecutionException( "Cannot remove release POMs from SCM: " + exception.getMessage(), + exception ); + } + } + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RemoveScmTagPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RemoveScmTagPhase.java new file mode 100644 index 000000000..25e031496 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RemoveScmTagPhase.java @@ -0,0 +1,160 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.codehaus.plexus.component.annotations.Component; + +import java.util.List; +import org.apache.maven.scm.CommandParameter; +import org.apache.maven.scm.CommandParameters; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.command.untag.UntagScmResult; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.component.annotations.Requirement; + +/** + * Remove tag from SCM repository during rollback + */ +@Component( role = ReleasePhase.class, hint = "remove-scm-tag" ) +public class RemoveScmTagPhase + extends AbstractReleasePhase +{ + /** + * Tool that gets a configured SCM repository from release configuration. + */ + @Requirement + private ScmRepositoryConfigurator scmRepositoryConfigurator; + + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult releaseResult = new ReleaseResult(); + + validateConfiguration( releaseDescriptor ); + + logInfo( releaseResult, "Removing tag with the label " + releaseDescriptor.getScmReleaseLabel() + " ..." ); + + ReleaseDescriptor basedirAlignedReleaseDescriptor = + ReleaseUtil.createBasedirAlignedReleaseDescriptor( releaseDescriptor, reactorProjects ); + + ScmRepository repository; + ScmProvider provider; + try + { + repository = + scmRepositoryConfigurator.getConfiguredRepository( basedirAlignedReleaseDescriptor.getScmSourceUrl(), + releaseDescriptor, + releaseEnvironment.getSettings() ); + + repository.getProviderRepository().setPushChanges( releaseDescriptor.isPushChanges() ); + + repository.getProviderRepository().setWorkItem( releaseDescriptor.getWorkItem() ); + + provider = scmRepositoryConfigurator.getRepositoryProvider( repository ); + } + catch ( ScmRepositoryException e ) + { + throw new ReleaseScmRepositoryException( e.getMessage(), e.getValidationMessages() ); + } + catch ( NoSuchScmProviderException e ) + { + throw new ReleaseExecutionException( "Unable to configure SCM repository: " + e.getMessage(), e ); + } + + UntagScmResult untagScmResult; + try + { + ScmFileSet fileSet = new ScmFileSet( new File( basedirAlignedReleaseDescriptor.getWorkingDirectory() ) ); + String tagName = releaseDescriptor.getScmReleaseLabel(); + String message = releaseDescriptor.getScmCommentPrefix() + "remove tag " + tagName; + CommandParameters commandParameters = new CommandParameters(); + commandParameters.setString( CommandParameter.TAG_NAME, tagName ); + commandParameters.setString( CommandParameter.MESSAGE, message ); + if ( getLogger().isDebugEnabled() ) + { + getLogger().debug( + "RemoveScmTagPhase :: scmUntagParameters tagName " + tagName ); + getLogger().debug( + "RemoveScmTagPhase :: scmUntagParameters message " + message ); + getLogger().debug( + "RemoveScmTagPhase :: fileSet " + fileSet ); + } + untagScmResult = provider.untag( repository, fileSet, commandParameters ); + } + catch ( ScmException e ) + { + throw new ReleaseExecutionException( "An error has occurred in the remove tag process: " + + e.getMessage(), e ); + } + + if ( !untagScmResult.isSuccess() ) + { + getLogger().warn( String.format( "Unable to remove tag%nProvider message: %s%nCommand output: %s", + untagScmResult.getProviderMessage(), untagScmResult.getCommandOutput() ) ); + } + + releaseResult.setResultCode( ReleaseResult.SUCCESS ); + + return releaseResult; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult releaseResult = new ReleaseResult(); + + validateConfiguration( releaseDescriptor ); + + logInfo( releaseResult, "Full run would remove tag with label: '" + releaseDescriptor.getScmReleaseLabel() + + "'" ); + + releaseResult.setResultCode( ReleaseResult.SUCCESS ); + + return releaseResult; + } + + private void validateConfiguration( ReleaseDescriptor releaseDescriptor ) + throws ReleaseFailureException + { + if ( releaseDescriptor.getScmReleaseLabel() == null ) + { + throw new ReleaseFailureException( "A release label is required for removal" ); + } + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RestoreBackupPomsPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RestoreBackupPomsPhase.java new file mode 100644 index 000000000..f746eedda --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RestoreBackupPomsPhase.java @@ -0,0 +1,143 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.command.edit.EditScmResult; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.util.FileUtils; + +import java.io.File; +import java.io.IOException; +import java.util.List; + +/** + * @author Edwin Punzalan + */ +@Component( role = ReleasePhase.class, hint = "restore-backup-poms" ) +public class RestoreBackupPomsPhase + extends AbstractBackupPomsPhase +{ + /** + * Tool that gets a configured SCM repository from release configuration. + */ + @Requirement + private ScmRepositoryConfigurator scmRepositoryConfigurator; + + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = new ReleaseResult(); + + for ( MavenProject project : reactorProjects ) + { + restorePomBackup( releaseDescriptor, releaseEnvironment, project ); + } + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + return execute( releaseDescriptor, releaseEnvironment, reactorProjects ); + } + + protected void restorePomBackup( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + MavenProject project ) + throws ReleaseExecutionException, ReleaseFailureException + { + File pomBackup = getPomBackup( project ); + + if ( !pomBackup.exists() ) + { + throw new ReleaseExecutionException( + "Cannot restore from a missing backup POM: " + pomBackup.getAbsolutePath() ); + } + + try + { + ScmRepository scmRepository; + ScmProvider provider; + try + { + scmRepository = + scmRepositoryConfigurator.getConfiguredRepository( releaseDescriptor, + releaseEnvironment.getSettings() ); + + provider = scmRepositoryConfigurator.getRepositoryProvider( scmRepository ); + } + catch ( ScmRepositoryException e ) + { + throw new ReleaseScmRepositoryException( e.getMessage(), e.getValidationMessages() ); + } + catch ( NoSuchScmProviderException e ) + { + throw new ReleaseExecutionException( "Unable to configure SCM repository: " + e.getMessage(), e ); + } + + if ( releaseDescriptor.isScmUseEditMode() || provider.requiresEditMode() ) + { + EditScmResult result = provider.edit( scmRepository, new ScmFileSet( + new File( releaseDescriptor.getWorkingDirectory() ), project.getFile() ) ); + + if ( !result.isSuccess() ) + { + throw new ReleaseScmCommandException( "Unable to enable editing on the POM", result ); + } + } + } + catch ( ScmException e ) + { + throw new ReleaseExecutionException( "An error occurred enabling edit mode: " + e.getMessage(), e ); + } + + try + { + FileUtils.copyFile( getPomBackup( project ), ReleaseUtil.getStandardPom( project ) ); + } + catch ( IOException e ) + { + throw new ReleaseExecutionException( "Error restoring from backup POM: " + e.getMessage(), e ); + } + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomVersionsPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomVersionsPhase.java new file mode 100644 index 000000000..95d06db68 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomVersionsPhase.java @@ -0,0 +1,78 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.MavenProject; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.codehaus.plexus.component.annotations.Component; + +/** + * Rewrite POMs for future development + * + * @author Brett Porter + */ +@Component( role = ReleasePhase.class, hint = "rewrite-pom-versions" ) +public class RewritePomVersionsPhase + extends AbstractRewritePomsPhase +{ + @Override + protected final String getPomSuffix() + { + return "next"; + } + + @Override + protected void transformScm( MavenProject project, Model modelTarget, ReleaseDescriptor releaseDescriptor, + String projectId, ScmRepository scmRepository, ReleaseResult result ) + throws ReleaseExecutionException + { + // We are only updating versions no mods to scm needed + } + + @Override + protected boolean isUpdateScm() + { + return false; + } + + @Override + protected String getOriginalVersion( ReleaseDescriptor releaseDescriptor, String projectKey, boolean simulate ) + { + return releaseDescriptor.getProjectOriginalVersion( projectKey ); + } + + @Override + protected String getNextVersion( ReleaseDescriptor releaseDescriptor, String key ) + { + return releaseDescriptor.getProjectDevelopmentVersion( key ); + } + + @Override + protected String getResolvedSnapshotVersion( String artifactVersionlessKey, + ReleaseDescriptor resolvedSnapshotsMap ) + { + // Only update the pom version, not the dependency versions + return null; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhase.java new file mode 100644 index 000000000..82e61b407 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhase.java @@ -0,0 +1,257 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.nio.file.LinkOption; +import java.nio.file.Path; +import java.nio.file.Paths; + +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.model.Model; +import org.apache.maven.model.Scm; +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.scm.ScmTranslator; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.component.annotations.Component; + +/** + * Rewrite POMs for branch. + * + * @author Emmanuel Venisse + * @version $Id$ + */ +@Component( role = ReleasePhase.class, hint = "rewrite-poms-for-branch" ) +public class RewritePomsForBranchPhase + extends AbstractRewritePomsPhase +{ + @Override + protected final String getPomSuffix() + { + return "branch"; + } + + @Override + protected void transformScm( MavenProject project, Model modelTarget, ReleaseDescriptor releaseDescriptor, + String projectId, ScmRepository scmRepository, ReleaseResult result ) + throws ReleaseExecutionException + { + // If SCM is null in original model, it is inherited, no mods needed + if ( project.getScm() != null ) + { + Scm scmRoot = modelTarget.getScm(); + + if ( scmRoot != null ) + { + try + { + translateScm( project, releaseDescriptor, scmRoot, scmRepository, result ); + } + catch ( IOException e ) + { + throw new ReleaseExecutionException( e.getMessage(), e ); + } + } + else + { + MavenProject parent = project.getParent(); + if ( parent != null ) + { + // If the SCM element is not present, only add it if the parent was not mapped (ie, it's external to + // the release process and so has not been modified, so the values will not be correct on the tag), + String parentId = ArtifactUtils.versionlessKey( parent.getGroupId(), parent.getArtifactId() ); + if ( releaseDescriptor.getOriginalScmInfo( parentId ) == null ) + { + // we need to add it, since it has changed from the inherited value + scmRoot = new Scm(); + // reset default value (HEAD) + scmRoot.setTag( null ); + + try + { + if ( translateScm( project, releaseDescriptor, scmRoot, scmRepository, result ) ) + { + modelTarget.setScm( scmRoot ); + } + } + catch ( IOException e ) + { + throw new ReleaseExecutionException( e.getMessage(), e ); + } + } + } + } + } + } + + private boolean translateScm( MavenProject project, ReleaseDescriptor releaseDescriptor, Scm scmTarget, + ScmRepository scmRepository, ReleaseResult relResult ) + throws IOException + { + ScmTranslator translator = getScmTranslators().get( scmRepository.getProvider() ); + boolean result = false; + if ( translator != null ) + { + Scm scm = project.getOriginalModel().getScm(); + if ( scm == null ) + { + scm = project.getScm(); + } + + String branchName = releaseDescriptor.getScmReleaseLabel(); + String branchBase = releaseDescriptor.getScmBranchBase(); + + // TODO: svn utils should take care of prepending this + if ( branchBase != null ) + { + branchBase = "scm:svn:" + branchBase; + } + + Path projectBasedir = project.getBasedir().toPath().toRealPath( LinkOption.NOFOLLOW_LINKS ); + Path workingDirectory = Paths.get( releaseDescriptor.getWorkingDirectory() ); + + int count = ReleaseUtil.getBaseWorkingDirectoryParentCount( workingDirectory, projectBasedir ); + + if ( scm.getConnection() != null ) + { + String rootUrl = ReleaseUtil.realignScmUrl( count, scm.getConnection() ); + + String subDirectoryBranch = scm.getConnection().substring( rootUrl.length() ); + if ( !subDirectoryBranch.startsWith( "/" ) ) + { + subDirectoryBranch = "/" + subDirectoryBranch; + } + + String scmConnectionBranch = branchBase; + if ( scmConnectionBranch != null ) + { + String trunkUrl = scm.getDeveloperConnection(); + if ( trunkUrl == null ) + { + trunkUrl = scm.getConnection(); + } + scmConnectionBranch = translateUrlPath( trunkUrl, branchBase, scm.getConnection() ); + } + + String value = + translator.translateBranchUrl( scm.getConnection(), branchName + subDirectoryBranch, + scmConnectionBranch ); + if ( !value.equals( scm.getConnection() ) ) + { + scmTarget.setConnection( value ); + result = true; + } + } + + if ( scm.getDeveloperConnection() != null ) + { + String rootUrl = ReleaseUtil.realignScmUrl( count, scm.getDeveloperConnection() ); + + String subDirectoryBranch = scm.getDeveloperConnection().substring( rootUrl.length() ); + if ( !subDirectoryBranch.startsWith( "/" ) ) + { + subDirectoryBranch = "/" + subDirectoryBranch; + } + + String value = + translator.translateBranchUrl( scm.getDeveloperConnection(), branchName + subDirectoryBranch, + branchBase ); + if ( !value.equals( scm.getDeveloperConnection() ) ) + { + scmTarget.setDeveloperConnection( value ); + result = true; + } + } + + if ( scm.getUrl() != null ) + { + String rootUrl = ReleaseUtil.realignScmUrl( count, scm.getUrl() ); + + String subDirectoryBranch = scm.getUrl().substring( rootUrl.length() ); + if ( !subDirectoryBranch.startsWith( "/" ) ) + { + subDirectoryBranch = "/" + subDirectoryBranch; + } + + String tagScmUrl = branchBase; + if ( tagScmUrl != null ) + { + String trunkUrl = scm.getDeveloperConnection(); + if ( trunkUrl == null ) + { + trunkUrl = scm.getConnection(); + } + tagScmUrl = translateUrlPath( trunkUrl, branchBase, scm.getUrl() ); + } + + // use original branch base without protocol + String value = translator.translateBranchUrl( scm.getUrl(), branchName + subDirectoryBranch, + tagScmUrl ); + if ( !value.equals( scm.getUrl() ) ) + { + scmTarget.setUrl( value ); + result = true; + } + } + + if ( branchName != null ) + { + String value = translator.resolveTag( branchName ); + if ( value != null && !value.equals( scm.getTag() ) ) + { + scmTarget.setTag( value ); + result = true; + } + } + } + else + { + String message = "No SCM translator found - skipping rewrite"; + + relResult.appendDebug( message ); + + getLogger().debug( message ); + } + return result; + } + + @Override + protected String getOriginalVersion( ReleaseDescriptor releaseDescriptor, String projectKey, boolean simulate ) + { + return releaseDescriptor.getProjectOriginalVersion( projectKey ); + } + + @Override + protected String getNextVersion( ReleaseDescriptor releaseDescriptor, String key ) + { + return releaseDescriptor.getProjectReleaseVersion( key ); + } + + @Override + protected String getResolvedSnapshotVersion( String artifactVersionlessKey, + ReleaseDescriptor releaseDescriptor ) + { + return releaseDescriptor.getDependencyReleaseVersion( artifactVersionlessKey ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhase.java new file mode 100644 index 000000000..834ca0ebd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhase.java @@ -0,0 +1,106 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.Scm; +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.scm.ScmTranslator; +import org.codehaus.plexus.component.annotations.Component; + +/** + * Rewrite POMs for future development + * + * @author Brett Porter + */ +@Component( role = ReleasePhase.class , hint = "rewrite-poms-for-development" ) +public class RewritePomsForDevelopmentPhase + extends AbstractRewritePomsPhase +{ + @Override + protected final String getPomSuffix() + { + return "next"; + } + + @Override + protected void transformScm( MavenProject project, Model modelTarget, ReleaseDescriptor releaseDescriptor, + String projectId, ScmRepository scmRepository, ReleaseResult result ) + throws ReleaseExecutionException + { + // If SCM is null in original model, it is inherited, no mods needed + if ( project.getScm() != null ) + { + Scm scmRoot = modelTarget.getScm(); + if ( scmRoot != null ) + { + ScmTranslator translator = getScmTranslators().get( scmRepository.getProvider() ); + if ( translator != null ) + { + Scm scm = releaseDescriptor.getOriginalScmInfo( projectId ); + + if ( scm != null ) + { + scmRoot.setConnection( scm.getConnection() ); + scmRoot.setDeveloperConnection( scm.getDeveloperConnection() ); + scmRoot.setUrl( scm.getUrl() ); + scmRoot.setTag( translator.resolveTag( scm.getTag() ) ); + } + else + { + // cleanly remove the SCM element + modelTarget.setScm( null ); + } + } + else + { + String message = "No SCM translator found - skipping rewrite"; + result.appendDebug( message ); + getLogger().debug( message ); + } + } + } + } + + @Override + protected String getOriginalVersion( ReleaseDescriptor releaseDescriptor, String projectKey, boolean simulate ) + { + return simulate + ? releaseDescriptor.getProjectOriginalVersion( projectKey ) + : releaseDescriptor.getProjectReleaseVersion( projectKey ); + } + + @Override + protected String getNextVersion( ReleaseDescriptor releaseDescriptor, String key ) + { + return releaseDescriptor.getProjectDevelopmentVersion( key ); + } + + @Override + protected String getResolvedSnapshotVersion( String artifactVersionlessKey, + ReleaseDescriptor releaseDescriptor ) + { + return releaseDescriptor.getDependencyDevelopmentVersion( artifactVersionlessKey ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhase.java new file mode 100644 index 000000000..cc36600a7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhase.java @@ -0,0 +1,252 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.nio.file.LinkOption; +import java.nio.file.Path; +import java.nio.file.Paths; + +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.model.Model; +import org.apache.maven.model.Scm; +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.scm.ScmTranslator; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.component.annotations.Component; + +/** + * Rewrite POMs for release. + * + * @author Brett Porter + */ +@Component( role = ReleasePhase.class, hint = "rewrite-poms-for-release" ) +public class RewritePomsForReleasePhase + extends AbstractRewritePomsPhase +{ + @Override + protected final String getPomSuffix() + { + return "tag"; + } + + @Override + protected void transformScm( MavenProject project, Model modelTarget, ReleaseDescriptor releaseDescriptor, + String projectId, ScmRepository scmRepository, ReleaseResult result ) + throws ReleaseExecutionException + { + // If SCM is null in original model, it is inherited, no mods needed + if ( project.getScm() != null ) + { + Scm scmRoot = modelTarget.getScm(); + if ( scmRoot != null ) + { + try + { + translateScm( project, releaseDescriptor, scmRoot, scmRepository, result ); + } + catch ( IOException e ) + { + throw new ReleaseExecutionException( e.getMessage(), e ); + } + } + else + { + MavenProject parent = project.getParent(); + if ( parent != null ) + { + // If the SCM element is not present, only add it if the parent was not mapped (ie, it's external to + // the release process and so has not been modified, so the values will not be correct on the tag), + String parentId = ArtifactUtils.versionlessKey( parent.getGroupId(), parent.getArtifactId() ); + if ( releaseDescriptor.getOriginalScmInfo( parentId ) == null ) + { + // we need to add it, since it has changed from the inherited value + Scm scmTarget = new Scm(); + // reset default value (HEAD) + scmTarget.setTag( null ); + + try + { + if ( translateScm( project, releaseDescriptor, scmTarget, scmRepository, result ) ) + { + modelTarget.setScm( scmTarget ); + } + } + catch ( IOException e ) + { + throw new ReleaseExecutionException( e.getMessage(), e ); + } + } + } + } + } + } + + private boolean translateScm( MavenProject project, ReleaseDescriptor releaseDescriptor, Scm scmTarget, + ScmRepository scmRepository, ReleaseResult relResult ) + throws IOException + { + ScmTranslator translator = getScmTranslators().get( scmRepository.getProvider() ); + boolean result = false; + if ( translator != null ) + { + Scm scm = project.getOriginalModel().getScm(); + if ( scm == null ) + { + scm = project.getScm(); + } + + String tag = releaseDescriptor.getScmReleaseLabel(); + String tagBase = releaseDescriptor.getScmTagBase(); + + // TODO: svn utils should take care of prepending this + if ( tagBase != null ) + { + tagBase = "scm:svn:" + tagBase; + } + + Path projectBasedir = project.getBasedir().toPath().toRealPath( LinkOption.NOFOLLOW_LINKS ); + Path workingDirectory = Paths.get( releaseDescriptor.getWorkingDirectory() ); + + int count = ReleaseUtil.getBaseWorkingDirectoryParentCount( workingDirectory, projectBasedir ); + + if ( scm.getConnection() != null ) + { + String rootUrl = ReleaseUtil.realignScmUrl( count, scm.getConnection() ); + + String subDirectoryTag = scm.getConnection().substring( rootUrl.length() ); + if ( !subDirectoryTag.startsWith( "/" ) ) + { + subDirectoryTag = "/" + subDirectoryTag; + } + + String scmConnectionTag = tagBase; + if ( scmConnectionTag != null ) + { + String trunkUrl = scm.getDeveloperConnection(); + if ( trunkUrl == null ) + { + trunkUrl = scm.getConnection(); + } + scmConnectionTag = translateUrlPath( trunkUrl, tagBase, scm.getConnection() ); + } + String value = + translator.translateTagUrl( scm.getConnection(), tag + subDirectoryTag, scmConnectionTag ); + + if ( !value.equals( scm.getConnection() ) ) + { + scmTarget.setConnection( value ); + result = true; + } + } + + if ( scm.getDeveloperConnection() != null ) + { + String rootUrl = ReleaseUtil.realignScmUrl( count, scm.getDeveloperConnection() ); + + String subDirectoryTag = scm.getDeveloperConnection().substring( rootUrl.length() ); + if ( !subDirectoryTag.startsWith( "/" ) ) + { + subDirectoryTag = "/" + subDirectoryTag; + } + + String value = + translator.translateTagUrl( scm.getDeveloperConnection(), tag + subDirectoryTag, tagBase ); + + if ( !value.equals( scm.getDeveloperConnection() ) ) + { + scmTarget.setDeveloperConnection( value ); + result = true; + } + } + + if ( scm.getUrl() != null ) + { + String rootUrl = ReleaseUtil.realignScmUrl( count, scm.getUrl() ); + + String subDirectoryTag = scm.getUrl().substring( rootUrl.length() ); + if ( !subDirectoryTag.startsWith( "/" ) ) + { + subDirectoryTag = "/" + subDirectoryTag; + } + + String tagScmUrl = tagBase; + if ( tagScmUrl != null ) + { + String trunkUrl = scm.getDeveloperConnection(); + if ( trunkUrl == null ) + { + trunkUrl = scm.getConnection(); + } + tagScmUrl = translateUrlPath( trunkUrl, tagBase, scm.getUrl() ); + } + // use original tag base without protocol + String value = translator.translateTagUrl( scm.getUrl(), tag + subDirectoryTag, tagScmUrl ); + if ( !value.equals( scm.getUrl() ) ) + { + scmTarget.setUrl( value ); + result = true; + } + } + + if ( tag != null ) + { + String value = translator.resolveTag( tag ); + if ( value != null && !value.equals( scm.getTag() ) ) + { + scmTarget.setTag( value ); + result = true; + } + } + } + else + { + String message = "No SCM translator found - skipping rewrite"; + + relResult.appendDebug( message ); + + getLogger().debug( message ); + } + return result; + } + + @Override + protected String getOriginalVersion( ReleaseDescriptor releaseDescriptor, String projectKey, boolean simulate ) + { + return releaseDescriptor.getProjectOriginalVersion( projectKey ); + } + + @Override + protected String getNextVersion( ReleaseDescriptor releaseDescriptor, String key ) + { + return releaseDescriptor.getProjectReleaseVersion( key ); + } + + @Override + protected String getResolvedSnapshotVersion( String artifactVersionlessKey, + ReleaseDescriptor releaseDescriptor ) + { + return releaseDescriptor.getDependencyReleaseVersion( artifactVersionlessKey ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunCompleteGoalsPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunCompleteGoalsPhase.java new file mode 100644 index 000000000..aab47500d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunCompleteGoalsPhase.java @@ -0,0 +1,71 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.project.MavenProject; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.codehaus.plexus.component.annotations.Component; + +/** + * Run the completion goals for the project to before committing the continuing development stream. + * + * @author Brett Porter + * @author Stephen Connolly + */ +@Component( role = ReleasePhase.class, hint = "run-completion-goals" ) +public class RunCompleteGoalsPhase + extends AbstractRunGoalsPhase +{ + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException + { + return execute( releaseDescriptor, releaseEnvironment, new File( releaseDescriptor.getWorkingDirectory() ), + getAdditionalArguments( releaseDescriptor ) ); + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException + { + ReleaseResult result = new ReleaseResult(); + + logInfo( result, "Executing completion goals - since this is simulation mode it is running against the " + + "original project, not the rewritten ones" ); + + execute( releaseDescriptor, releaseEnvironment, reactorProjects ); + + return result; + } + + @Override + protected String getGoals( ReleaseDescriptor releaseDescriptor ) + { + return releaseDescriptor.getCompletionGoals(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPerformGoalsPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPerformGoalsPhase.java new file mode 100644 index 000000000..7c63a5fdc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPerformGoalsPhase.java @@ -0,0 +1,145 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.util.PomFinder; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.util.StringUtils; + +import java.io.File; +import java.util.List; + +/** + * Run the integration tests for the project to verify that it builds before committing. + * + * @author Brett Porter + */ +@Component( role = ReleasePhase.class, hint = "run-perform-goals" ) +public class RunPerformGoalsPhase + extends AbstractRunGoalsPhase +{ + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException + { + return runLogic( releaseDescriptor, releaseEnvironment, reactorProjects, false ); + } + + private ReleaseResult runLogic( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects, boolean simulate ) + throws ReleaseExecutionException + { + String additionalArguments = getAdditionalArguments( releaseDescriptor ); + + if ( releaseDescriptor.isUseReleaseProfile() ) + { + if ( !StringUtils.isEmpty( additionalArguments ) ) + { + additionalArguments = additionalArguments + " -DperformRelease=true"; + } + else + { + additionalArguments = "-DperformRelease=true"; + } + } + + String pomFileName = releaseDescriptor.getPomFileName(); + if ( pomFileName == null ) + { + pomFileName = "pom.xml"; + } + + // ensure we don't use the release pom for the perform goals + // ^^ paranoia? A MavenExecutor has already access to this. Probably worth refactoring. + if ( !StringUtils.isEmpty( additionalArguments ) ) + { + additionalArguments = additionalArguments + " -f " + pomFileName; + } + else + { + additionalArguments = "-f " + pomFileName; + } + + if ( simulate ) + { + ReleaseResult result = new ReleaseResult(); + + logDebug( result, "Additional arguments: " + additionalArguments ); + + logInfo( result, "Executing perform goals - since this is simulation mode these goals are skipped." ); + + return result; + } + + String workDir = releaseDescriptor.getWorkingDirectory(); + if ( workDir == null ) + { + workDir = System.getProperty( "user.dir" ); + } + + + File pomFile = new File( workDir, pomFileName ); + PomFinder pomFinder = new PomFinder( getLogger() ); + boolean foundPom = false; + + if ( StringUtils.isEmpty( releaseDescriptor.getScmRelativePathProjectDirectory() ) ) + { + foundPom = pomFinder.parsePom( pomFile ); + } + + File workDirectory = new File( releaseDescriptor.getCheckoutDirectory() ); + + if ( foundPom ) + { + File matchingPom = pomFinder.findMatchingPom( workDirectory ); + if ( matchingPom != null ) + { + getLogger().info( "Invoking perform goals in directory " + matchingPom.getParent() ); + // The directory of the POM in a flat project layout is not + // the same directory as the SCM checkout directory! + // The same is true for a sparse checkout in e.g. GIT + // the project to build could be in target/checkout/some/dir/ + workDirectory = matchingPom.getParentFile(); + } + } + + return execute( releaseDescriptor, releaseEnvironment, workDirectory, additionalArguments ); + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException + { + return runLogic( releaseDescriptor, releaseEnvironment, reactorProjects, true ); + } + + @Override + protected String getGoals( ReleaseDescriptor releaseDescriptor ) + { + return releaseDescriptor.getPerformGoals(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPrepareGoalsPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPrepareGoalsPhase.java new file mode 100644 index 000000000..23db790b5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPrepareGoalsPhase.java @@ -0,0 +1,70 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.codehaus.plexus.component.annotations.Component; + +import java.io.File; +import java.util.List; + +/** + * Run the integration tests for the project to verify that it builds before committing. + * + * @author Brett Porter + */ +@Component( role = ReleasePhase.class, hint = "run-preparation-goals" ) +public class RunPrepareGoalsPhase + extends AbstractRunGoalsPhase +{ + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException + { + return execute( releaseDescriptor, releaseEnvironment, new File( releaseDescriptor.getWorkingDirectory() ), + getAdditionalArguments( releaseDescriptor ) ); + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException + { + ReleaseResult result = new ReleaseResult(); + + logInfo( result, "Executing preparation goals - since this is simulation mode it is running against the " + + "original project, not the rewritten ones" ); + + execute( releaseDescriptor, releaseEnvironment, reactorProjects ); + + return result; + } + + @Override + protected String getGoals( ReleaseDescriptor releaseDescriptor ) + { + return releaseDescriptor.getPreparationGoals(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmBranchPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmBranchPhase.java new file mode 100644 index 000000000..576f51112 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmBranchPhase.java @@ -0,0 +1,165 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.ScmBranchParameters; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.command.branch.BranchScmResult; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; + +import java.io.File; +import java.util.List; + +/** + * Branch the SCM repository. + * + * @author Emmanuel Venisse + */ +@Component( role = ReleasePhase.class, hint = "scm-branch" ) +public class ScmBranchPhase + extends AbstractReleasePhase +{ + /** + * Tool that gets a configured SCM repository from release configuration. + */ + @Requirement + private ScmRepositoryConfigurator scmRepositoryConfigurator; + + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult relResult = new ReleaseResult(); + + validateConfiguration( releaseDescriptor ); + + ReleaseDescriptor basedirAlignedReleaseDescriptor = + ReleaseUtil.createBasedirAlignedReleaseDescriptor( releaseDescriptor, reactorProjects ); + + logInfo( relResult, "Branching release with the label " + basedirAlignedReleaseDescriptor.getScmReleaseLabel() + + "..." ); + + ScmRepository repository; + ScmProvider provider; + try + { + repository = + scmRepositoryConfigurator.getConfiguredRepository( basedirAlignedReleaseDescriptor.getScmSourceUrl(), + releaseDescriptor, + releaseEnvironment.getSettings() ); + + repository.getProviderRepository().setPushChanges( releaseDescriptor.isPushChanges() ); + + repository.getProviderRepository().setWorkItem( releaseDescriptor.getWorkItem() ); + + provider = scmRepositoryConfigurator.getRepositoryProvider( repository ); + + } + catch ( ScmRepositoryException e ) + { + throw new ReleaseScmRepositoryException( e.getMessage(), e.getValidationMessages() ); + } + catch ( NoSuchScmProviderException e ) + { + throw new ReleaseExecutionException( "Unable to configure SCM repository: " + e.getMessage(), e ); + } + + BranchScmResult result; + try + { + ScmFileSet fileSet = new ScmFileSet( new File( basedirAlignedReleaseDescriptor.getWorkingDirectory() ) ); + String branchName = releaseDescriptor.getScmReleaseLabel(); + + ScmBranchParameters scmBranchParameters = new ScmBranchParameters(); + scmBranchParameters.setMessage( releaseDescriptor.getScmCommentPrefix() + "copy for branch " + branchName ); + scmBranchParameters.setRemoteBranching( releaseDescriptor.isRemoteTagging() ); + scmBranchParameters.setScmRevision( releaseDescriptor.getScmReleasedPomRevision() ); + scmBranchParameters.setPinExternals( releaseDescriptor.isPinExternals() ); + + result = provider.branch( repository, fileSet, branchName, scmBranchParameters ); + } + catch ( ScmException e ) + { + throw new ReleaseExecutionException( "An error is occurred in the branch process: " + e.getMessage(), e ); + } + + if ( !result.isSuccess() ) + { + throw new ReleaseScmCommandException( "Unable to branch SCM", result ); + } + + relResult.setResultCode( ReleaseResult.SUCCESS ); + + return relResult; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = new ReleaseResult(); + + validateConfiguration( releaseDescriptor ); + ReleaseDescriptor basedirAlignedReleaseDescriptor = + ReleaseUtil.createBasedirAlignedReleaseDescriptor( releaseDescriptor, reactorProjects ); + + logInfo( result, "Full run would branch " + basedirAlignedReleaseDescriptor.getWorkingDirectory() ); + if ( releaseDescriptor.getScmBranchBase() != null ) + { + logInfo( result, " to SCM URL " + releaseDescriptor.getScmBranchBase() ); + } + logInfo( result, " with label '" + releaseDescriptor.getScmReleaseLabel() + "'" ); + if ( releaseDescriptor.isPinExternals() ) + { + logInfo( result, " and pinned externals" ); + } + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + private static void validateConfiguration( ReleaseDescriptor releaseDescriptor ) + throws ReleaseFailureException + { + if ( releaseDescriptor.getScmReleaseLabel() == null ) + { + throw new ReleaseFailureException( "A release label is required for committing" ); + } + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCheckModificationsPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCheckModificationsPhase.java new file mode 100644 index 000000000..6562089c9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCheckModificationsPhase.java @@ -0,0 +1,206 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.ScmException; +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.command.status.StatusScmResult; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator; +import org.apache.maven.shared.release.scm.ScmTranslator; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.util.SelectorUtils; +import org.codehaus.plexus.util.StringUtils; + +import java.io.File; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * See if there are any local modifications to the files before proceeding with SCM operations and the release. + * + * @author Brett Porter + */ +@Component( role = ReleasePhase.class, hint = "scm-check-modifications" ) +public class ScmCheckModificationsPhase + extends AbstractReleasePhase +{ + /** + * Tool that gets a configured SCM repository from release configuration. + */ + @Requirement + private ScmRepositoryConfigurator scmRepositoryConfigurator; + + /** + * SCM URL translators mapped by provider name. + */ + @Requirement( role = ScmTranslator.class ) + private Map scmTranslators; + + /** + * The filepatterns to exclude from the status check. + * + * @todo proper construction of filenames, especially release properties + */ + private Set exclusionPatterns = new HashSet<>( Arrays.asList( + "**" + File.separator + "pom.xml.backup", "**" + File.separator + "pom.xml.tag", + "**" + File.separator + "pom.xml.next", "**" + File.separator + "pom.xml.branch", + "**" + File.separator + "release.properties", "**" + File.separator + "pom.xml.releaseBackup" ) ); + + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult relResult = new ReleaseResult(); + + List additionalExcludes = releaseDescriptor.getCheckModificationExcludes(); + + if ( additionalExcludes != null ) + { + // SelectorUtils expects OS-specific paths and patterns + for ( String additionalExclude : additionalExcludes ) + { + exclusionPatterns.add( additionalExclude.replace( "\\", File.separator ) + .replace( "/", File.separator ) ); + } + } + + logInfo( relResult, "Verifying that there are no local modifications..." ); + logInfo( relResult, " ignoring changes on: " + StringUtils.join( exclusionPatterns.toArray(), ", " ) ); + + ScmRepository repository; + ScmProvider provider; + try + { + repository = + scmRepositoryConfigurator.getConfiguredRepository( releaseDescriptor, + releaseEnvironment.getSettings() ); + + provider = scmRepositoryConfigurator.getRepositoryProvider( repository ); + } + catch ( ScmRepositoryException e ) + { + throw new ReleaseScmRepositoryException( e.getMessage() + " for URL: " + + releaseDescriptor.getScmSourceUrl(), e.getValidationMessages() ); + } + catch ( NoSuchScmProviderException e ) + { + throw new ReleaseExecutionException( "Unable to configure SCM repository: " + e.getMessage(), e ); + } + + StatusScmResult result; + try + { + result = + provider.status( repository, new ScmFileSet( new File( releaseDescriptor.getWorkingDirectory() ) ) ); + } + catch ( ScmException e ) + { + throw new ReleaseExecutionException( "An error occurred during the status check process: " + e.getMessage(), + e ); + } + + if ( !result.isSuccess() ) + { + throw new ReleaseScmCommandException( "Unable to check for local modifications", result ); + } + + List changedFiles = result.getChangedFiles(); + + if ( !changedFiles.isEmpty() ) + { + ScmTranslator scmTranslator = scmTranslators.get( repository.getProvider() ); + + // TODO: would be nice for SCM status command to do this for me. + for ( Iterator i = changedFiles.iterator(); i.hasNext(); ) + { + ScmFile f = i.next(); + + String path; + if ( scmTranslator != null ) + { + path = scmTranslator.toRelativePath( f.getPath() ); + } + else + { + path = f.getPath(); + } + + // SelectorUtils expects File.separator, don't standardize! + String fileName = path.replace( "\\", File.separator ).replace( "/", File.separator ); + + for ( String exclusionPattern : exclusionPatterns ) + { + if ( SelectorUtils.matchPath( exclusionPattern, fileName ) ) + { + logDebug( relResult, "Ignoring changed file: " + fileName ); + i.remove(); + break; + } + } + } + } + + if ( !changedFiles.isEmpty() ) + { + StringBuilder message = new StringBuilder(); + + for ( ScmFile file : changedFiles ) + { + message.append( file.toString() ); + message.append( "\n" ); + } + + throw new ReleaseFailureException( "Cannot prepare the release because you have local modifications : \n" + + message ); + } + + relResult.setResultCode( ReleaseResult.SUCCESS ); + + return relResult; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + // It makes no modifications, so simulate is the same as execute + return execute( releaseDescriptor, releaseEnvironment, reactorProjects ); + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhase.java new file mode 100644 index 000000000..c81889e7e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhase.java @@ -0,0 +1,103 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.text.MessageFormat; +import java.util.Collection; +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; + +/** + * Commit the changes that were done to prepare the branch or tag to the SCM. + * + * @author Brett Porter + */ +public class ScmCommitDevelopmentPhase + extends AbstractScmCommitPhase +{ + + /** + * The format for the + */ + private String rollbackMessageFormat; + + @Override + protected void runLogic( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects, ReleaseResult result, boolean simulating ) + throws ReleaseScmCommandException, ReleaseExecutionException, ReleaseScmRepositoryException + { + // no rollback required + if ( + // was there no commit that has to be rolled back by a new one + releaseDescriptor.isSuppressCommitBeforeTagOrBranch() + // and working copy should not be touched + && !releaseDescriptor.isUpdateWorkingCopyVersions() ) + { + if ( simulating ) + { + logInfo( result, "Full run would not commit changes, because updateWorkingCopyVersions is false." ); + } + else + { + logInfo( result, "Modified POMs are not committed because updateWorkingCopyVersions is set to false." ); + } + } + // rollback or commit development versions required + else + { + String message; + if ( !releaseDescriptor.isUpdateWorkingCopyVersions() ) + { + // the commit is a rollback + message = createRollbackMessage( releaseDescriptor ); + } + else + { + // a normal commit + message = createMessage( reactorProjects, releaseDescriptor ); + } + if ( simulating ) + { + Collection pomFiles = createPomFiles( releaseDescriptor, reactorProjects ); + logInfo( result, + "Full run would commit " + pomFiles.size() + " files with message: '" + message + "'" ); + } + else + { + performCheckins( releaseDescriptor, releaseEnvironment, reactorProjects, message ); + } + } + } + + private String createRollbackMessage( ReleaseDescriptor releaseDescriptor ) + { + return MessageFormat.format( releaseDescriptor.getScmCommentPrefix() + rollbackMessageFormat, + new Object[]{releaseDescriptor.getScmReleaseLabel()} ); + } + +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java new file mode 100644 index 000000000..b1f47e8b6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java @@ -0,0 +1,86 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; + +import java.util.List; + +/** + * Commit the changes that were done to prepare the branch or tag to the SCM. + * + * @author Brett Porter + */ +public class ScmCommitPreparationPhase + extends AbstractScmCommitPhase +{ + + protected void runLogic( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects, ReleaseResult result, boolean simulating ) + throws ReleaseScmCommandException, ReleaseExecutionException, ReleaseScmRepositoryException + { + // no prepare-commit required + if ( releaseDescriptor.isSuppressCommitBeforeTagOrBranch() ) + { + if ( simulating ) + { + logInfo( result, "Full run would not commit changes, " + + "because suppressCommitBeforeTagOrBranch is set to true." ); + } + else + { + logInfo( result, + "Modified POMs are not committed because suppressCommitBeforeTagOrBranch is set to true." ); + } + } + // commit development versions required + else + { + String message = createMessage( reactorProjects, releaseDescriptor ); + if ( simulating ) + { + simulateCheckins( releaseDescriptor, reactorProjects, result, message ); + } + else + { + performCheckins( releaseDescriptor, releaseEnvironment, reactorProjects, message ); + } + } + } + + protected void validateConfiguration( ReleaseDescriptor releaseDescriptor ) + throws ReleaseFailureException + { + super.validateConfiguration( releaseDescriptor ); + + if ( releaseDescriptor.isSuppressCommitBeforeTagOrBranch() && releaseDescriptor.isRemoteTagging() ) + { + throw new ReleaseFailureException( + "Cannot perform a remote tag or branch without committing the working copy first." ); + } + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmTagPhase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmTagPhase.java new file mode 100644 index 000000000..b85185280 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmTagPhase.java @@ -0,0 +1,193 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.project.MavenProject; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmTagParameters; +import org.apache.maven.scm.command.tag.TagScmResult; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; + +/** + * Tag the SCM repository after committing the release. + * + * @author Brett Porter + */ +@Component( role = ReleasePhase.class, hint = "scm-tag" ) +public class ScmTagPhase + extends AbstractReleasePhase +{ + /** + * Tool that gets a configured SCM repository from release configuration. + */ + @Requirement + private ScmRepositoryConfigurator scmRepositoryConfigurator; + + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult relResult = new ReleaseResult(); + + validateConfiguration( releaseDescriptor ); + + if ( releaseDescriptor.getWaitBeforeTagging() > 0 ) + { + logInfo( relResult, "Waiting for " + releaseDescriptor.getWaitBeforeTagging() + + " seconds before tagging the release." ); + try + { + Thread.sleep( 1000L * releaseDescriptor.getWaitBeforeTagging() ); + } + catch ( InterruptedException e ) + { + // Ignore + } + } + + logInfo( relResult, "Tagging release with the label " + releaseDescriptor.getScmReleaseLabel() + "..." ); + + ReleaseDescriptor basedirAlignedReleaseDescriptor = + ReleaseUtil.createBasedirAlignedReleaseDescriptor( releaseDescriptor, reactorProjects ); + + ScmRepository repository; + ScmProvider provider; + try + { + repository = + scmRepositoryConfigurator.getConfiguredRepository( basedirAlignedReleaseDescriptor.getScmSourceUrl(), + releaseDescriptor, + releaseEnvironment.getSettings() ); + + repository.getProviderRepository().setPushChanges( releaseDescriptor.isPushChanges() ); + + repository.getProviderRepository().setWorkItem( releaseDescriptor.getWorkItem() ); + + provider = scmRepositoryConfigurator.getRepositoryProvider( repository ); + } + catch ( ScmRepositoryException e ) + { + throw new ReleaseScmRepositoryException( e.getMessage(), e.getValidationMessages() ); + } + catch ( NoSuchScmProviderException e ) + { + throw new ReleaseExecutionException( "Unable to configure SCM repository: " + e.getMessage(), e ); + } + + TagScmResult result; + try + { + // TODO: want includes/excludes? + ScmFileSet fileSet = new ScmFileSet( new File( basedirAlignedReleaseDescriptor.getWorkingDirectory() ) ); + String tagName = releaseDescriptor.getScmReleaseLabel(); + ScmTagParameters scmTagParameters = + new ScmTagParameters( releaseDescriptor.getScmCommentPrefix() + "copy for tag " + tagName ); + scmTagParameters.setRemoteTagging( releaseDescriptor.isRemoteTagging() ); + scmTagParameters.setScmRevision( releaseDescriptor.getScmReleasedPomRevision() ); + scmTagParameters.setPinExternals( releaseDescriptor.isPinExternals() ); + if ( getLogger().isDebugEnabled() ) + { + getLogger().debug( + "ScmTagPhase :: scmTagParameters remotingTag " + releaseDescriptor.isRemoteTagging() ); + getLogger().debug( + "ScmTagPhase :: scmTagParameters scmRevision " + releaseDescriptor.getScmReleasedPomRevision() ); + getLogger().debug( + "ScmTagPhase :: scmTagParameters pinExternals " + releaseDescriptor.isPinExternals() ); + getLogger().debug( "ScmTagPhase :: fileSet " + fileSet ); + } + result = provider.tag( repository, fileSet, tagName, scmTagParameters ); + } + catch ( ScmException e ) + { + throw new ReleaseExecutionException( "An error is occurred in the tag process: " + e.getMessage(), e ); + } + + if ( !result.isSuccess() ) + { + throw new ReleaseScmCommandException( "Unable to tag SCM", result ); + } + + relResult.setResultCode( ReleaseResult.SUCCESS ); + + return relResult; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, + List reactorProjects ) + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = new ReleaseResult(); + + validateConfiguration( releaseDescriptor ); + + ReleaseDescriptor basedirAlignedReleaseDescriptor = + ReleaseUtil.createBasedirAlignedReleaseDescriptor( releaseDescriptor, reactorProjects ); + + if ( releaseDescriptor.isRemoteTagging() ) + { + logInfo( result, + "Full run would tag working copy '" + + basedirAlignedReleaseDescriptor.getWorkingDirectory() + "'" ); + } + else + { + logInfo( result, "Full run would tag remotely '" + + basedirAlignedReleaseDescriptor.getScmSourceUrl() + "'" ); + } + logInfo( result, " with label '" + releaseDescriptor.getScmReleaseLabel() + "'" ); + if ( releaseDescriptor.isPinExternals() ) + { + logInfo( result, " and pinned externals" ); + } + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + private static void validateConfiguration( ReleaseDescriptor releaseDescriptor ) + throws ReleaseFailureException + { + if ( releaseDescriptor.getScmReleaseLabel() == null ) + { + throw new ReleaseFailureException( "A release label is required for committing" ); + } + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/policies/DefaultNamingPolicy.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/policies/DefaultNamingPolicy.java new file mode 100644 index 000000000..a646dfcc1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/policies/DefaultNamingPolicy.java @@ -0,0 +1,42 @@ +package org.apache.maven.shared.release.policies; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.policy.PolicyException; +import org.apache.maven.shared.release.policy.naming.NamingPolicy; +import org.apache.maven.shared.release.policy.naming.NamingPolicyRequest; +import org.apache.maven.shared.release.policy.naming.NamingPolicyResult; +import org.codehaus.plexus.component.annotations.Component; + +/** + * + * @author Robert Scholte + * @since 3.0.0 + */ +@Component( role = NamingPolicy.class, hint = "default" ) +public class DefaultNamingPolicy implements NamingPolicy +{ + @Override + public NamingPolicyResult getName( NamingPolicyRequest request ) + throws PolicyException + { + return new NamingPolicyResult().setName( request.getArtifactId() + "-" + request.getVersion() ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/policies/DefaultVersionPolicy.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/policies/DefaultVersionPolicy.java new file mode 100644 index 000000000..3f323719a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/policies/DefaultVersionPolicy.java @@ -0,0 +1,56 @@ +package org.apache.maven.shared.release.policies; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.policy.PolicyException; +import org.apache.maven.shared.release.policy.version.VersionPolicy; +import org.apache.maven.shared.release.policy.version.VersionPolicyRequest; +import org.apache.maven.shared.release.policy.version.VersionPolicyResult; +import org.apache.maven.shared.release.versions.DefaultVersionInfo; +import org.apache.maven.shared.release.versions.VersionParseException; +import org.codehaus.plexus.component.annotations.Component; + +/** + * + * @author Robert Scholte + */ +@Component( role = VersionPolicy.class, hint = "default" ) +public class DefaultVersionPolicy + implements VersionPolicy +{ + + @Override + public VersionPolicyResult getReleaseVersion( VersionPolicyRequest request ) + throws PolicyException, VersionParseException + { + String releaseVersion = new DefaultVersionInfo( request.getVersion() ).getReleaseVersionString(); + return new VersionPolicyResult().setVersion( releaseVersion ); + } + + @Override + public VersionPolicyResult getDevelopmentVersion( VersionPolicyRequest request ) + throws PolicyException, VersionParseException + { + String developmentVersion = + new DefaultVersionInfo( request.getVersion() ).getNextVersion().getSnapshotVersionString(); + return new VersionPolicyResult().setVersion( developmentVersion ); + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ClearCaseScmTranslator.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ClearCaseScmTranslator.java new file mode 100644 index 000000000..2baa91520 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ClearCaseScmTranslator.java @@ -0,0 +1,75 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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; + +/** + * ClearCase tag translator. + * + * @author Arne Degenring + */ +@Component( role = ScmTranslator.class, hint = "clearcase" ) +public class ClearCaseScmTranslator + implements ScmTranslator +{ + /** + * {@inheritDoc} + */ + @Override + public String translateBranchUrl( String url, String branchName, String branchBase ) + { + return url; + } + + /** + * {@inheritDoc} + */ + @Override + public String translateTagUrl( String url, String tag, String tagBase ) + { + return url; + } + + /** + * {@inheritDoc} + */ + @Override + public String resolveTag( String tag ) + { + if ( !"HEAD".equals( tag ) ) + { + return tag; + } + else + { + return null; + } + } + + /** + * {@inheritDoc} + */ + @Override + public String toRelativePath( String path ) + { + return path; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/CvsScmTranslator.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/CvsScmTranslator.java new file mode 100644 index 000000000..60370a932 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/CvsScmTranslator.java @@ -0,0 +1,75 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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; + +/** + * CVS tag translator. + * + * @author Brett Porter + */ +@Component( role = ScmTranslator.class, hint = "cvs" ) +public class CvsScmTranslator + implements ScmTranslator +{ + /** + * {@inheritDoc} + */ + @Override + public String translateBranchUrl( String url, String branchName, String branchBase ) + { + return url; + } + + /** + * {@inheritDoc} + */ + @Override + public String translateTagUrl( String url, String tag, String tagBase ) + { + return url; + } + + /** + * {@inheritDoc} + */ + @Override + public String resolveTag( String tag ) + { + if ( !"HEAD".equals( tag ) ) + { + return tag; + } + else + { + return null; + } + } + + /** + * {@inheritDoc} + */ + @Override + public String toRelativePath( String path ) + { + return path; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/DefaultScmRepositoryConfigurator.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/DefaultScmRepositoryConfigurator.java new file mode 100644 index 000000000..3bfa4dd7c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/DefaultScmRepositoryConfigurator.java @@ -0,0 +1,214 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.provider.ScmProviderRepository; +import org.apache.maven.scm.provider.ScmProviderRepositoryWithHost; +import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.settings.Server; +import org.apache.maven.settings.Settings; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.logging.AbstractLogEnabled; +import org.codehaus.plexus.util.StringUtils; +import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher; +import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; + +/** + * Tool that gets a configured SCM repository from release configuration. + * + * @author Brett Porter + */ +@Component( role = ScmRepositoryConfigurator.class, instantiationStrategy = "singleton" ) +public class DefaultScmRepositoryConfigurator + extends AbstractLogEnabled + implements ScmRepositoryConfigurator +{ + /** + * The SCM manager. + */ + @Requirement + private ScmManager scmManager; + + /** + * When this plugin requires Maven 3.0 as minimum, this component can be removed and o.a.m.s.c.SettingsDecrypter be + * used instead. + */ + @Requirement( hint = "mng-4384" ) + private SecDispatcher secDispatcher; + + @Override + public ScmRepository getConfiguredRepository( ReleaseDescriptor releaseDescriptor, Settings settings ) + throws ScmRepositoryException, NoSuchScmProviderException + { + String url = releaseDescriptor.getScmSourceUrl(); + return getConfiguredRepository( url, releaseDescriptor, settings ); + } + + @Override + public ScmRepository getConfiguredRepository( String url, ReleaseDescriptor releaseDescriptor, Settings settings ) + throws ScmRepositoryException, NoSuchScmProviderException + { + String username = releaseDescriptor.getScmUsername(); + String password = releaseDescriptor.getScmPassword(); + String privateKey = releaseDescriptor.getScmPrivateKey(); + String passphrase = releaseDescriptor.getScmPrivateKeyPassPhrase(); + + ScmRepository repository = scmManager.makeScmRepository( url ); + + ScmProviderRepository scmRepo = repository.getProviderRepository(); + + //MRELEASE-76 + scmRepo.setPersistCheckout( false ); + + if ( settings != null ) + { + Server server = null; + + if ( releaseDescriptor.getScmId() != null ) + { + server = settings.getServer( releaseDescriptor.getScmId() ); + } + + if ( server == null && repository.getProviderRepository() instanceof ScmProviderRepositoryWithHost ) + { + ScmProviderRepositoryWithHost repositoryWithHost = + (ScmProviderRepositoryWithHost) repository.getProviderRepository(); + String host = repositoryWithHost.getHost(); + + int port = repositoryWithHost.getPort(); + + if ( port > 0 ) + { + host += ":" + port; + } + + // TODO: this is a bit dodgy - id is not host, but since we don't have a field we make an assumption + server = settings.getServer( host ); + } + + if ( server != null ) + { + if ( username == null ) + { + username = server.getUsername(); + } + + if ( password == null ) + { + password = decrypt( server.getPassword(), server.getId() ); + } + + if ( privateKey == null ) + { + privateKey = server.getPrivateKey(); + } + + if ( passphrase == null ) + { + passphrase = decrypt( server.getPassphrase(), server.getId() ); + } + } + } + + if ( !StringUtils.isEmpty( username ) ) + { + scmRepo.setUser( username ); + } + if ( !StringUtils.isEmpty( password ) ) + { + scmRepo.setPassword( password ); + } + + if ( scmRepo instanceof ScmProviderRepositoryWithHost ) + { + ScmProviderRepositoryWithHost repositoryWithHost = (ScmProviderRepositoryWithHost) scmRepo; + if ( !StringUtils.isEmpty( privateKey ) ) + { + repositoryWithHost.setPrivateKey( privateKey ); + } + + if ( !StringUtils.isEmpty( passphrase ) ) + { + repositoryWithHost.setPassphrase( passphrase ); + } + } + + if ( "svn".equals( repository.getProvider() ) ) + { + SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) repository.getProviderRepository(); + + String tagBase = releaseDescriptor.getScmTagBase(); + if ( !StringUtils.isEmpty( tagBase ) ) + { + svnRepo.setTagBase( tagBase ); + } + + String branchBase = releaseDescriptor.getScmBranchBase(); + if ( !StringUtils.isEmpty( branchBase ) ) + { + svnRepo.setBranchBase( branchBase ); + } + } + + return repository; + } + + private String decrypt( String str, String server ) + { + try + { + return secDispatcher.decrypt( str ); + } + catch ( SecDispatcherException e ) + { + String msg = + "Failed to decrypt password/passphrase for server " + server + ", using auth token as is: " + + e.getMessage(); + if ( getLogger().isDebugEnabled() ) + { + getLogger().warn( msg, e ); + } + else + { + getLogger().warn( msg ); + } + return str; + } + } + + @Override + public ScmProvider getRepositoryProvider( ScmRepository repository ) + throws NoSuchScmProviderException + { + return scmManager.getProviderByRepository( repository ); + } + + public void setScmManager( ScmManager scmManager ) + { + this.scmManager = scmManager; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/GitScmTranslator.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/GitScmTranslator.java new file mode 100644 index 000000000..ccc67ce2e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/GitScmTranslator.java @@ -0,0 +1,54 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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; + +/** + */ +@Component( role = ScmTranslator.class, hint = "git" ) +public class GitScmTranslator + implements ScmTranslator +{ + + @Override + public String translateBranchUrl( String url, String branchName, String branchBase ) + { + return url; + } + + @Override + public String translateTagUrl( String url, String tag, String tagBase ) + { + return url; + } + + @Override + public String resolveTag( String tag ) + { + return tag; + } + + @Override + public String toRelativePath( String path ) + { + return path; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/HgScmTranslator.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/HgScmTranslator.java new file mode 100644 index 000000000..953d5346f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/HgScmTranslator.java @@ -0,0 +1,54 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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; + +/** + */ +@Component( role = ScmTranslator.class, hint = "hg" ) +public class HgScmTranslator + implements ScmTranslator +{ + + @Override + public String translateBranchUrl( String url, String branchName, String branchBase ) + { + return url; + } + + @Override + public String translateTagUrl( String url, String tag, String tagBase ) + { + return url; + } + + @Override + public String resolveTag( String tag ) + { + return tag; + } + + @Override + public String toRelativePath( String path ) + { + return path; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/IdentifiedScm.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/IdentifiedScm.java new file mode 100644 index 000000000..51b3ad1bb --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/IdentifiedScm.java @@ -0,0 +1,53 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.Scm; + +/** + * Unlike repositories the scm of the Project Model doesn't have an id. + * This makes it quite hard to bind it to the credentials of a server as specified in the settings.xml + * + * @author Robert Scholte + * + * @since 2.3 + */ +public class IdentifiedScm + extends Scm +{ + + private String id; + + /** + * @return the id + */ + public String getId() + { + return id; + } + + /** + * @param id the id to set + */ + public void setId( String id ) + { + this.id = id; + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/JazzScmTranslator.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/JazzScmTranslator.java new file mode 100644 index 000000000..d5fd8cded --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/JazzScmTranslator.java @@ -0,0 +1,104 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.codehaus.plexus.component.annotations.Component; + +/** + * Jazz tag translator. + * + * @author Chris Graham + */ +@Component( role = ScmTranslator.class, hint = "jazz" ) +public class JazzScmTranslator + implements ScmTranslator +{ + /** + * {@inheritDoc} + */ + @Override + public String translateBranchUrl( String url, String branchName, String branchBase ) + { + // Jazz URL's (currently) take the form: + // "scm:jazz:[username[;password]@]http[s]://server_name[:port]/jazzPath:repositoryWorkspace" + // Eg: + // scm:jazz:Deb;Deb@https://rtc:9444/jazz:BogusRepositoryWorkspace + int i = url.lastIndexOf( ':' ); + url = url.substring( 0, i + 1 ); + if ( branchName != null && branchName.endsWith( "/" ) ) + { + // Remove the trailing "/", if present. + branchName = branchName.substring( 0, branchName.length() - 1 ); + } + url = url + branchName; + return url; + } + + /** + * {@inheritDoc} + */ + @Override + public String translateTagUrl( String url, String tag, String tagBase ) + { + // Jazz URL's (currently) take the form: + // "scm:jazz:[username[;password]@]http[s]://server_name[:port]/jazzPath:repositoryWorkspace" + // Eg: + // scm:jazz:Deb;Deb@https://rtc:9444/jazz:BogusRepositoryWorkspace + int i = url.lastIndexOf( ':' ); + url = url.substring( 0, i + 1 ); + if ( tag != null && tag.endsWith( "/" ) ) + { + // Remove the trailing "/", if present. + tag = tag.substring( 0, tag.length() - 1 ); + } + url = url + tag; + return url; + } + + /** + * {@inheritDoc} + */ + @Override + public String resolveTag( String tag ) + { + // project.scm.tag is not required, so return null. + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toRelativePath( String path ) + { + String relativePath; + if ( path.startsWith( "\\" ) || path.startsWith( "/" ) ) + { + relativePath = path.substring( 1 ); + } + else + { + relativePath = path; + } + return relativePath.replace( "\\", File.separator ).replace( "/", File.separator ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ReleaseScmCommandException.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ReleaseScmCommandException.java new file mode 100644 index 000000000..96562f202 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ReleaseScmCommandException.java @@ -0,0 +1,38 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.ScmResult; +import org.apache.maven.shared.release.ReleaseFailureException; + +/** + * Exception occurring during an SCM operation. + * + * @author Brett Porter + */ +public class ReleaseScmCommandException + extends ReleaseFailureException +{ + public ReleaseScmCommandException( String message, ScmResult result ) + { + super( message + "\nProvider message:\n" + result.getProviderMessage() + "\nCommand output:\n" + + result.getCommandOutput() ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ReleaseScmRepositoryException.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ReleaseScmRepositoryException.java new file mode 100644 index 000000000..6edfb228b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ReleaseScmRepositoryException.java @@ -0,0 +1,54 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.ReleaseFailureException; + +import java.util.List; + +/** + * Exception occurring during an SCM repository operation. + * + * @author Brett Porter + */ +public class ReleaseScmRepositoryException + extends ReleaseFailureException +{ + public ReleaseScmRepositoryException( String message, List validationMessages ) + { + super( message + listValidationMessages( validationMessages ) ); + } + + private static String listValidationMessages( List messages ) + { + StringBuilder buffer = new StringBuilder(); + + if ( messages != null ) + { + for ( String message : messages ) + { + buffer.append( "\n - " ); + buffer.append( message ); + } + } + + return buffer.toString(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ScmRepositoryConfigurator.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ScmRepositoryConfigurator.java new file mode 100644 index 000000000..6281d631e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ScmRepositoryConfigurator.java @@ -0,0 +1,70 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.settings.Settings; +import org.apache.maven.shared.release.config.ReleaseDescriptor; + +/** + * Configure an SCM repository using release configuration. + * + * @author Brett Porter + */ +public interface ScmRepositoryConfigurator +{ + /** + * Construct a configured SCM repository from a release configuration. + * + * @param releaseDescriptor the configuration to insert into the repository + * @param settings the settings.xml configuraiton + * @return the repository created + * @throws ScmRepositoryException if it is not possible to create a suitable SCM repository + * @throws NoSuchScmProviderException if the requested SCM provider is not available + */ + ScmRepository getConfiguredRepository( ReleaseDescriptor releaseDescriptor, Settings settings ) + throws ScmRepositoryException, NoSuchScmProviderException; + + /** + * Get the SCM provider used for the given SCM repository. + * + * @param repository the SCM repository + * @return the SCM provider + * @throws NoSuchScmProviderException if the requested SCM provider is not available + */ + ScmProvider getRepositoryProvider( ScmRepository repository ) + throws NoSuchScmProviderException; + + /** + * Construct a configured SCM repository from a release configuration with an overridden base SCM URL. + * + * @param url the SCM URL to use instead of the one from the release descriptor + * @param releaseDescriptor the configuration to insert into the repository + * @param settings the settings.xml configuraiton + * @return the repository created + * @throws ScmRepositoryException if it is not possible to create a suitable SCM repository + * @throws NoSuchScmProviderException if the requested SCM provider is not available + */ + ScmRepository getConfiguredRepository( String url, ReleaseDescriptor releaseDescriptor, Settings settings ) + throws ScmRepositoryException, NoSuchScmProviderException; +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ScmTranslator.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ScmTranslator.java new file mode 100644 index 000000000..693f6469a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/ScmTranslator.java @@ -0,0 +1,66 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Translate the SCM information after tagging/reverting to trunk. + * + * @author Brett Porter + */ +// TODO move this API into SCM? +public interface ScmTranslator +{ + /** + * Take an URL and find the correct replacement URL for a given branch. + * + * @param url the source URL + * @param branchName the branch name + * @param branchBase the branch base for providers that support it + * @return the replacement URL + */ + String translateBranchUrl( String url, String branchName, String branchBase ); + + /** + * Take an URL and find the correct replacement URL for a given tag. + * + * @param url the source URL + * @param tag the tag + * @param tagBase the tag base for providers that support it + * @return the replacement URL + */ + String translateTagUrl( String url, String tag, String tagBase ); + + /** + * Determine what tag should be added to the POM given the original tag and the new one. + * + * @param tag the new tag + * @return the tag to use, or null if the provider does not use tags + */ + String resolveTag( String tag ); + + /** + * Translates an ScmFile path to a path relative to the working directory. + * + * @param path the ScmFile path + * @return the relative path with OS specific File separator + * @since 2.3.1 + */ + String toRelativePath( String path ); +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/SubversionScmTranslator.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/SubversionScmTranslator.java new file mode 100644 index 000000000..85b6bb698 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/scm/SubversionScmTranslator.java @@ -0,0 +1,72 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.ScmBranch; +import org.apache.maven.scm.ScmTag; +import org.apache.maven.scm.provider.svn.SvnTagBranchUtils; +import org.codehaus.plexus.component.annotations.Component; + +/** + * Subversion tag translator. + * + * @author Brett Porter + */ +@Component( role = ScmTranslator.class, hint = "svn" ) +public class SubversionScmTranslator + implements ScmTranslator +{ + /** + * {@inheritDoc} + */ + @Override + public String translateBranchUrl( String url, String branchName, String branchBase ) + { + return SvnTagBranchUtils.resolveUrl( url, branchBase, SvnTagBranchUtils.SVN_BRANCHES, + new ScmBranch( branchName ) ); + } + + /** + * {@inheritDoc} + */ + @Override + public String translateTagUrl( String url, String tag, String tagBase ) + { + return SvnTagBranchUtils.resolveUrl( url, tagBase, SvnTagBranchUtils.SVN_TAGS, new ScmTag( tag ) ); + } + + /** + * {@inheritDoc} + */ + @Override + public String resolveTag( String tag ) + { + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toRelativePath( String path ) + { + return path; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/strategies/DefaultStrategy.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/strategies/DefaultStrategy.java new file mode 100644 index 000000000..ad5c1ee6e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/strategies/DefaultStrategy.java @@ -0,0 +1,112 @@ +package org.apache.maven.shared.release.strategies; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.shared.release.strategy.Strategy; + +/** + * + * @author Robert Scholte + * @since 3.0.0 + */ +public class DefaultStrategy implements Strategy +{ + /** + * The phases of release to run, and in what order. + */ + private List preparePhases; + + /** + * The phases of release to run to perform. + */ + private List performPhases; + + /** + * The phases of release to run to rollback changes + */ + private List rollbackPhases; + + /** + * The phases to create a branch. + */ + private List branchPhases; + + /** + * The phases to create update versions. + */ + private List updateVersionsPhases; + + @Override + public List getPreparePhases() + { + return preparePhases; + } + + public void setPreparePhases( List preparePhases ) + { + this.preparePhases = preparePhases; + } + + @Override + public List getPerformPhases() + { + return performPhases; + } + + public void setPerformPhases( List performPhases ) + { + this.performPhases = performPhases; + } + + @Override + public List getRollbackPhases() + { + return rollbackPhases; + } + + public void setRollbackPhases( List rollbackPhases ) + { + this.rollbackPhases = rollbackPhases; + } + + @Override + public List getBranchPhases() + { + return branchPhases; + } + + public void setBranchPhases( List branchPhases ) + { + this.branchPhases = branchPhases; + } + + @Override + public List getUpdateVersionsPhases() + { + return updateVersionsPhases; + } + + public void setUpdateVersionsPhases( List updateVersionsPhases ) + { + this.updateVersionsPhases = updateVersionsPhases; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/MavenCoordinate.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/MavenCoordinate.java new file mode 100644 index 000000000..69b08e172 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/MavenCoordinate.java @@ -0,0 +1,39 @@ +package org.apache.maven.shared.release.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. + */ + +/** + * + * @author Robert Scholte + * @since 3.0 + */ +public interface MavenCoordinate +{ + String getGroupId(); + + String getArtifactId(); + + String getVersion(); + + void setVersion( String version ); + + // @todo helper method during refactoring, will be removed + String getName(); +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/ModelETL.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/ModelETL.java new file mode 100644 index 000000000..e0c255058 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/ModelETL.java @@ -0,0 +1,43 @@ +package org.apache.maven.shared.release.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.io.File; + +import org.apache.maven.model.Model; +import org.apache.maven.shared.release.ReleaseExecutionException; + +/** + * + * @author Robert Scholte + * @since 3.0 + */ +public interface ModelETL +{ + void extract( File pomFile ) throws ReleaseExecutionException; + + void transform(); + + void load( File pomFile ) throws ReleaseExecutionException; + + // will be removed once transform() is implemented + @Deprecated + Model getModel(); +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/ModelETLFactory.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/ModelETLFactory.java new file mode 100644 index 000000000..4748edc93 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/ModelETLFactory.java @@ -0,0 +1,30 @@ +package org.apache.maven.shared.release.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. + */ + +/** + * + * @author Robert Scholte + * @since 3.0 + */ +public interface ModelETLFactory +{ + ModelETL newInstance( ModelETLRequest request ); +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/ModelETLRequest.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/ModelETLRequest.java new file mode 100644 index 000000000..ae57d1f55 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/ModelETLRequest.java @@ -0,0 +1,67 @@ +package org.apache.maven.shared.release.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.project.MavenProject; +import org.apache.maven.shared.release.config.ReleaseDescriptor; + +/** + * + * @author Robert Scholte + * @since 3.0 + */ +public class ModelETLRequest +{ + private String lineSeparator; + + private MavenProject project; + + private ReleaseDescriptor releaseDescriptor; + + public String getLineSeparator() + { + return lineSeparator; + } + + public void setLineSeparator( String lineSeparator ) + { + this.lineSeparator = lineSeparator; + } + + public MavenProject getProject() + { + return project; + } + + public void setProject( MavenProject project ) + { + this.project = project; + } + + public ReleaseDescriptor getReleaseDescriptor() + { + return releaseDescriptor; + } + + public void setReleaseDescriptor( ReleaseDescriptor releaseDescriptor ) + { + this.releaseDescriptor = releaseDescriptor; + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomBuild.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomBuild.java new file mode 100644 index 000000000..433c8f49c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomBuild.java @@ -0,0 +1,329 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.apache.maven.model.Build; +import org.apache.maven.model.Extension; +import org.apache.maven.model.Plugin; +import org.apache.maven.model.PluginManagement; +import org.apache.maven.model.Resource; +import org.jdom.Element; +/** + * JDom implementation of poms BUILD element + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomBuild + extends Build +{ + private final Element build; + + public JDomBuild( Element build ) + { + this.build = build; + } + + @Override + public void addExtension( Extension extension ) + { + throw new UnsupportedOperationException(); + } + + @Override + public List getExtensions() + { + Element extensionsElm = build.getChild( "extensions", build.getNamespace() ); + if ( extensionsElm == null ) + { + return Collections.emptyList(); + } + else + { + List extensionElms = extensionsElm.getChildren( "extension", build.getNamespace() ); + + List extensions = new ArrayList<>( extensionElms.size() ); + for ( Element extensionElm : extensionElms ) + { + extensions.add( new JDomExtension( extensionElm ) ); + } + return extensions; + } + } + + @Override + public String getOutputDirectory() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getScriptSourceDirectory() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getSourceDirectory() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getTestOutputDirectory() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getTestSourceDirectory() + { + throw new UnsupportedOperationException(); + } + + @Override + public void removeExtension( Extension extension ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setExtensions( List extensions ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setOutputDirectory( String outputDirectory ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setScriptSourceDirectory( String scriptSourceDirectory ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setSourceDirectory( String sourceDirectory ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setTestOutputDirectory( String testOutputDirectory ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setTestSourceDirectory( String testSourceDirectory ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void addFilter( String string ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void addResource( Resource resource ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void addTestResource( Resource resource ) + { + throw new UnsupportedOperationException(); + } + + @Override + public String getDefaultGoal() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getDirectory() + { + throw new UnsupportedOperationException(); + } + + @Override + public List getFilters() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getFinalName() + { + throw new UnsupportedOperationException(); + } + + @Override + public List getResources() + { + throw new UnsupportedOperationException(); + } + + @Override + public List getTestResources() + { + throw new UnsupportedOperationException(); + } + + @Override + public void removeFilter( String string ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void removeResource( Resource resource ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void removeTestResource( Resource resource ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setDefaultGoal( String defaultGoal ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setDirectory( String directory ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setFilters( List filters ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setFinalName( String finalName ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setResources( List resources ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setTestResources( List testResources ) + { + throw new UnsupportedOperationException(); + } + + @Override + public PluginManagement getPluginManagement() + { + Element pluginManagementElm = build.getChild( "pluginManagement", build.getNamespace() ); + if ( pluginManagementElm == null ) + { + return null; + } + else + { + return new JDomPluginManagement( pluginManagementElm ); + } + } + + @Override + public void setPluginManagement( PluginManagement pluginManagement ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void addPlugin( Plugin plugin ) + { + throw new UnsupportedOperationException(); + } + + @Override + public List getPlugins() + { + Element pluginsElm = build.getChild( "plugins", build.getNamespace() ); + if ( pluginsElm == null ) + { + return Collections.emptyList(); + } + else + { + List pluginElms = + pluginsElm.getChildren( "plugin", build.getNamespace() ); + + List plugins = new ArrayList<>( pluginElms.size() ); + + for ( Element pluginElm : pluginElms ) + { + plugins.add( new JDomPlugin( pluginElm ) ); + } + + return plugins; + } + } + + @Override + public void removePlugin( Plugin plugin ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setPlugins( List plugins ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void flushPluginMap() + { + throw new UnsupportedOperationException(); + } + + @Override + public Map getPluginsAsMap() + { + throw new UnsupportedOperationException(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomDependency.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomDependency.java new file mode 100644 index 000000000..96b99d1fd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomDependency.java @@ -0,0 +1,169 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.model.Dependency; +import org.apache.maven.model.Exclusion; +import org.apache.maven.shared.release.transform.MavenCoordinate; +import org.jdom.Element; + +/** + * JDom implementation of poms DEPENDENCY element + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomDependency extends Dependency implements MavenCoordinate +{ + private final MavenCoordinate coordinate; + + public JDomDependency( Element dependency ) + { + this.coordinate = new JDomMavenCoordinate( dependency ); + } + + @Override + public void addExclusion( Exclusion exclusion ) + { + throw new UnsupportedOperationException(); + } + + @Override + public String getArtifactId() + { + return coordinate.getArtifactId(); + } + + @Override + public String getClassifier() + { + throw new UnsupportedOperationException(); + } + + @Override + public List getExclusions() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getGroupId() + { + return coordinate.getGroupId(); + } + + @Override + public String getScope() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getSystemPath() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getType() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getVersion() + { + return coordinate.getVersion(); + } + + @Override + public boolean isOptional() + { + throw new UnsupportedOperationException(); + } + + @Override + public void removeExclusion( Exclusion exclusion ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setArtifactId( String artifactId ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setClassifier( String classifier ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setExclusions( List exclusions ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setGroupId( String groupId ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setOptional( boolean optional ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setScope( String scope ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setSystemPath( String systemPath ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setType( String type ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setVersion( String version ) + { + coordinate.setVersion( version ); + } + + @Override + public String getName() + { + return "dependency"; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomDependencyManagement.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomDependencyManagement.java new file mode 100644 index 000000000..aade7c8ef --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomDependencyManagement.java @@ -0,0 +1,87 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.apache.maven.model.Dependency; +import org.apache.maven.model.DependencyManagement; +import org.jdom.Element; + +/** + * JDom implementation of poms DEPENDENCYMANAGEMENT element + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomDependencyManagement extends DependencyManagement +{ + private final Element dependencyManagement; + + public JDomDependencyManagement( Element dependencyManagement ) + { + this.dependencyManagement = dependencyManagement; + } + + @Override + public void addDependency( Dependency dependency ) + { + throw new UnsupportedOperationException(); + } + + @Override + public List getDependencies() + { + Element dependenciesElm = dependencyManagement.getChild( "dependencies", dependencyManagement.getNamespace() ); + if ( dependenciesElm == null ) + { + return Collections.emptyList(); + } + else + { + List dependencyElms = + dependenciesElm.getChildren( "dependency", dependencyManagement.getNamespace() ); + + List dependencies = new ArrayList<>( dependencyElms.size() ); + + for ( Element dependencyElm : dependencyElms ) + { + dependencies.add( new JDomDependency( dependencyElm ) ); + } + + return dependencies; + } + } + + @Override + public void removeDependency( Dependency dependency ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setDependencies( List dependencies ) + { + throw new UnsupportedOperationException(); + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomExtension.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomExtension.java new file mode 100644 index 000000000..a5dca63f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomExtension.java @@ -0,0 +1,82 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.Extension; +import org.apache.maven.shared.release.transform.MavenCoordinate; +import org.jdom.Element; + +/** + * JDom implementation of poms EXTENSION element + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomExtension extends Extension implements MavenCoordinate +{ + private final MavenCoordinate coordinate; + + public JDomExtension( Element extension ) + { + this.coordinate = new JDomMavenCoordinate( extension ); + } + + @Override + public String getArtifactId() + { + return coordinate.getArtifactId(); + } + + @Override + public String getGroupId() + { + return coordinate.getGroupId(); + } + + @Override + public String getVersion() + { + return coordinate.getVersion(); + } + + @Override + public void setArtifactId( String artifactId ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setGroupId( String groupId ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setVersion( String version ) + { + coordinate.setVersion( version ); + } + + @Override + public String getName() + { + return "extension"; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomMavenCoordinate.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomMavenCoordinate.java new file mode 100644 index 000000000..83b927a4c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomMavenCoordinate.java @@ -0,0 +1,82 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.transform.MavenCoordinate; +import org.jdom.Element; + +/** + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomMavenCoordinate implements MavenCoordinate +{ + private final Element element; + + public JDomMavenCoordinate( Element elm ) + { + this.element = elm; + } + + @Override + public String getGroupId() + { + return element.getChildTextTrim( "groupId", element.getNamespace() ); + } + + @Override + public String getArtifactId() + { + return element.getChildTextTrim( "artifactId", element.getNamespace() ); + } + + @Override + public String getVersion() + { + Element version = getVersionElement(); + if ( version == null ) + { + return null; + } + else + { + return version.getTextTrim(); + } + + } + + private Element getVersionElement() + { + return element.getChild( "version", element.getNamespace() ); + } + + @Override + public void setVersion( String version ) + { + JDomUtils.rewriteValue( getVersionElement(), version ); + } + + @Override + public String getName() + { + return element.getName(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModel.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModel.java new file mode 100644 index 000000000..88271ba26 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModel.java @@ -0,0 +1,227 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Properties; + +import org.apache.maven.model.Build; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.DependencyManagement; +import org.apache.maven.model.Model; +import org.apache.maven.model.Parent; +import org.apache.maven.model.Profile; +import org.apache.maven.model.Reporting; +import org.apache.maven.model.Scm; +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.Text; + +/** + * JDom implementation of poms PROJECT element + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomModel extends Model +{ + private final Element project; + + private final JDomModelBase modelBase; + + public JDomModel( Document document ) + { + this( document.getRootElement() ); + } + + public JDomModel( Element project ) + { + this.project = project; + this.modelBase = new JDomModelBase( project ); + } + + @Override + public Build getBuild() + { + return modelBase.getBuild(); + } + + @Override + public List getDependencies() + { + return modelBase.getDependencies(); + } + + @Override + public DependencyManagement getDependencyManagement() + { + return modelBase.getDependencyManagement(); + } + + @Override + public Parent getParent() + { + Element elm = getParentElement(); + if ( elm == null ) + { + return null; + } + else + { + // this way scm setters change DOM tree immediately + return new JDomParent( elm ); + } + } + + private Element getParentElement() + { + return project.getChild( "parent", project.getNamespace() ); + } + + @Override + public List getProfiles() + { + Element profilesElm = project.getChild( "profiles", project.getNamespace() ); + if ( profilesElm == null ) + { + return Collections.emptyList(); + } + else + { + List profileElms = profilesElm.getChildren( "profile", project.getNamespace() ); + + List profiles = new ArrayList<>( profileElms.size() ); + + for ( Element profileElm : profileElms ) + { + profiles.add( new JDomProfile( profileElm ) ); + } + + return profiles; + } + } + + + @Override + public Properties getProperties() + { + Element properties = project.getChild( "properties", project.getNamespace() ); + + if ( properties == null ) + { + return null; + } + else + { + return new JDomProperties( properties ); + } + } + + @Override + public Reporting getReporting() + { + Element reporting = project.getChild( "reporting", project.getNamespace() ); + + if ( reporting == null ) + { + return null; + } + else + { + return new JDomReporting( reporting ); + } + } + + @Override + public void setScm( Scm scm ) + { + if ( scm == null ) + { + JDomUtils.rewriteElement( "scm", null, project, project.getNamespace() ); + } + else + { + Element scmRoot = new Element( "scm" ); + scmRoot.addContent( "\n " ); + + // Write current values to JDom tree + Scm jdomScm = new JDomScm( scmRoot ); + jdomScm.setConnection( scm.getConnection() ); + jdomScm.setDeveloperConnection( scm.getDeveloperConnection() ); + jdomScm.setTag( scm.getTag() ); + jdomScm.setUrl( scm.getUrl() ); + + project.addContent( "\n " ).addContent( scmRoot ).addContent( "\n" ); + } + } + + @Override + public Scm getScm() + { + Element elm = project.getChild( "scm", project.getNamespace() ); + if ( elm == null ) + { + return null; + } + else + { + // this way scm setters change DOM tree immediately + return new JDomScm( elm ); + } + } + + @Override + public void setVersion( String version ) + { + Element versionElement = project.getChild( "version", project.getNamespace() ); + + String parentVersion; + Element parent = getParentElement(); + if ( parent != null ) + { + parentVersion = parent.getChildTextTrim( "version", project.getNamespace() ); + } + else + { + parentVersion = null; + } + + if ( versionElement == null ) + { + if ( !version.equals( parentVersion ) ) + { + // we will add this after artifactId, since it was missing but different from the inherited version + Element artifactIdElement = project.getChild( "artifactId", project.getNamespace() ); + int index = project.indexOf( artifactIdElement ); + + versionElement = new Element( "version", project.getNamespace() ); + versionElement.setText( version ); + project.addContent( index + 1, new Text( "\n " ) ); + project.addContent( index + 2, versionElement ); + } + } + else + { + JDomUtils.rewriteValue( versionElement, version ); + } + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelBase.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelBase.java new file mode 100644 index 000000000..cdc6442ce --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelBase.java @@ -0,0 +1,94 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.apache.maven.model.Build; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.DependencyManagement; +import org.jdom.Element; + +/** + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomModelBase +{ + private final Element modelBase; + + public JDomModelBase( Element modelBase ) + { + this.modelBase = modelBase; + } + + public Build getBuild() + { + Element elm = modelBase.getChild( "build", modelBase.getNamespace() ); + if ( elm == null ) + { + return null; + } + else + { + // this way build setters change DOM tree immediately + return new JDomBuild( elm ); + } + } + + public List getDependencies() + { + Element dependenciesElm = modelBase.getChild( "dependencies", modelBase.getNamespace() ); + if ( dependenciesElm == null ) + { + return Collections.emptyList(); + } + else + { + List dependencyElms = dependenciesElm.getChildren( "dependency", modelBase.getNamespace() ); + + List dependencies = new ArrayList<>( dependencyElms.size() ); + + for ( Element dependencyElm : dependencyElms ) + { + dependencies.add( new JDomDependency( dependencyElm ) ); + } + + return dependencies; + } + } + + public DependencyManagement getDependencyManagement() + { + Element elm = modelBase.getChild( "dependencyManagement", modelBase.getNamespace() ); + if ( elm == null ) + { + return null; + } + else + { + // this way build setters change DOM tree immediately + return new JDomDependencyManagement( elm ); + } + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelETL.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelETL.java new file mode 100644 index 000000000..e0b845788 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelETL.java @@ -0,0 +1,234 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.IOException; +import java.io.StringReader; +import java.io.StringWriter; +import java.io.Writer; +import java.util.Iterator; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.maven.model.Model; +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.transform.ModelETL; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.util.WriterFactory; +import org.jdom.CDATA; +import org.jdom.Comment; +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.JDOMException; +import org.jdom.Namespace; +import org.jdom.filter.ContentFilter; +import org.jdom.filter.ElementFilter; +import org.jdom.input.SAXBuilder; +import org.jdom.output.Format; +import org.jdom.output.XMLOutputter; + +/** + * JDom implementation for extracting, transform, loading the Model (pom.xml) + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomModelETL implements ModelETL +{ + private ReleaseDescriptor releaseDescriptor; + + private MavenProject project; + + private Document document; + + private String intro = null; + private String outtro = null; + + private String ls = ReleaseUtil.LS; + + public void setLs( String ls ) + { + this.ls = ls; + } + + public void setReleaseDescriptor( ReleaseDescriptor releaseDescriptor ) + { + this.releaseDescriptor = releaseDescriptor; + } + + public void setProject( MavenProject project ) + { + this.project = project; + } + + @Override + public void extract( File pomFile ) throws ReleaseExecutionException + { + try + { + String content = ReleaseUtil.readXmlFile( pomFile, ls ); + // we need to eliminate any extra whitespace inside elements, as JDOM will nuke it + content = content.replaceAll( "<([^!][^>]*?)\\s{2,}([^>]*?)>", "<$1 $2>" ); + content = content.replaceAll( "(\\s{2,})/>", "$1 />" ); + + SAXBuilder builder = new SAXBuilder(); + document = builder.build( new StringReader( content ) ); + + // Normalize line endings to platform's style (XML processors like JDOM normalize line endings to "\n" as + // per section 2.11 of the XML spec) + normaliseLineEndings( document ); + + // rewrite DOM as a string to find differences, since text outside the root element is not tracked + StringWriter w = new StringWriter(); + Format format = Format.getRawFormat(); + format.setLineSeparator( ls ); + XMLOutputter out = new XMLOutputter( format ); + out.output( document.getRootElement(), w ); + + int index = content.indexOf( w.toString() ); + if ( index >= 0 ) + { + intro = content.substring( 0, index ); + outtro = content.substring( index + w.toString().length() ); + } + else + { + /* + * NOTE: Due to whitespace, attribute reordering or entity expansion the above indexOf test can easily + * fail. So let's try harder. Maybe some day, when JDOM offers a StaxBuilder and this builder employes + * XMLInputFactory2.P_REPORT_PROLOG_WHITESPACE, this whole mess can be avoided. + */ + // CHECKSTYLE_OFF: LocalFinalVariableName + final String SPACE = "\\s++"; + final String XML = "<\\?(?:(?:[^\"'>]++)|(?:\"[^\"]*+\")|(?:'[^\']*+'))*+>"; + final String INTSUB = "\\[(?:(?:[^\"'\\]]++)|(?:\"[^\"]*+\")|(?:'[^\']*+'))*+\\]"; + final String DOCTYPE = + "]++)|(?:\"[^\"]*+\")|(?:'[^\']*+')|(?:" + INTSUB + "))*+>"; + final String PI = XML; + final String COMMENT = ""; + + final String INTRO = + "(?:(?:" + SPACE + ")|(?:" + XML + ")|(?:" + DOCTYPE + ")|(?:" + COMMENT + ")|(?:" + PI + "))*"; + final String OUTRO = "(?:(?:" + SPACE + ")|(?:" + COMMENT + ")|(?:" + PI + "))*"; + final String POM = "(?s)(" + INTRO + ")(.*?)(" + OUTRO + ")"; + // CHECKSTYLE_ON: LocalFinalVariableName + + Matcher matcher = Pattern.compile( POM ).matcher( content ); + if ( matcher.matches() ) + { + intro = matcher.group( 1 ); + outtro = matcher.group( matcher.groupCount() ); + } + } + } + catch ( JDOMException | IOException e ) + { + throw new ReleaseExecutionException( "Error reading POM: " + e.getMessage(), e ); + } + } + + @Override + public void transform() + { + + } + + @Override + public void load( File targetFile ) throws ReleaseExecutionException + { + writePom( targetFile, document, releaseDescriptor, project.getModelVersion(), intro, outtro ); + } + + @Override + public Model getModel() + { + return new JDomModel( document ); + } + + private void normaliseLineEndings( Document document ) + { + for ( Iterator i = document.getDescendants( new ContentFilter( ContentFilter.COMMENT ) ); i.hasNext(); ) + { + Comment c = (Comment) i.next(); + c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ls ) ); + } + for ( Iterator i = document.getDescendants( new ContentFilter( ContentFilter.CDATA ) ); i.hasNext(); ) + { + CDATA c = (CDATA) i.next(); + c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ls ) ); + } + } + + private void writePom( File pomFile, Document document, ReleaseDescriptor releaseDescriptor, String modelVersion, + String intro, String outtro ) + throws ReleaseExecutionException + { + Element rootElement = document.getRootElement(); + + if ( releaseDescriptor.isAddSchema() ) + { + Namespace pomNamespace = Namespace.getNamespace( "", "http://maven.apache.org/POM/" + modelVersion ); + rootElement.setNamespace( pomNamespace ); + Namespace xsiNamespace = Namespace.getNamespace( "xsi", "http://www.w3.org/2001/XMLSchema-instance" ); + rootElement.addNamespaceDeclaration( xsiNamespace ); + + if ( rootElement.getAttribute( "schemaLocation", xsiNamespace ) == null ) + { + rootElement.setAttribute( "schemaLocation", "http://maven.apache.org/POM/" + modelVersion + + " https://maven.apache.org/xsd/maven-" + modelVersion + ".xsd", xsiNamespace ); + } + + // the empty namespace is considered equal to the POM namespace, so match them up to avoid extra xmlns="" + ElementFilter elementFilter = new ElementFilter( Namespace.getNamespace( "" ) ); + for ( Iterator i = rootElement.getDescendants( elementFilter ); i.hasNext(); ) + { + Element e = (Element) i.next(); + e.setNamespace( pomNamespace ); + } + } + + + try ( Writer writer = WriterFactory.newXmlWriter( pomFile ) ) + { + if ( intro != null ) + { + writer.write( intro ); + } + + Format format = Format.getRawFormat(); + format.setLineSeparator( ls ); + XMLOutputter out = new XMLOutputter( format ); + out.output( document.getRootElement(), writer ); + + if ( outtro != null ) + { + writer.write( outtro ); + } + } + catch ( IOException e ) + { + throw new ReleaseExecutionException( "Error writing POM: " + e.getMessage(), e ); + } + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelETLFactory.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelETLFactory.java new file mode 100644 index 000000000..26ebe5de5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelETLFactory.java @@ -0,0 +1,46 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.transform.ModelETLRequest; +import org.apache.maven.shared.release.transform.ModelETLFactory; +import org.codehaus.plexus.component.annotations.Component; + +/** + * @author Robert Scholte + * @since 3.0 + */ +@Component( role = ModelETLFactory.class, hint = JDomModelETLFactory.ROLE_HINT ) +public class JDomModelETLFactory implements ModelETLFactory +{ + public static final String ROLE_HINT = "jdom-sax"; + + @Override + public JDomModelETL newInstance( ModelETLRequest request ) + { + JDomModelETL result = new JDomModelETL(); + + result.setLs( request.getLineSeparator() ); + result.setProject( request.getProject() ); + result.setReleaseDescriptor( request.getReleaseDescriptor() ); + + return result; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomParent.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomParent.java new file mode 100644 index 000000000..be345df4c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomParent.java @@ -0,0 +1,93 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.model.Parent; +import org.jdom.Element; + +/** + * JDom implementation of poms PARENT element + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomParent extends Parent +{ + private Element parent; + + public JDomParent( Element parent ) + { + this.parent = parent; + } + + @Override + public String getVersion() + { + throw new UnsupportedOperationException(); + } + + @Override + public void setVersion( String version ) + { + JDomUtils.rewriteElement( "version", version, parent, parent.getNamespace() ); + } + + @Override + public String getArtifactId() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getGroupId() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getRelativePath() + { + throw new UnsupportedOperationException(); + } + + @Override + public void setArtifactId( String artifactId ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setGroupId( String groupId ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setRelativePath( String relativePath ) + { + throw new UnsupportedOperationException(); + } + + @Override + public String getId() + { + throw new UnsupportedOperationException(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomPlugin.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomPlugin.java new file mode 100644 index 000000000..bf21eeab2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomPlugin.java @@ -0,0 +1,193 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.apache.maven.model.Dependency; +import org.apache.maven.model.Plugin; +import org.apache.maven.model.PluginExecution; +import org.apache.maven.shared.release.transform.MavenCoordinate; +import org.jdom.Element; + +/** + * JDom implementation of poms PLUGIN element + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomPlugin extends Plugin implements MavenCoordinate +{ + private Element plugin; + private final MavenCoordinate coordinate; + + public JDomPlugin( Element plugin ) + { + this.plugin = plugin; + this.coordinate = new JDomMavenCoordinate( plugin ); + } + + @Override + public void addDependency( Dependency dependency ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void addExecution( PluginExecution pluginExecution ) + { + throw new UnsupportedOperationException(); + } + + @Override + public String getArtifactId() + { + return coordinate.getArtifactId(); + } + + @Override + public List getDependencies() + { + Element dependenciesElm = plugin.getChild( "dependencies", plugin.getNamespace() ); + if ( dependenciesElm == null ) + { + return Collections.emptyList(); + } + else + { + List dependencyElms = + dependenciesElm.getChildren( "dependency", plugin.getNamespace() ); + + List dependencies = new ArrayList<>( dependencyElms.size() ); + + for ( Element dependencyElm : dependencyElms ) + { + dependencies.add( new JDomDependency( dependencyElm ) ); + } + + return dependencies; + } + } + + @Override + public List getExecutions() + { + throw new UnsupportedOperationException(); + } + + @Override + public Object getGoals() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getGroupId() + { + return coordinate.getGroupId(); + } + + @Override + public String getVersion() + { + return coordinate.getVersion(); + } + + @Override + public boolean isExtensions() + { + throw new UnsupportedOperationException(); + } + + @Override + public void removeDependency( Dependency dependency ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void removeExecution( PluginExecution pluginExecution ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setArtifactId( String artifactId ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setDependencies( List dependencies ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setExecutions( List executions ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setExtensions( boolean extensions ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setGoals( Object goals ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setGroupId( String groupId ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setVersion( String version ) + { + coordinate.setVersion( version ); + } + + @Override + public void flushExecutionMap() + { + throw new UnsupportedOperationException(); + } + + @Override + public Map getExecutionsAsMap() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getName() + { + return "plugin"; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomPluginManagement.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomPluginManagement.java new file mode 100644 index 000000000..b997bde20 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomPluginManagement.java @@ -0,0 +1,98 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.apache.maven.model.Plugin; +import org.apache.maven.model.PluginManagement; +import org.jdom.Element; + +/** + * JDom implementation of poms PLUGINMANAGEMENT element + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomPluginManagement extends PluginManagement +{ + private final Element pluginManagement; + + public JDomPluginManagement( Element pluginManagement ) + { + this.pluginManagement = pluginManagement; + } + + @Override + public void addPlugin( Plugin plugin ) + { + throw new UnsupportedOperationException(); + } + + @Override + public List getPlugins() + { + Element pluginsElm = pluginManagement.getChild( "plugins", pluginManagement.getNamespace() ); + if ( pluginsElm == null ) + { + return Collections.emptyList(); + } + else + { + List pluginElms = pluginsElm.getChildren( "plugin", pluginManagement.getNamespace() ); + + List plugins = new ArrayList<>( pluginElms.size() ); + + for ( Element pluginElm : pluginElms ) + { + plugins.add( new JDomPlugin( pluginElm ) ); + } + + return plugins; + } + } + + @Override + public void removePlugin( Plugin plugin ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setPlugins( List plugins ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void flushPluginMap() + { + throw new UnsupportedOperationException(); + } + + @Override + public Map getPluginsAsMap() + { + throw new UnsupportedOperationException(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomProfile.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomProfile.java new file mode 100644 index 000000000..0bcc4bb70 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomProfile.java @@ -0,0 +1,63 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.model.BuildBase; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.DependencyManagement; +import org.apache.maven.model.Profile; +import org.jdom.Element; + +/** + * JDom implementation of poms PROFILE element + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomProfile + extends Profile +{ + private final JDomModelBase modelBase; + + public JDomProfile( Element profile ) + { + this.modelBase = new JDomModelBase( profile ) ; + } + + @Override + public BuildBase getBuild() + { + return modelBase.getBuild(); + } + + @Override + public List getDependencies() + { + return modelBase.getDependencies(); + } + + @Override + public DependencyManagement getDependencyManagement() + { + return modelBase.getDependencyManagement(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomProperties.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomProperties.java new file mode 100644 index 000000000..a0f4c75c9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomProperties.java @@ -0,0 +1,161 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.Reader; +import java.io.Writer; +import java.util.Enumeration; +import java.util.InvalidPropertiesFormatException; +import java.util.Properties; +import java.util.Set; + +import org.jdom.Element; + +/** + * JDom implementation of poms PROPERTIES element + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomProperties extends Properties +{ + private final Element properties; + + public JDomProperties( Element properties ) + { + this.properties = properties; + } + + @Override + public synchronized Object setProperty( String key, String value ) + { + Element property = properties.getChild( key, properties.getNamespace() ); + + JDomUtils.rewriteValue( property, value ); + + // todo follow specs of Hashtable.put + return null; + } + + @Override + public synchronized void load( Reader reader ) + throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public synchronized void load( InputStream inStream ) + throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public void save( OutputStream out, String comments ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void store( Writer writer, String comments ) + throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public void store( OutputStream out, String comments ) + throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public synchronized void loadFromXML( InputStream in ) + throws IOException, InvalidPropertiesFormatException + { + throw new UnsupportedOperationException(); + } + + @Override + public void storeToXML( OutputStream os, String comment ) + throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public void storeToXML( OutputStream os, String comment, String encoding ) + throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public String getProperty( String key ) + { + Element property = properties.getChild( key, properties.getNamespace() ); + + if ( property == null ) + { + return null; + } + else + { + return property.getTextTrim(); + } + } + + @Override + public String getProperty( String key, String defaultValue ) + { + throw new UnsupportedOperationException(); + } + + @Override + public Enumeration propertyNames() + { + throw new UnsupportedOperationException(); + } + + @Override + public Set stringPropertyNames() + { + throw new UnsupportedOperationException(); + } + + @Override + public void list( PrintStream out ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void list( PrintWriter out ) + { + throw new UnsupportedOperationException(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReportPlugin.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReportPlugin.java new file mode 100644 index 000000000..b781ef116 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReportPlugin.java @@ -0,0 +1,165 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; +import java.util.Map; + +import org.apache.maven.model.ReportPlugin; +import org.apache.maven.model.ReportSet; +import org.apache.maven.shared.release.transform.MavenCoordinate; +import org.jdom.Element; + +/** + * JDom implementation of poms reports PLUGIN element + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomReportPlugin + extends ReportPlugin implements MavenCoordinate +{ + private final MavenCoordinate coordinate; + + public JDomReportPlugin( Element reportPlugin ) + { + this.coordinate = new JDomMavenCoordinate( reportPlugin ); + } + + @Override + public void addReportSet( ReportSet reportSet ) + { + throw new UnsupportedOperationException(); + } + + @Override + public String getArtifactId() + { + return coordinate.getArtifactId(); + } + + @Override + public Object getConfiguration() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getGroupId() + { + return coordinate.getGroupId(); + } + + @Override + public String getInherited() + { + throw new UnsupportedOperationException(); + } + + @Override + public List getReportSets() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getVersion() + { + return coordinate.getVersion(); + } + + @Override + public void removeReportSet( ReportSet reportSet ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setArtifactId( String artifactId ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setConfiguration( Object configuration ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setGroupId( String groupId ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setInherited( String inherited ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setReportSets( List reportSets ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setVersion( String version ) + { + coordinate.setVersion( version ); + } + + @Override + public void flushReportSetMap() + { + throw new UnsupportedOperationException(); + } + + @Override + public Map getReportSetsAsMap() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getKey() + { + throw new UnsupportedOperationException(); + } + + @Override + public void unsetInheritanceApplied() + { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isInheritanceApplied() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getName() + { + return "plugin"; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReporting.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReporting.java new file mode 100644 index 000000000..2a07f15a1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReporting.java @@ -0,0 +1,123 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.apache.maven.model.ReportPlugin; +import org.apache.maven.model.Reporting; +import org.jdom.Element; + +/** + * JDom implementation of poms REPORTING element + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomReporting extends Reporting +{ + + private final Element reporting; + + public JDomReporting( Element reporting ) + { + this.reporting = reporting; + } + + @Override + public void addPlugin( ReportPlugin reportPlugin ) + { + throw new UnsupportedOperationException(); + } + + @Override + public String getOutputDirectory() + { + throw new UnsupportedOperationException(); + } + + @Override + public List getPlugins() + { + Element pluginsElm = reporting.getChild( "plugins", reporting.getNamespace() ); + if ( pluginsElm == null ) + { + return Collections.emptyList(); + } + else + { + List pluginElms = pluginsElm.getChildren( "plugin", reporting.getNamespace() ); + + List plugins = new ArrayList<>( pluginElms.size() ); + + for ( Element pluginElm : pluginElms ) + { + plugins.add( new JDomReportPlugin( pluginElm ) ); + } + + return plugins; + } + } + + @Override + public void removePlugin( ReportPlugin reportPlugin ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setOutputDirectory( String outputDirectory ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void setPlugins( List plugins ) + { + throw new UnsupportedOperationException(); + } + + @Override + public void flushReportPluginMap() + { + throw new UnsupportedOperationException(); + } + + @Override + public Map getReportPluginsAsMap() + { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isExcludeDefaults() + { + throw new UnsupportedOperationException(); + } + + @Override + public void setExcludeDefaults( boolean excludeDefaults ) + { + throw new UnsupportedOperationException(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomScm.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomScm.java new file mode 100644 index 000000000..9187dcc2d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomScm.java @@ -0,0 +1,87 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.Scm; +import org.jdom.Element; + +/** + * JDom implementation of poms SCM element + * + * @author Robert Scholte + * @since 3.0 + */ +public class JDomScm extends Scm +{ + private Element scm; + + JDomScm( Element scm ) + { + this.scm = scm; + } + + @Override + public String getConnection() + { + throw new UnsupportedOperationException(); + } + + @Override + public void setConnection( String connection ) + { + JDomUtils.rewriteElement( "connection", connection, scm, scm.getNamespace() ); + } + + @Override + public String getDeveloperConnection() + { + throw new UnsupportedOperationException(); + } + + @Override + public void setDeveloperConnection( String developerConnection ) + { + JDomUtils.rewriteElement( "developerConnection", developerConnection, scm, scm.getNamespace() ); + } + + @Override + public String getTag() + { + throw new UnsupportedOperationException(); + } + + @Override + public void setTag( String tag ) + { + JDomUtils.rewriteElement( "tag", tag, scm, scm.getNamespace() ); + } + + @Override + public String getUrl() + { + throw new UnsupportedOperationException(); + } + + @Override + public void setUrl( String url ) + { + JDomUtils.rewriteElement( "url", url, scm, scm.getNamespace() ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomUtils.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomUtils.java new file mode 100644 index 000000000..17355f87b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomUtils.java @@ -0,0 +1,132 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Iterator; + +import org.jdom.Element; +import org.jdom.Namespace; +import org.jdom.Text; + +/** + * Common JDom functions + * + * @author Robert Scholte + * @since 3.0 + */ +public final class JDomUtils +{ + + private JDomUtils() + { + // noop + } + + /** + * Updates the text value of the given element. The primary purpose of this method is to preserve any whitespace and + * comments around the original text value. + * + * @param element The element to update, must not be null. + * @param value The text string to set, must not be null. + */ + public static void rewriteValue( Element element, String value ) + { + Text text = null; + if ( element.getContent() != null ) + { + for ( Iterator it = element.getContent().iterator(); it.hasNext(); ) + { + Object content = it.next(); + if ( ( content instanceof Text ) && ( (Text) content ).getTextTrim().length() > 0 ) + { + text = (Text) content; + while ( it.hasNext() ) + { + content = it.next(); + if ( content instanceof Text ) + { + text.append( (Text) content ); + it.remove(); + } + else + { + break; + } + } + break; + } + } + } + if ( text == null ) + { + element.addContent( value ); + } + else + { + String chars = text.getText(); + String trimmed = text.getTextTrim(); + int idx = chars.indexOf( trimmed ); + String leadingWhitespace = chars.substring( 0, idx ); + String trailingWhitespace = chars.substring( idx + trimmed.length() ); + text.setText( leadingWhitespace + value + trailingWhitespace ); + } + } + + public static Element rewriteElement( String name, String value, Element root, Namespace namespace ) + { + Element tagElement = root.getChild( name, namespace ); + if ( tagElement != null ) + { + if ( value != null ) + { + rewriteValue( tagElement, value ); + } + else + { + int index = root.indexOf( tagElement ); + root.removeContent( index ); + for ( int i = index - 1; i >= 0; i-- ) + { + if ( root.getContent( i ) instanceof Text ) + { + root.removeContent( i ); + } + else + { + break; + } + } + } + } + else + { + if ( value != null ) + { + Element element = new Element( name, namespace ); + element.setText( value ); + root.addContent( " " ).addContent( element ).addContent( "\n " ); + tagElement = element; + } + } + return tagElement; + } + + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/util/PomFinder.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/util/PomFinder.java new file mode 100644 index 000000000..df2519222 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/util/PomFinder.java @@ -0,0 +1,305 @@ +package org.apache.maven.shared.release.util; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.IOException; + +import org.apache.maven.model.Model; +import org.apache.maven.model.Parent; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.codehaus.plexus.logging.Logger; +import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.xml.XmlStreamReader; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +/** + *

This utility class helps with finding a maven pom file + * which got parsed previously. It uses the fact that the + * combination of any parent ids plus the ids of the current + * pom itself is unique.

+ *

This is e.g. needed for SCM systems which do not support + * sparse checkout but only can checkout the repository as whole + * like e.g. GIT. If the module which we are going to release is + * not in the parent directory, we first need to search for the + * 'right' sub directory in this case. + * subdirectory

+ * + *

Usage:

+ *

PomFinder is a statefull class. One instance of this class intended + * for a singular use! You need to create a new instance if you like + * to search for another pom.

+ *
    + *
  1. + * Parse an origin pom in a given directory with {@link #parsePom(java.io.File)} + * This will act as the information about what to search for. + *
  2. + *
  3. + * Search for the matching pom in a given tree using + * {@link #findMatchingPom(java.io.File)} + *
  4. + *
+ * + * @author Mark Struberg + */ +public class PomFinder +{ + + private Logger log; + private PomInfo foundPomInfo; + + public PomFinder( Logger log ) + { + this.log = log; + } + + /** + * + * @param originPom the pom File which should be used as blueprint for the search + * @return true if a pom got parsed successfully, false otherwise + */ + public boolean parsePom( File originPom ) + { + if ( !originPom.exists() ) + { + return false; + } + + try + { + foundPomInfo = readPomInfo( originPom ); + } + catch ( Exception e ) + { + log.warn( "Error while parsing pom file", e ); + return false; + } + + return foundPomInfo != null; + } + + /** + * Search for the previously with {@link #parsePom(java.io.File)} + * parsed pom in the given directory. + * @param startDirectory the initial directory + * @return the pom file which matches the previously parsed pom or null + * if no matching pom file could have been found. + */ + public File findMatchingPom( File startDirectory ) + { + if ( !startDirectory.exists() ) + { + return null; + } + + if ( !startDirectory.isDirectory() ) + { + log.error( "PomFinder must be started with a directory! Got " + startDirectory.getAbsolutePath() ); + return null; + } + + if ( foundPomInfo == null ) + { + log.error( "Please run parsePom first!" ); + return null; + } + + // look for the file in the current directory + File matchingPom = new File( startDirectory, foundPomInfo.getFileName() ); + if ( matchingPom.exists() ) + { + PomInfo pi = null; + try + { + pi = readPomInfo( matchingPom ); + } + catch ( Exception e ) + { + log.warn( "Error while parsing pom file", e ); + // do nothing, just continue with the search + // this might happen if a build contains unfinished pom.xml + // files in integration tests, etc + } + + if ( pi == null || !pi.equals( foundPomInfo ) ) + { + matchingPom = null; + } + } + else + { + matchingPom = null; + } + + if ( matchingPom == null ) + { + String[] childFiles = startDirectory.list(); + for ( int i = 0; i < childFiles.length; i++ ) + { + String childFile = childFiles[ i ]; + + File subDir = new File( startDirectory, childFile ); + if ( subDir.isDirectory() && !subDir.isHidden() ) + { + matchingPom = findMatchingPom( subDir ); + } + + if ( matchingPom != null ) + { + break; + } + } + } + + return matchingPom; + } + + + /** + * Read the {@link PomInfo} from the given pom file + * @param pomFile pom.xml file + * @return the PomInfo or nullEmmanuel Venisse + * @version $Id$ + */ +public class ReleaseUtil +{ + @SuppressWarnings( "checkstyle:constantname" ) + public static final String RELEASE_POMv4 = "release-pom.xml"; + + @SuppressWarnings( "checkstyle:constantname" ) + public static final String POMv4 = "pom.xml"; + + /** + * The line separator to use. + */ + public static final String LS = System.getProperty( "line.separator" ); + + private ReleaseUtil() + { + // noop + } + + public static MavenProject getRootProject( List reactorProjects ) + { + MavenProject project = reactorProjects.get( 0 ); + for ( MavenProject currentProject : reactorProjects ) + { + if ( currentProject.isExecutionRoot() ) + { + project = currentProject; + break; + } + } + + return project; + } + + public static File getStandardPom( MavenProject project ) + { + if ( project == null ) + { + return null; + } + + File pom = project.getFile(); + + if ( pom == null ) + { + return null; + } + + File releasePom = getReleasePom( project ); + if ( pom.equals( releasePom ) ) + { + pom = new File( pom.getParent(), POMv4 ); + } + + return pom; + } + + public static File getReleasePom( MavenProject project ) + { + if ( project == null ) + { + return null; + } + + File pom = project.getFile(); + + if ( pom == null ) + { + return null; + } + + return new File( pom.getParent(), RELEASE_POMv4 ); + } + + /** + * Gets the string contents of the specified XML file. Note: In contrast to an XML processor, the line separators in + * the returned string will be normalized to use the platform's native line separator. This is basically to save + * another normalization step when writing the string contents back to an XML file. + * + * @param file The path to the XML file to read in, must not be null. + * @return The string contents of the XML file. + * @throws IOException If the file could not be opened/read. + */ + public static String readXmlFile( File file ) + throws IOException + { + return readXmlFile( file, LS ); + } + + public static String readXmlFile( File file, String ls ) + throws IOException + { + try ( Reader reader = ReaderFactory.newXmlReader( file ) ) + { + return normalizeLineEndings( IOUtil.toString( reader ), ls ); + } + } + + /** + * Normalizes the line separators in the specified string. + * + * @param text The string to normalize, may be null. + * @param separator The line separator to use for normalization, typically "\n" or "\r\n", must not be + * null. + * @return The input string with normalized line separators or null if the string was null + * . + */ + public static String normalizeLineEndings( String text, String separator ) + { + String norm = text; + if ( text != null ) + { + norm = text.replaceAll( "(\r\n)|(\n)|(\r)", separator ); + } + return norm; + } + + public static ReleaseDescriptor createBasedirAlignedReleaseDescriptor( ReleaseDescriptor releaseDescriptor, + List reactorProjects ) + throws ReleaseExecutionException + { + int parentLevels = Paths.get( releaseDescriptor.getPomFileName() ).getNameCount() - 1; + + String url = releaseDescriptor.getScmSourceUrl(); + url = realignScmUrl( parentLevels, url ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setWorkingDirectory( releaseDescriptor.getWorkingDirectory() ); + builder.setScmSourceUrl( url ); + + return ReleaseUtils.buildReleaseDescriptor( builder ); + } + + public static int getBaseWorkingDirectoryParentCount( final Path baseDirectory, final Path workingDirectory ) + { + return Math.max( 0, workingDirectory.normalize().getNameCount() - baseDirectory.normalize().getNameCount() ); + } + + public static String realignScmUrl( int parentLevels, String url ) + { + if ( !StringUtils.isEmpty( url ) ) + { + // normalize + url = url.replaceAll( "/\\./", "/" ).replaceAll( "/\\.$", "" ). + replaceAll( "/[^/]+/\\.\\./", "/" ).replaceAll( "/[^/]+/\\.\\.$", "" ); + + int index = url.length(); + String suffix = ""; + if ( url.endsWith( "/" ) ) + { + index--; + suffix = "/"; + } + + for ( int i = 0; i < parentLevels && index > 0; i++ ) + { + index = url.lastIndexOf( '/', index - 1 ); + } + + if ( index > 0 ) + { + url = url.substring( 0, index ) + suffix; + } + + } + return url; + } + + public static String interpolate( String value, Model model ) + throws ReleaseExecutionException + { + if ( value != null && value.contains( "${" ) ) + { + StringSearchInterpolator interpolator = new StringSearchInterpolator(); + List pomPrefixes = Arrays.asList( "pom.", "project." ); + interpolator.addValueSource( new PrefixedObjectValueSource( pomPrefixes, model, false ) ); + interpolator.addValueSource( new MapBasedValueSource( model.getProperties() ) ); + interpolator.addValueSource( new ObjectBasedValueSource( model ) ); + try + { + value = interpolator.interpolate( value, new PrefixAwareRecursionInterceptor( pomPrefixes ) ); + } + catch ( InterpolationException e ) + { + throw new ReleaseExecutionException( + "Failed to interpolate " + value + " for project " + model.getId(), + e ); + } + } + return value; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/versions/DefaultVersionInfo.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/versions/DefaultVersionInfo.java new file mode 100644 index 000000000..71b496329 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/versions/DefaultVersionInfo.java @@ -0,0 +1,425 @@ +package org.apache.maven.shared.release.versions; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.artifact.versioning.DefaultArtifactVersion; +import org.codehaus.plexus.util.StringUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Locale; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * This compares and increments versions for a common java versioning scheme. + *

+ * The supported version scheme has the following parts.
+ * component-digits-annotation-annotationRevision-buildSpecifier
+ * Example:
+ * my-component-1.0.1-alpha-2-SNAPSHOT + * Terms: + *

    + *
  • component - name of the versioned component (log4j, commons-lang, etc) + *
  • digits - Numeric digits with at least one "." period. (1.0, 1.1, 1.01, 1.2.3, etc) + *
  • annotationRevision - Integer qualifier for the annotation. (4 as in RC-4) + *
  • buildSpecifier - Additional specifier for build. (SNAPSHOT, or build number like "20041114.081234-2") + *
+ * Digits is the only required piece of the version string, and must contain at lease one "." period. + * Implementation details:
+ * The separators "_" and "-" between components are also optional (though they are usually recommended).
+ * Example:
+ * log4j-1.2.9-beta-9-SNAPSHOT == log4j1.2.9beta9SNAPSHOT == log4j_1.2.9_beta_9_SNAPSHOT + * Leading zeros are significant when performing comparisons. + * TODO: this parser is better than DefaultArtifactVersion - replace it with this (but align naming) and then remove + * this from here. + */ +public class DefaultVersionInfo + implements VersionInfo +{ + private final String strVersion; + + private final List digits; + + private String annotation; + + private String annotationRevision; + + private final String buildSpecifier; + + private String annotationSeparator; + + private String annotationRevSeparator; + + private final String buildSeparator; + + private static final int DIGITS_INDEX = 1; + + private static final int ANNOTATION_SEPARATOR_INDEX = 2; + + private static final int ANNOTATION_INDEX = 3; + + private static final int ANNOTATION_REV_SEPARATOR_INDEX = 4; + + private static final int ANNOTATION_REVISION_INDEX = 5; + + private static final int BUILD_SEPARATOR_INDEX = 6; + + private static final int BUILD_SPECIFIER_INDEX = 7; + + private static final String SNAPSHOT_IDENTIFIER = "SNAPSHOT"; + + private static final String DIGIT_SEPARATOR_STRING = "."; + + public static final Pattern STANDARD_PATTERN = Pattern.compile( + "^((?:\\d+\\.)*\\d+)" // digit(s) and '.' repeated - followed by digit (version digits 1.22.0, etc) + + "([-_])?" // optional - or _ (annotation separator) + + "([a-zA-Z]*)" // alpha characters (looking for annotation - alpha, beta, RC, etc.) + + "([-_])?" // optional - or _ (annotation revision separator) + + "(\\d*)" // digits (any digits after rc or beta is an annotation revision) + + "(?:([-_])?(.*?))?$" ); // - or _ followed everything else (build specifier) + + /* * + * cmaki 02242009 + * FIX for non-digit release numbers, e.g. trunk-SNAPSHOT or just SNAPSHOT + * This alternate pattern supports version numbers like: + * trunk-SNAPSHOT + * branchName-SNAPSHOT + * SNAPSHOT + */ + // for SNAPSHOT releases only (possible versions include: trunk-SNAPSHOT or SNAPSHOT) + public static final Pattern ALTERNATE_PATTERN = Pattern.compile( "^(SNAPSHOT|[a-zA-Z]+[_-]SNAPSHOT)" ); + + /** + * Constructs this object and parses the supplied version string. + * + * @param version the version string + * @throws VersionParseException if an exception during parsing the input + */ + public DefaultVersionInfo( String version ) + throws VersionParseException + { + strVersion = version; + + // FIX for non-digit release numbers, e.g. trunk-SNAPSHOT or just SNAPSHOT + Matcher matcher = ALTERNATE_PATTERN.matcher( strVersion ); + // TODO: hack because it didn't support "SNAPSHOT" + if ( matcher.matches() ) + { + annotation = null; + digits = null; + buildSpecifier = version; + buildSeparator = null; + return; + } + + Matcher m = STANDARD_PATTERN.matcher( strVersion ); + if ( m.matches() ) + { + digits = parseDigits( m.group( DIGITS_INDEX ) ); + if ( !SNAPSHOT_IDENTIFIER.equals( m.group( ANNOTATION_INDEX ) ) ) + { + annotationSeparator = m.group( ANNOTATION_SEPARATOR_INDEX ); + annotation = nullIfEmpty( m.group( ANNOTATION_INDEX ) ); + + if ( StringUtils.isNotEmpty( m.group( ANNOTATION_REV_SEPARATOR_INDEX ) ) + && StringUtils.isEmpty( m.group( ANNOTATION_REVISION_INDEX ) ) ) + { + // The build separator was picked up as the annotation revision separator + buildSeparator = m.group( ANNOTATION_REV_SEPARATOR_INDEX ); + buildSpecifier = nullIfEmpty( m.group( BUILD_SPECIFIER_INDEX ) ); + } + else + { + annotationRevSeparator = m.group( ANNOTATION_REV_SEPARATOR_INDEX ); + annotationRevision = nullIfEmpty( m.group( ANNOTATION_REVISION_INDEX ) ); + + buildSeparator = m.group( BUILD_SEPARATOR_INDEX ); + buildSpecifier = nullIfEmpty( m.group( BUILD_SPECIFIER_INDEX ) ); + } + } + else + { + // Annotation was "SNAPSHOT" so populate the build specifier with that data + buildSeparator = m.group( ANNOTATION_SEPARATOR_INDEX ); + buildSpecifier = nullIfEmpty( m.group( ANNOTATION_INDEX ) ); + } + } + else + { + throw new VersionParseException( "Unable to parse the version string: \"" + version + "\"" ); + } + } + + public DefaultVersionInfo( List digits, String annotation, String annotationRevision, String buildSpecifier, + String annotationSeparator, String annotationRevSeparator, String buildSeparator ) + { + this.digits = digits; + this.annotation = annotation; + this.annotationRevision = annotationRevision; + this.buildSpecifier = buildSpecifier; + this.annotationSeparator = annotationSeparator; + this.annotationRevSeparator = annotationRevSeparator; + this.buildSeparator = buildSeparator; + this.strVersion = getVersionString( this, buildSpecifier, buildSeparator ); + } + + @Override + public boolean isSnapshot() + { + return ArtifactUtils.isSnapshot( strVersion ); + } + + @Override + public VersionInfo getNextVersion() + { + DefaultVersionInfo version = null; + if ( digits != null ) + { + List digits = new ArrayList<>( this.digits ); + String annotationRevision = this.annotationRevision; + if ( StringUtils.isNumeric( annotationRevision ) ) + { + annotationRevision = incrementVersionString( annotationRevision ); + } + else + { + digits.set( digits.size() - 1, incrementVersionString( digits.get( digits.size() - 1 ) ) ); + } + + version = new DefaultVersionInfo( digits, annotation, annotationRevision, buildSpecifier, + annotationSeparator, annotationRevSeparator, buildSeparator ); + } + return version; + } + + /** + * Compares this {@link DefaultVersionInfo} to the supplied {@link DefaultVersionInfo} to determine which version is + * greater. + * + * @param obj the comparison version + * @return the comparison value + * @throws IllegalArgumentException if the components differ between the objects or if either of the annotations can + * not be determined. + */ + @Override + public int compareTo( VersionInfo obj ) + { + DefaultVersionInfo that = (DefaultVersionInfo) obj; + + int result; + // TODO: this is a workaround for a bug in DefaultArtifactVersion - fix there - 1.01 < 1.01.01 + if ( strVersion.startsWith( that.strVersion ) && !strVersion.equals( that.strVersion ) + && strVersion.charAt( that.strVersion.length() ) != '-' ) + { + result = 1; + } + else if ( that.strVersion.startsWith( strVersion ) && !strVersion.equals( that.strVersion ) + && that.strVersion.charAt( strVersion.length() ) != '-' ) + { + result = -1; + } + else + { + // TODO: this is a workaround for a bug in DefaultArtifactVersion - fix there - it should not consider case in comparing the qualifier + // NOTE: The combination of upper-casing and lower-casing is an approximation of String.equalsIgnoreCase() + String thisVersion = strVersion.toUpperCase( Locale.ENGLISH ).toLowerCase( Locale.ENGLISH ); + String thatVersion = that.strVersion.toUpperCase( Locale.ENGLISH ).toLowerCase( Locale.ENGLISH ); + + result = new DefaultArtifactVersion( thisVersion ).compareTo( new DefaultArtifactVersion( thatVersion ) ); + } + return result; + } + + @Override + public boolean equals( Object obj ) + { + if ( !( obj instanceof DefaultVersionInfo ) ) + { + return false; + } + + return compareTo( (VersionInfo) obj ) == 0; + } + + @Override + public int hashCode() + { + return strVersion.toLowerCase( Locale.ENGLISH ).hashCode(); + } + + /** + * Takes a string and increments it as an integer. + * Preserves any lpad of "0" zeros. + * + * @return {@code String} increments the input {@code String} as an integer + * and Preserves any lpad of "0" zeros. + * @param s the version number + */ + protected String incrementVersionString( String s ) + { + int n = Integer.valueOf( s ).intValue() + 1; + String value = String.valueOf( n ); + if ( value.length() < s.length() ) + { + // String was left-padded with zeros + value = StringUtils.leftPad( value, s.length(), "0" ); + } + return value; + } + + @Override + public String getSnapshotVersionString() + { + if ( strVersion.equals( Artifact.SNAPSHOT_VERSION ) ) + { + return strVersion; + } + + String baseVersion = getReleaseVersionString(); + + if ( baseVersion.length() > 0 ) + { + baseVersion += "-"; + } + + return baseVersion + Artifact.SNAPSHOT_VERSION; + } + + @Override + public String getReleaseVersionString() + { + String baseVersion = strVersion; + + Matcher m = Artifact.VERSION_FILE_PATTERN.matcher( baseVersion ); + if ( m.matches() ) + { + baseVersion = m.group( 1 ); + } + // MRELEASE-623 SNAPSHOT is case-insensitive + else if ( StringUtils.right( baseVersion, 9 ).equalsIgnoreCase( "-" + Artifact.SNAPSHOT_VERSION ) ) + { + baseVersion = baseVersion.substring( 0, baseVersion.length() - Artifact.SNAPSHOT_VERSION.length() - 1 ); + } + else if ( baseVersion.equals( Artifact.SNAPSHOT_VERSION ) ) + { + baseVersion = "1.0"; + } + return baseVersion; + } + + @Override + public String toString() + { + return strVersion; + } + + protected static String getVersionString( DefaultVersionInfo info, String buildSpecifier, String buildSeparator ) + { + StringBuilder sb = new StringBuilder(); + + if ( info.digits != null ) + { + sb.append( joinDigitString( info.digits ) ); + } + + if ( StringUtils.isNotEmpty( info.annotation ) ) + { + sb.append( StringUtils.defaultString( info.annotationSeparator ) ); + sb.append( info.annotation ); + } + + if ( StringUtils.isNotEmpty( info.annotationRevision ) ) + { + if ( StringUtils.isEmpty( info.annotation ) ) + { + sb.append( StringUtils.defaultString( info.annotationSeparator ) ); + } + else + { + sb.append( StringUtils.defaultString( info.annotationRevSeparator ) ); + } + sb.append( info.annotationRevision ); + } + + if ( StringUtils.isNotEmpty( buildSpecifier ) ) + { + sb.append( StringUtils.defaultString( buildSeparator ) ); + sb.append( buildSpecifier ); + } + + return sb.toString(); + } + + /** + * Simply joins the items in the list with "." period + * + * @return a single {@code String} of the items in the passed list, joined with a "." + * @param digits {@code List} of digits + */ + protected static String joinDigitString( List digits ) + { + return digits != null ? StringUtils.join( digits.iterator(), DIGIT_SEPARATOR_STRING ) : null; + } + + /** + * Splits the string on "." and returns a list + * containing each digit. + * + * @param strDigits + */ + private List parseDigits( String strDigits ) + { + return Arrays.asList( StringUtils.split( strDigits, DIGIT_SEPARATOR_STRING ) ); + } + + //-------------------------------------------------- + // Getters & Setters + //-------------------------------------------------- + + private static String nullIfEmpty( String s ) + { + return StringUtils.isEmpty( s ) ? null : s; + } + + public List getDigits() + { + return digits; + } + + public String getAnnotation() + { + return annotation; + } + + public String getAnnotationRevision() + { + return annotationRevision; + } + + public String getBuildSpecifier() + { + return buildSpecifier; + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/versions/VersionInfo.java b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/versions/VersionInfo.java new file mode 100644 index 000000000..de2c9945e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/java/org/apache/maven/shared/release/versions/VersionInfo.java @@ -0,0 +1,56 @@ +package org.apache.maven.shared.release.versions; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Represent the different version representations during the release-prepare phase + */ +public interface VersionInfo + extends Comparable +{ + + /** + * Returns a string representing the version with a snapshot specification + * + * @return the snapshot version transformation of the original value + */ + String getSnapshotVersionString(); + + /** + * Returns a string representing the version without a snapshot specification. + * + * @return the final version transformation of the original value + */ + String getReleaseVersionString(); + + /** + * Returns a {@link VersionInfo} object which represents the next version of this object. + * + * @return the next VersionInfo + */ + VersionInfo getNextVersion(); + + /** + * Returns whether this represents a snapshot version. + * + * @return {@code true} if the original value was a snapshot, otherwise {@code false} + */ + boolean isSnapshot(); +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/mdo/release-descriptor.mdo b/Java-base/maven-release/src/maven-release-manager/src/main/mdo/release-descriptor.mdo new file mode 100644 index 000000000..ed0ea580e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/mdo/release-descriptor.mdo @@ -0,0 +1,1165 @@ + + + + + release-descriptor + ReleaseDescriptor + + A release descriptor contains everything that is needed to perform a + release. A release descriptor can be used by third party systems like + Continuum to perform releases in a consistent way. The release model could also + be deployed to the repository manager so that new releases can be announced easily + and automatically. + + + + package + org.apache.maven.shared.release.config + + + + + ModelloReleaseDescriptor + 1.0.0+ + + + + name + 1.0.0+ + String + + The name of this release configuration + + + + description + 1.0.0+ + String + + The description of this release configuration + + + + + + ScmCommentPrefix + 1.0.0+ + String + [maven-release-manager] + + The prefix of SCM modification messages + + + + scmReleaseCommitComment + 3.0.0+ + String + @{prefix} prepare release @{releaseLabel} + + The SCM commit comment when setting pom.xml to release + + + + scmDevelopmentCommitComment + 3.0.0+ + String + @{prefix} prepare for next development iteration + + The SCM commit comment when setting pom.xml back to development + + + + scmBranchCommitComment + 3.0.0+ + String + @{prefix} prepare branch @{releaseLabel} + + The SCM commit comment when branching + + + + scmRollbackCommitComment + 3.0.0+ + String + @{prefix} rollback the release of @{releaseLabel} + + The SCM commit comment when rolling back + + + + scmSourceUrl + 1.0.0+ + String + + This is a MavenSCM of where you're going to get the sources to make the release with. + Example: scm:svn:https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-release-plugin + + + + scmTagBase + 1.0.0+ + String + + Where you are going to put your tagged sources + Example https://svn.apache.org/repos/asf/maven/plugins/tags + + + + scmBranchBase + 1.0.0+ + String + + Where you are going to put your branched sources + Example https://svn.apache.org/repos/asf/maven/plugins/branches + + + + scmReleaseLabel + 1.0.0+ + String + + tag or branch name: the identifier for the tag/branch. + Example: maven-release-plugin-2.0 + + + + scmId + 2.3.0+ + String + + The id can be used to get the credentials by the server-id from the settings.xml + + + + scmUsername + 1.0.0+ + String + + The user name to interact with the scm + + + + scmPassword + 1.0.0+ + String + + The password for the user interacting with the scm + + + + scmPrivateKey + 1.0.0+ + String + + Private key for an SSH based SCM repository. + + + + scmPrivateKeyPassPhrase + 1.0.0+ + String + + Pass phrase for the private key. + + + + scmUseEditMode + 1.0.0+ + boolean + + Whether to use edit mode when making SCM modifications. This setting is disregarded + if the SCM does not support edit mode, or if edit mode is compulsory for the given SCM. + + + + scmRelativePathProjectDirectory + 1.0.0+ + String + + Relative path of the project returned by the checkout command. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + updateDependencies + 1.0.0+ + boolean + true + + If updateDependencies is false, dependencies version won't be updated to the next development version. + + + + useReleaseProfile + 1.0.0+ + boolean + true + + Whether to use the release profile that adds sources and javadocs to the released artifact, if appropriate. + If set to true, this will set the property "performRelease" to true. + + + + activateProfiles + 3.0.0+ + List + + String + * + + List of profiles to activate. + + + workingDirectory + 1.0.0+ + String + + The directory where the release is performed. + + + + checkoutDirectory + 1.0.0+ + String + target/checkout + + The directory where the tag will be checked out. + + + + completedPhase + 1.0.0+ + String + + The last completed phase. + + + + addSchema + 1.0.0+ + boolean + + false then the root element will remain untouched.]]> + + + + generateReleasePoms + 1.0.0+ + boolean + + Whether to generate release POMs. + + + + autoVersionSubmodules + 1.0.0+ + boolean + + Whether to use the parent pom version for submodule versions. + + + + interactive + 1.0.0+ + boolean + true + + Whether the release process is interactive and the release manager should be prompted to + confirm values, or whether the defaults are used regardless. + + + + snapshotReleasePluginAllowed + 1.0.0+ + boolean + false + + Whether a SNAPSHOT of the release plugin is allowed. + + + + additionalArguments + 1.0.0+ + String + + Additional arguments to pass to any executed Maven process. + + + + pomFileName + 1.0.0+ + String + + The file name of the POM to pass to any executed Maven process. + + + + checkModificationExcludes + 2.1.0+ + List + + String + * + + + In some exceptions you want to allow changes to the working copy. Changes + to files listed here will not make the ScmCheckModificationsPhase fail. + + + + preparationGoals + 1.0.0+ + String + + The goals to execute in preparation for the release. + + + + completionGoals + 2.2.0+ + String + + The goals to execute in on completion of preparation for the release. + + + + performGoals + 1.0.0+ + String + + The goals to execute in perform phase for the release. + + + + commitByProject + 1.0.0+ + boolean + false + + The commits must be done by modules or not. Set it to true in case of flat directory structure. + + + + branchCreation + 1.0.0+ + boolean + + Whether to create a branch instead of do a release. + + + + updateBranchVersions + 1.0.0+ + boolean + + Whether to update branch POM versions. + + + + updateWorkingCopyVersions + 1.0.0+ + boolean + true + + Whether to update working copy POM versions. + + + + updateVersionsToSnapshot + 1.0.0+ + boolean + + Whether to update branch versions to SNAPSHOT. + + + + suppressCommitBeforeTagOrBranch + 2.1.0+ + boolean + + Whether to suppress a commit of changes to the working copy before a tag or branch is created. + + + + waitBeforeTagging + 2.2.0+ + int + + Wait the specified number of seconds before creating a tag. + + + + allowTimestampedSnapshots + 1.0.0+ + boolean + false + + Should timestamped SNAPSHOT dependencies be allowed? Default is to fail when any SNAPSHOT + dependency is found. + + + + defaultReleaseVersion + 1.0.0+ + String + + Default version to use for the tagged release or the new branch. + + + + defaultDevelopmentVersion + 1.0.0+ + String + + Default version to use for new working copy. + + + + projectVersionPolicyId + 2.5.1+ + String + default + + The role-hint for the VersionPolicy implementation used to calculate the project versions. + + + + projectNamingPolicyId + 3.0.0+ + String + + + The role-hint for the NamingPolicy implementation used to calculate the project branch and tag names. + + + + releaseStrategyId + 3.0.0+ + String + default + + The role-hint for the release Strategy implementation. + + + + + remoteTagging + 1.0.0+ + boolean + false + + NOTE : currently only implemented with svn scm. Enable a workaround to prevent issue due to svn client > 1.5.0 + (http://jira.codehaus.org/browse/SCM-406) + + + + scmReleasedPomRevision + 1.0.0+ + String + + NOTE : currently only implemented with svn scm. It contains the revision of the committed released pom to remotely tag + the source code with this revision. + + + + + pushChanges + 2.0.0+ + boolean + true + + Should distributed changes be pushed to the central repository? + For many distributed SCMs like Git, a change like a commit is only stored in your local copy of the repository. + Pushing the change allows your to more easily share it with other users. + + + + + localCheckout + 2.0.0+ + boolean + false + + If the scm provider should use local checkouts via file://${basedir} + instead of doing a clean checkout over the network. + This is very helpful for releasing large projects! + + + + + scmTagNameFormat + 2.2.0+ + String + + Specifies the format for generating a tag name. Property expansion is + used with the optional prefix of project, where properties are delimited + with @{ and } + + + + + workItem + 3.0.0+ + String + + Some SCMs may require a Work Item or a Task to allow the changes to be pushed or delivered. + This field allows you to specify that Work Item or Task. It is optional, and only relevant + if pushChanges is true. + + + + + autoResolveSnapshots + 3.0.0+ + String + + +
  • "all" or "0": resolve all kinds of snapshots, ie. project, plugin, report and extension dependencies
  • +
  • "dependencies" or "1": resolve project dependencies
  • +
  • "plugins" or "2": resolve plugin dependencies
  • +
  • "reports" or "3": resolve report dependencies
  • +
  • "extensions" or "4": resolve extension dependencies
  • + + Additionally this implies that the default values for the dependency's release and next + development version are used.]]> +
    +
    + + + pinExternals + 3.0.0+ + boolean + false + + Enable the "--pin-externals" option in svn copy commands which is new in Subversion 1.9. + NOTE : Currently only implemented with Subversion. + (https://issues.apache.org/jira/browse/SCM-805) + + + + +
    + + + + + 2.1.0+ + resolvedSnapshotDependencies = new java.util.HashMap<>(); + + /** + * Field projectVersions + */ + private java.util.Map projectVersions = new java.util.HashMap<>(); + + /** + * Field originalScmInfo. + */ + private java.util.Map originalScmInfo = new java.util.HashMap<>(); + + + java.util.Map getProjectVersions() + { + return projectVersions; + } + + java.util.Map getOriginalScmInfo() + { + return originalScmInfo; + } + + /** + * Method getResolvedSnapshotDependencies. + * + * @return Map + */ + java.util.Map getResolvedSnapshotDependencies() + { + return this.resolvedSnapshotDependencies; + } //-- java.util.Map getResolvedSnapshotDependencies() + + public String getProjectReleaseVersion( String projectId ) + { + if ( projectVersions.containsKey( projectId ) ) + { + return projectVersions.get( projectId ).getRelease(); + } + return null; + } + + /** + * Method addReleaseVersion. + * + * @param key + * @param value + */ + public void addReleaseVersion( String projectId, String version ) + { + computeIfAbsent( projectVersions, projectId ).setRelease( version ); + } //-- void addReleaseVersion( String, String ) + + public String getProjectDevelopmentVersion( String projectId ) + { + if ( projectVersions.containsKey( projectId ) ) + { + return projectVersions.get( projectId ).getDevelopment(); + } + return null; + } + + /** + * Method addDevelopmentVersion. + * + * @param key + * @param value + */ + public void addDevelopmentVersion( String projectId, String version ) + { + computeIfAbsent( projectVersions, projectId ).setDevelopment( version ); + } //-- void addDevelopmentVersion( String, String ) + + /** + * Method getOriginalScmInfo. + * + * @return Map + */ + public org.apache.maven.model.Scm getOriginalScmInfo( String id ) + { + return this.originalScmInfo.get( id ); + } //-- java.util.Map getOriginalScmInfo() + + /** + * Method addOriginalScmInfo. + * + * @param key + * @param value + */ + public void addOriginalScmInfo( String key, org.apache.maven.model.Scm value ) + { + getOriginalScmInfo().put( key, value ); + } //-- void addOriginalScmInfo( String, org.apache.maven.model.Scm ) + + public String getProjectOriginalVersion( String projectId ) + { + if ( projectVersions.containsKey( projectId ) ) + { + return projectVersions.get( projectId ).getOriginal(); + } + return null; + } + + public void addOriginalVersion( String projectId, String version ) + { + computeIfAbsent( projectVersions, projectId ).setOriginal( version ); + } + + /** + * Retrieve the release version for the resolved snapshot dependency. + * + */ + public String getDependencyDevelopmentVersion( String artifactConflictId ) + { + if ( resolvedSnapshotDependencies.containsKey( artifactConflictId ) ) + { + ReleaseStageVersions versionMap = resolvedSnapshotDependencies.get( artifactConflictId ); + return versionMap.getDevelopment(); + } + return null; + } + + /** + * Retrieve the release version for the resolved snapshot dependency. + * + */ + public String getDependencyReleaseVersion( String artifactConflictId ) + { + if ( resolvedSnapshotDependencies.containsKey( artifactConflictId ) ) + { + ReleaseStageVersions versionMap = resolvedSnapshotDependencies.get( artifactConflictId ); + return versionMap.getRelease(); + } + return null; + } + + /** + * Retrieve the original version for the resolved snapshot dependency. + * + */ + public String getDependencyOriginalVersion( String artifactConflictId ) + { + if ( resolvedSnapshotDependencies.containsKey( artifactConflictId ) ) + { + ReleaseStageVersions versionMap = resolvedSnapshotDependencies.get( artifactConflictId ); + return versionMap.getOriginal(); + } + return null; + } + + public void addDependencyOriginalVersion( String dependencyKey, String version ) + { + computeIfAbsent( resolvedSnapshotDependencies, dependencyKey ).setOriginal( version ); + } + + public void addDependencyReleaseVersion( String dependencyKey, String version ) + { + computeIfAbsent( resolvedSnapshotDependencies, dependencyKey ).setRelease( version ); + } + + public void addDependencyDevelopmentVersion( String dependencyKey, String version ) + { + computeIfAbsent( resolvedSnapshotDependencies, dependencyKey ).setDevelopment( version ); + } + + private static ReleaseStageVersions computeIfAbsent( java.util.Map map, String key ) + { + ReleaseStageVersions value = map.get( key ); + if ( value == null ) + { + value = new ReleaseStageVersions(); + map.put( key, value ); + } + return value; + } + + @Override + public boolean equals( Object obj ) + { + if ( this == obj ) + { + return true; + } + if ( obj == null || getClass() != obj.getClass() ) + { + return false; + } + + ModelloReleaseDescriptor that = (ModelloReleaseDescriptor) obj; + + if ( updateDependencies != that.isUpdateDependencies() || + useReleaseProfile != that.isUseReleaseProfile() || + autoVersionSubmodules != that.isAutoVersionSubmodules() || + snapshotReleasePluginAllowed != that.isSnapshotReleasePluginAllowed() || + commitByProject != that.isCommitByProject() || + branchCreation != that.isBranchCreation() || + updateBranchVersions != that.isUpdateBranchVersions() || + updateWorkingCopyVersions != that.isUpdateWorkingCopyVersions() || + suppressCommitBeforeTagOrBranch != that.isSuppressCommitBeforeTagOrBranch() || + updateVersionsToSnapshot != that.isUpdateVersionsToSnapshot() || + allowTimestampedSnapshots != that.isAllowTimestampedSnapshots() || + remoteTagging != that.isRemoteTagging() || + pinExternals != that.isPinExternals() || + localCheckout != that.isLocalCheckout() || + pushChanges != that.isPushChanges() + ) + { + return false; + } + + if ( !java.util.Objects.equals( defaultDevelopmentVersion, that.getDefaultDevelopmentVersion() ) || + !java.util.Objects.equals( scmRelativePathProjectDirectory, that.getScmRelativePathProjectDirectory() ) || + !java.util.Objects.equals( checkoutDirectory, that.getCheckoutDirectory() ) || + !java.util.Objects.equals( performGoals, that.getPerformGoals() ) || + !java.util.Objects.equals( defaultReleaseVersion, that.getDefaultReleaseVersion() ) || + !java.util.Objects.equals( workItem, that.getWorkItem() ) || + !java.util.Objects.equals( scmReleasedPomRevision, that.getScmReleasedPomRevision() ) || + !java.util.Objects.equals( autoResolveSnapshots, that.getAutoResolveSnapshots() ) + ) + { + return false; + } + + if ( addSchema != that.isAddSchema() ) + { + return false; + } + if ( generateReleasePoms != that.isGenerateReleasePoms() ) + { + return false; + } + if ( interactive != that.isInteractive() ) + { + return false; + } + if ( scmUseEditMode != that.isScmUseEditMode() ) + { + return false; + } + if ( !java.util.Objects.equals( completedPhase, that.getCompletedPhase() ) ) + { + return false; + } + if ( ( checkModificationExcludes == null || ( checkModificationExcludes != null && checkModificationExcludes.size() == 0) ) && + ( that.getCheckModificationExcludes() == null || ( that.getCheckModificationExcludes() != null && that.getCheckModificationExcludes().size() == 0) ) ) + { + // Do nothing. This is a Modello workaround + } + else + { + if ( checkModificationExcludes != null ? !checkModificationExcludes.equals( that.getCheckModificationExcludes() ) + : that.getCheckModificationExcludes() != null ) + { + return false; + } + } + if ( ( originalScmInfo == null || (originalScmInfo != null && originalScmInfo.size() == 0 ) ) && + ( that.getOriginalScmInfo() == null || ( that.getOriginalScmInfo() != null && that.getOriginalScmInfo().size() == 0 ) ) ) + { + // Do nothing. This is a Modello workaround + } + else + { + if ( originalScmInfo != null ? !compareScmCollections( that.getOriginalScmInfo() ) : that.getOriginalScmInfo() != null ) + { + return false; + } + } + if ( !java.util.Objects.equals( additionalArguments, that.getAdditionalArguments() ) ) + { + return false; + } + if ( !java.util.Objects.equals( preparationGoals, that.getPreparationGoals() ) ) + { + return false; + } + if ( !java.util.Objects.equals( completionGoals, that.getCompletionGoals() ) ) + { + return false; + } + if ( !java.util.Objects.equals( pomFileName, that.getPomFileName() ) ) + { + return false; + } + if ( !java.util.Objects.equals( scmDevelopmentCommitComment, that.getScmDevelopmentCommitComment() ) ) + { + return false; + } + if ( !java.util.Objects.equals( scmReleaseCommitComment, that.getScmReleaseCommitComment() ) ) + { + return false; + } + if ( !java.util.Objects.equals( scmBranchCommitComment, that.getScmBranchCommitComment() ) ) + { + return false; + } + if ( !java.util.Objects.equals( scmRollbackCommitComment, that.getScmRollbackCommitComment() ) ) + { + return false; + } + if ( !java.util.Objects.equals( scmPrivateKeyPassPhrase, that.getScmPrivateKeyPassPhrase() ) ) + { + return false; + } + if ( !java.util.Objects.equals( scmPassword, that.getScmPassword() ) ) + { + return false; + } + if ( !java.util.Objects.equals( scmPrivateKey, that.getScmPrivateKey() ) ) + { + return false; + } + if ( !java.util.Objects.equals( scmReleaseLabel, that.getScmReleaseLabel() ) ) + { + return false; + } + if ( !java.util.Objects.equals( scmTagBase, that.getScmTagBase() ) ) + { + return false; + } + if ( !java.util.Objects.equals( scmBranchBase, that.getScmBranchBase() ) ) + { + return false; + } + if ( !java.util.Objects.equals( scmId, that.getScmId() ) ) + { + return false; + } + if ( !java.util.Objects.equals( scmSourceUrl, that.getScmSourceUrl() ) ) + { + return false; + } + if ( !java.util.Objects.equals( scmUsername, that.getScmUsername() ) ) + { + return false; + } + if ( !java.util.Objects.equals( workingDirectory, that.getWorkingDirectory() ) ) + { + return false; + } + if ( !java.util.Objects.equals( scmTagNameFormat, that.getScmTagNameFormat() ) ) + { + return false; + } + if ( !java.util.Objects.deepEquals( projectVersions, that.getProjectVersions() ) ) + { + return false; + } + + return true; + } + + private boolean compareScmCollections( java.util.Map that ) + { + // Must manually compare as Scm doesn't have an equals method + if ( that == null && originalScmInfo == null ) + { + return true; + } + + if ( ( that == null && originalScmInfo != null ) || ( that != null && originalScmInfo == null ) ) + { + return false; + } + + if ( that.size() != originalScmInfo.size() ) + { + return false; + } + + for ( java.util.Iterator> i = originalScmInfo.entrySet().iterator(); i.hasNext(); ) + { + java.util.Map.Entry entry = i.next(); + + org.apache.maven.model.Scm thatScm = that.get( entry.getKey() ); + + org.apache.maven.model.Scm thisScm = entry.getValue(); + if ( thatScm == null && thisScm == null ) + { + return true; + } + else if ( thatScm == null ) + { + return false; + } + else if ( thisScm == null ) + { + return true; + } + + if ( thisScm.getConnection() != null ? !thisScm.getConnection().equals( thatScm.getConnection() ) + : thatScm.getConnection() != null ) + { + return false; + } + if ( thisScm.getDeveloperConnection() != null ? !thisScm.getDeveloperConnection().equals( + thatScm.getDeveloperConnection() ) : thatScm.getDeveloperConnection() != null ) + { + return false; + } + if ( thisScm.getUrl() != null ? !thisScm.getUrl().equals( thatScm.getUrl() ) : thatScm.getUrl() != null ) + { + return false; + } + if ( thisScm.getTag() != null ? !thisScm.getTag().equals( thatScm.getTag() ) : thatScm.getTag() != null ) + { + return false; + } + + if ( thisScm instanceof org.apache.maven.shared.release.scm.IdentifiedScm && thatScm instanceof org.apache.maven.shared.release.scm.IdentifiedScm ) + { + org.apache.maven.shared.release.scm.IdentifiedScm thisIdentifiedScm = (org.apache.maven.shared.release.scm.IdentifiedScm) thisScm; + org.apache.maven.shared.release.scm.IdentifiedScm thatIdentifiedScm = (org.apache.maven.shared.release.scm.IdentifiedScm) thatScm; + if ( thisIdentifiedScm.getId() != null ? !thisIdentifiedScm.getId().equals( thatIdentifiedScm.getId() ) : thatIdentifiedScm.getId() != null ) + { + return false; + } + } + } + + return true; + } + + @Override + public int hashCode() + { + int result = java.util.Objects.hashCode( completedPhase ); + result = 29 * result + java.util.Objects.hashCode( scmReleaseLabel ); + result = 29 * result + java.util.Objects.hashCode( additionalArguments ); + result = 29 * result + java.util.Objects.hashCode( preparationGoals ); + result = 29 * result + java.util.Objects.hashCode( completionGoals ); + result = 29 * result + java.util.Objects.hashCode( pomFileName ); + result = 29 * result + java.util.Objects.hashCode( checkModificationExcludes ); + result = 29 * result + java.util.Objects.hashCode( scmDevelopmentCommitComment ); + result = 29 * result + java.util.Objects.hashCode( scmReleaseCommitComment ); + result = 29 * result + java.util.Objects.hashCode( scmBranchCommitComment ); + result = 29 * result + java.util.Objects.hashCode( scmRollbackCommitComment ); + result = 29 * result + java.util.Objects.hashCode( scmTagBase ); + result = 29 * result + java.util.Objects.hashCode( scmBranchBase ); + result = 29 * result + java.util.Objects.hashCode( scmUsername ); + result = 29 * result + java.util.Objects.hashCode( scmPassword ); + result = 29 * result + java.util.Objects.hashCode( scmId ); + result = 29 * result + java.util.Objects.hashCode( scmSourceUrl ); + result = 29 * result + java.util.Objects.hashCode( scmPrivateKey ); + result = 29 * result + java.util.Objects.hashCode( scmPrivateKeyPassPhrase ); + result = 29 * result + java.util.Objects.hashCode( workingDirectory ); + result = 29 * result + java.util.Objects.hashCode( scmUseEditMode ); + result = 29 * result + java.util.Objects.hashCode( addSchema ); + result = 29 * result + java.util.Objects.hashCode( generateReleasePoms ); + result = 29 * result + java.util.Objects.hashCode( interactive ); + result = 29 * result + java.util.Objects.hashCode( projectVersions ); + result = 29 * result + java.util.Objects.hashCode( originalScmInfo ); + result = 29 * result + java.util.Objects.hashCode( updateDependencies ); + result = 29 * result + java.util.Objects.hashCode( useReleaseProfile ); + result = 29 * result + java.util.Objects.hashCode( autoVersionSubmodules ); + result = 29 * result + java.util.Objects.hashCode( snapshotReleasePluginAllowed ); + result = 29 * result + java.util.Objects.hashCode( commitByProject ); + result = 29 * result + java.util.Objects.hashCode( branchCreation ); + result = 29 * result + java.util.Objects.hashCode( updateBranchVersions ); + result = 29 * result + java.util.Objects.hashCode( updateWorkingCopyVersions ); + result = 29 * result + java.util.Objects.hashCode( suppressCommitBeforeTagOrBranch ); + result = 29 * result + java.util.Objects.hashCode( updateVersionsToSnapshot ); + result = 29 * result + java.util.Objects.hashCode( allowTimestampedSnapshots ); + result = 29 * result + java.util.Objects.hashCode( remoteTagging ); + result = 29 * result + java.util.Objects.hashCode( localCheckout ); + result = 29 * result + java.util.Objects.hashCode( pushChanges ); + result = 29 * result + java.util.Objects.hashCode( defaultDevelopmentVersion ); + result = 29 * result + java.util.Objects.hashCode( scmRelativePathProjectDirectory ); + result = 29 * result + java.util.Objects.hashCode( checkoutDirectory ); + result = 29 * result + java.util.Objects.hashCode( performGoals ); + result = 29 * result + java.util.Objects.hashCode( defaultReleaseVersion ); + result = 29 * result + java.util.Objects.hashCode( scmReleasedPomRevision ); + result = 29 * result + java.util.Objects.hashCode( workItem ); + result = 29 * result + java.util.Objects.hashCode( autoResolveSnapshots ); + result = 29 * result + java.util.Objects.hashCode( pinExternals ); + + return result; + } +]]> + + +
    + + ReleaseStageVersions + + + original + 3.0.0+ + String + + + release + 3.0.0+ + String + + + development + 3.0.0+ + String + + + + + 2.1.0+ + + + + +
    +
    diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/resources/META-INF/plexus/components.xml b/Java-base/maven-release/src/maven-release-manager/src/main/resources/META-INF/plexus/components.xml new file mode 100644 index 000000000..6c997dbc6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/resources/META-INF/plexus/components.xml @@ -0,0 +1,45 @@ + + + + + + + + org.sonatype.plexus.components.sec.dispatcher.SecDispatcher + mng-4384 + org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher + + + org.sonatype.plexus.components.cipher.PlexusCipher + mng-4384 + _cipher + + + + <_configuration-file>~/.m2/settings-security.xml + + + + org.sonatype.plexus.components.cipher.PlexusCipher + mng-4384 + org.sonatype.plexus.components.cipher.DefaultPlexusCipher + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/resources/release-messages.properties b/Java-base/maven-release/src/maven-release-manager/src/main/resources/release-messages.properties new file mode 100644 index 000000000..2083f31fb --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/resources/release-messages.properties @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +mapversion.branch.prompt = What is the branch version for "{0}"? ({1}) +mapversion.development.prompt = What is the new development version for "{0}"? ({1}) +mapversion.release.prompt = What is the release version for "{0}"? ({1}) +mapversion.workingcopy.prompt = What is the new working copy version for "{0}"? ({1}) diff --git a/Java-base/maven-release/src/maven-release-manager/src/main/resources/release-messages_en.properties b/Java-base/maven-release/src/maven-release-manager/src/main/resources/release-messages_en.properties new file mode 100644 index 000000000..96cf40750 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/main/resources/release-messages_en.properties @@ -0,0 +1,23 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# NOTE: +# This bundle is intentionally empty because English strings are provided by the base bundle via the parent chain. It +# must be provided nevertheless such that a request for locale "en" will not errorneously pick up the bundle for the +# JVM's default locale (which need not be "en"). See the method javadoc about +# ResourceBundle.getBundle(String, Locale, ClassLoader) +# for a full description of the lookup strategy. diff --git a/Java-base/maven-release/src/maven-release-manager/src/site/apt/index.apt.vm b/Java-base/maven-release/src/maven-release-manager/src/site/apt/index.apt.vm new file mode 100644 index 000000000..a907e5c13 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/site/apt/index.apt.vm @@ -0,0 +1,39 @@ + ------ + Maven Release Manager + ------ + Hervé Boutemy + ------ + 2019-11-03 + ------ + +~~ Licensed to the Apache Software Foundation (ASF) under one +~~ or more contributor license agreements. See the NOTICE file +~~ distributed with this work for additional information +~~ regarding copyright ownership. The ASF licenses this file +~~ to you under the Apache License, Version 2.0 (the +~~ "License"); you may not use this file except in compliance +~~ with the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, +~~ software distributed under the License is distributed on an +~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~~ KIND, either express or implied. See the License for the +~~ specific language governing permissions and limitations +~~ under the License. + +Maven Release Manager + + Maven Release Manager implements: + + * the release management engine ({{{./apidocs/org/apache/maven/shared/release/ReleaseManager.html}ReleaseManager}} API + with {{{./xref/org/apache/maven/shared/release/DefaultReleaseManager.html}DefaultReleaseManager}} implementation), + + * default release phases (in {{{./apidocs/org/apache/maven/shared/release/phase/package-summary.html}phase package}}), + + * and the default release strategy ({{{./apidocs/org/apache/maven/shared/release/strategies/DefaultStrategy.html}DefaultStrategy}}) + with its phases configuration: + +%{snippet|id=default-strategy|file=${project.build.sourceDirectory}/../components-fragment.xml} + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/site/site.xml b/Java-base/maven-release/src/maven-release-manager/src/site/site.xml new file mode 100644 index 000000000..220ecbb57 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/site/site.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java new file mode 100644 index 000000000..8e024d00a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java @@ -0,0 +1,799 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Properties; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.CommandParameters; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmTag; +import org.apache.maven.scm.command.checkout.CheckOutScmResult; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.manager.ScmManagerStub; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.provider.ScmProviderStub; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseDescriptorStore; +import org.apache.maven.shared.release.config.ReleaseDescriptorStoreException; +import org.apache.maven.shared.release.config.ReleaseDescriptorStoreStub; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.phase.ReleasePhase; +import org.apache.maven.shared.release.phase.ReleasePhaseStub; +import org.apache.maven.shared.release.phase.RunPerformGoalsPhase; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.util.FileUtils; + +/** + * Test the default release manager. + * + * @author Brett Porter + */ +public class DefaultReleaseManagerTest + extends PlexusTestCase +{ + private ReleaseDescriptorStoreStub configStore; + + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + + configStore = (ReleaseDescriptorStoreStub) lookup( ReleaseDescriptorStore.class, "stub" ); + } + + public void testPrepareNoCompletedPhase() + throws Exception + { + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorBuilder builder = configStore.getReleaseConfiguration(); + builder.setCompletedPhase( null ); + + ReleasePrepareRequest prepareRequest = new ReleasePrepareRequest(); + prepareRequest.setReleaseDescriptorBuilder( builder ); + prepareRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + prepareRequest.setUserProperties( new Properties() ); + + releaseManager.prepare( prepareRequest ); + + ReleasePhaseStub phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step1" ); + assertTrue( "step1 executed", phase.isExecuted() ); + assertFalse( "step1 not simulated", phase.isSimulated() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step2" ); + assertTrue( "step2 executed", phase.isExecuted() ); + assertFalse( "step2 not simulated", phase.isSimulated() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step3" ); + assertTrue( "step3 executed", phase.isExecuted() ); + assertFalse( "step3 not simulated", phase.isSimulated() ); + } + + public void testPrepareCompletedPhase() + throws Exception + { + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorBuilder builder = configStore.getReleaseConfiguration(); + builder.setCompletedPhase( "step1" ); + + ReleasePrepareRequest prepareRequest = new ReleasePrepareRequest(); + prepareRequest.setReleaseDescriptorBuilder( builder ); + prepareRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + prepareRequest.setUserProperties( new Properties() ); + + releaseManager.prepare( prepareRequest ); + + ReleasePhaseStub phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step1" ); + assertFalse( "step1 not executed", phase.isExecuted() ); + assertFalse( "step1 not simulated", phase.isSimulated() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step2" ); + assertTrue( "step2 executed", phase.isExecuted() ); + assertFalse( "step2 not simulated", phase.isSimulated() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step3" ); + assertTrue( "step3 executed", phase.isExecuted() ); + assertFalse( "step3 not simulated", phase.isSimulated() ); + } + + public void testPrepareCompletedPhaseNoResume() + throws Exception + { + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorBuilder builder = configStore.getReleaseConfiguration(); + builder.setCompletedPhase( "step1" ); + + ReleasePrepareRequest prepareRequest = new ReleasePrepareRequest(); + prepareRequest.setReleaseDescriptorBuilder( builder ); + prepareRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + prepareRequest.setDryRun( false ); + prepareRequest.setResume( false ); + prepareRequest.setUserProperties( new Properties() ); + + releaseManager.prepare( prepareRequest ); + + ReleasePhaseStub phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step1" ); + assertFalse( "step1 executed", phase.isExecuted() ); + assertFalse( "step1 not simulated", phase.isSimulated() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step2" ); + assertTrue( "step2 executed", phase.isExecuted() ); + assertFalse( "step2 not simulated", phase.isSimulated() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step3" ); + assertTrue( "step3 executed", phase.isExecuted() ); + assertFalse( "step3 not simulated", phase.isSimulated() ); + } + + public void testPrepareCompletedAllPhases() + throws Exception + { + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorBuilder builder = configStore.getReleaseConfiguration(); + builder.setCompletedPhase( "step3" ); + + ReleasePrepareRequest prepareRequest = new ReleasePrepareRequest(); + prepareRequest.setReleaseDescriptorBuilder( builder ); + prepareRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + prepareRequest.setUserProperties( new Properties() ); + + releaseManager.prepare( prepareRequest ); + + ReleasePhaseStub phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step1" ); + assertFalse( "step1 not executed", phase.isExecuted() ); + assertFalse( "step1 not simulated", phase.isSimulated() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step2" ); + assertFalse( "step2 not executed", phase.isExecuted() ); + assertFalse( "step2 not simulated", phase.isSimulated() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step3" ); + assertFalse( "step3 not executed", phase.isExecuted() ); + assertFalse( "step3 not simulated", phase.isSimulated() ); + } + + public void testPrepareInvalidCompletedPhase() + throws Exception + { + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorBuilder builder = configStore.getReleaseConfiguration(); + builder.setCompletedPhase( "foo" ); + + ReleasePrepareRequest prepareRequest = new ReleasePrepareRequest(); + prepareRequest.setReleaseDescriptorBuilder( builder ); + prepareRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + prepareRequest.setUserProperties( new Properties() ); + + releaseManager.prepare( prepareRequest ); + + ReleasePhaseStub phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step1" ); + assertTrue( "step1 executed", phase.isExecuted() ); + assertFalse( "step1 not simulated", phase.isSimulated() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step2" ); + assertTrue( "step2 executed", phase.isExecuted() ); + assertFalse( "step2 not simulated", phase.isSimulated() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step3" ); + assertTrue( "step3 executed", phase.isExecuted() ); + assertFalse( "step3 not simulated", phase.isSimulated() ); + } + + public void testPrepareSimulateNoCompletedPhase() + throws Exception + { + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorBuilder builder = configStore.getReleaseConfiguration(); + builder.setCompletedPhase( null ); + + ReleasePrepareRequest prepareRequest = new ReleasePrepareRequest(); + prepareRequest.setReleaseDescriptorBuilder( builder ); + prepareRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + prepareRequest.setDryRun( true ); + prepareRequest.setResume( true ); + prepareRequest.setUserProperties( new Properties() ); + + releaseManager.prepare( prepareRequest ); + + ReleasePhaseStub phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step1" ); + assertTrue( "step1 simulated", phase.isSimulated() ); + assertFalse( "step1 not executed", phase.isExecuted() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step2" ); + assertTrue( "step2 simulated", phase.isSimulated() ); + assertFalse( "step2 not executed", phase.isExecuted() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step3" ); + assertTrue( "step3 simulated", phase.isSimulated() ); + assertFalse( "step3 not executed", phase.isExecuted() ); + } + + public void testPrepareSimulateCompletedPhase() + throws Exception + { + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorBuilder builder = configStore.getReleaseConfiguration(); + builder.setCompletedPhase( "step1" ); + + ReleasePrepareRequest prepareRequest = new ReleasePrepareRequest(); + prepareRequest.setReleaseDescriptorBuilder( builder ); + prepareRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + prepareRequest.setDryRun( true ); + prepareRequest.setResume( true ); + prepareRequest.setUserProperties( new Properties() ); + + releaseManager.prepare( prepareRequest ); + + ReleasePhaseStub phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step1" ); + assertFalse( "step1 not simulated", phase.isSimulated() ); + assertFalse( "step1 not executed", phase.isExecuted() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step2" ); + assertTrue( "step2 simulated", phase.isSimulated() ); + assertFalse( "step2 not executed", phase.isExecuted() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step3" ); + assertTrue( "step3 simulated", phase.isSimulated() ); + assertFalse( "step3 not executed", phase.isExecuted() ); + } + + public void testPrepareSimulateCompletedAllPhases() + throws Exception + { + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorBuilder builder = configStore.getReleaseConfiguration(); + builder.setCompletedPhase( "step3" ); + + ReleasePrepareRequest prepareRequest = new ReleasePrepareRequest(); + prepareRequest.setReleaseDescriptorBuilder( builder ); + prepareRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + prepareRequest.setDryRun( true ); + prepareRequest.setResume( true ); + prepareRequest.setUserProperties( new Properties() ); + + releaseManager.prepare( prepareRequest ); + + ReleasePhaseStub phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step1" ); + assertFalse( "step1 not simulated", phase.isSimulated() ); + assertFalse( "step1 not executed", phase.isExecuted() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step2" ); + assertFalse( "step2 not simulated", phase.isSimulated() ); + assertFalse( "step2 not executed", phase.isExecuted() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step3" ); + assertFalse( "step3 not simulated", phase.isSimulated() ); + assertFalse( "step3 not executed", phase.isExecuted() ); + } + + public void testPrepareSimulateInvalidCompletedPhase() + throws Exception + { + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorBuilder builder = configStore.getReleaseConfiguration(); + builder.setCompletedPhase( "foo" ); + + ReleasePrepareRequest prepareRequest = new ReleasePrepareRequest(); + prepareRequest.setReleaseDescriptorBuilder( builder ); + prepareRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + prepareRequest.setDryRun( true ); + prepareRequest.setResume( true ); + prepareRequest.setUserProperties( new Properties() ); + + releaseManager.prepare( prepareRequest ); + + ReleasePhaseStub phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step1" ); + assertTrue( "step1 simulated", phase.isSimulated() ); + assertFalse( "step1 not executed", phase.isExecuted() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step2" ); + assertTrue( "step2 simulated", phase.isSimulated() ); + assertFalse( "step2 not executed", phase.isExecuted() ); + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step3" ); + assertTrue( "step3 simulated", phase.isSimulated() ); + assertFalse( "step3 not executed", phase.isExecuted() ); + } + + public void testPrepareUnknownPhaseConfigured() + throws Exception + { + ReleaseManager releaseManager = lookup( ReleaseManager.class, "bad-phase-configured" ); + + ReleasePrepareRequest prepareRequest = new ReleasePrepareRequest(); + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setReleaseStrategyId( "foo" ); + prepareRequest.setReleaseDescriptorBuilder( builder ); + prepareRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + prepareRequest.setUserProperties( new Properties() ); + + try + { + releaseManager.prepare( prepareRequest ); + fail( "Should have failed to find a phase" ); + } + catch ( ReleaseExecutionException e ) + { + // good + } + } + + public void testReleaseConfigurationStoreReadFailure() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setWorkingDirectory( getTestFile( "target/working-directory" ).getAbsolutePath() ); + + DefaultReleaseManager releaseManager = (DefaultReleaseManager) lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorStore configStoreMock = mock( ReleaseDescriptorStore.class ); + when( configStoreMock.read( builder ) ).thenThrow( new ReleaseDescriptorStoreException( "message", new IOException( "ioExceptionMsg" ) ) ); + + releaseManager.setConfigStore( configStoreMock ); + + ReleasePrepareRequest prepareRequest = new ReleasePrepareRequest(); + prepareRequest.setReleaseDescriptorBuilder( builder ); + prepareRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + prepareRequest.setUserProperties( new Properties() ); + + // execute + try + { + releaseManager.prepare( prepareRequest ); + fail( "Should have failed to read configuration" ); + } + catch ( ReleaseExecutionException e ) + { + // good + assertEquals( "check cause", ReleaseDescriptorStoreException.class, e.getCause().getClass() ); + } + + // verify + verify( configStoreMock ).read( builder ); + verifyNoMoreInteractions( configStoreMock ); + } + + public void testReleaseConfigurationStoreWriteFailure() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setWorkingDirectory( getTestFile( "target/working-directory" ).getAbsolutePath() ); + + DefaultReleaseManager releaseManager = (DefaultReleaseManager) lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorStore configStoreMock = mock( ReleaseDescriptorStore.class ); + doThrow( new ReleaseDescriptorStoreException( "message", new IOException( "ioExceptionMsg" ) ) ).when( configStoreMock ).write( any( ReleaseDescriptor.class) ); + + releaseManager.setConfigStore( configStoreMock ); + + ReleasePrepareRequest prepareRequest = new ReleasePrepareRequest(); + prepareRequest.setReleaseDescriptorBuilder( builder ); + prepareRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + prepareRequest.setDryRun( false ); + prepareRequest.setResume( false ); + prepareRequest.setUserProperties( new Properties() ); + + + // execute + try + { + releaseManager.prepare( prepareRequest ); + fail( "Should have failed to read configuration" ); + } + catch ( ReleaseExecutionException e ) + { + // good + assertEquals( "check cause", ReleaseDescriptorStoreException.class, e.getCause().getClass() ); + } + + // verify + verify( configStoreMock ).write( any( ReleaseDescriptor.class ) ) ; + verifyNoMoreInteractions( configStoreMock ); + } + + public void testReleaseConfigurationStoreClean() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setWorkingDirectory( getTestFile( "target/working-directory" ).getAbsolutePath() ); + + DefaultReleaseManager releaseManager = (DefaultReleaseManager) lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorStore configStoreMock = mock( ReleaseDescriptorStore.class ); + + releaseManager.setConfigStore( configStoreMock ); + + ReleaseCleanRequest cleanRequest = new ReleaseCleanRequest(); + cleanRequest.setReleaseDescriptorBuilder( builder ); + + // execute + releaseManager.clean( cleanRequest ); + + // verify + ReleasePhaseStub phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step1" ); + assertTrue( "step1 not cleaned", phase.isCleaned() ); + + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step2" ); + assertTrue( "step2 not cleaned", phase.isCleaned() ); + + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "step3" ); + assertTrue( "step3 not cleaned", phase.isCleaned() ); + + phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "branch1" ); + assertTrue( "branch1 not cleaned", phase.isCleaned() ); + + verify( configStoreMock ).delete( any( ReleaseDescriptor.class ) ); + verifyNoMoreInteractions( configStoreMock ); + } + + private static List createReactorProjects() throws IOException + { + MavenProject project = new MavenProject(); + + File projectFile = getTestFile( "target/dummy-project/pom.xml" ); + if ( !projectFile.exists() ) + { + projectFile.getParentFile().mkdirs(); + projectFile.createNewFile(); + } + project.setFile( projectFile ); + return Collections.singletonList( project ); + } + + public void testReleasePerformWithResult() + throws Exception + { + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + File checkoutDirectory = getTestFile( "target/checkout-directory" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + builder.setWorkingDirectory( getTestPath( "target/dummy-project" ) ); + + ReleasePerformRequest performRequest = new ReleasePerformRequest(); + performRequest.setReleaseDescriptorBuilder( builder ); + performRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + performRequest.setReactorProjects( createReactorProjects() ); + + ReleaseResult result = releaseManager.performWithResult( performRequest ); + + assertTrue( result.getOutput().length() > 0 ); + } + + public void testReleaseConfigurationStoreReadFailureOnPerform() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setWorkingDirectory( getTestFile( "target/working-directory" ).getAbsolutePath() ); + + DefaultReleaseManager releaseManager = (DefaultReleaseManager) lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorStore configStoreMock = mock( ReleaseDescriptorStore.class ); + when( configStoreMock.read( builder ) ).thenThrow( new ReleaseDescriptorStoreException( "message", new IOException( "ioExceptionMsg" ) ) ); + + releaseManager.setConfigStore( configStoreMock ); + + ReleasePerformRequest performRequest = new ReleasePerformRequest(); + performRequest.setReleaseDescriptorBuilder( builder ); + performRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + + // execute + try + { + builder.setUseReleaseProfile( false ); + + releaseManager.perform( performRequest ); + fail( "Should have failed to read configuration" ); + } + catch ( ReleaseExecutionException e ) + { + // good + assertEquals( "check cause", ReleaseDescriptorStoreException.class, e.getCause().getClass() ); + } + + // verify + verify( configStoreMock ).read( builder ); + verifyNoMoreInteractions( configStoreMock ); + } + + public void testReleasePerformWithIncompletePrepare() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setWorkingDirectory( getTestFile( "target/working-directory" ).getAbsolutePath() ); + + DefaultReleaseManager releaseManager = (DefaultReleaseManager) lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorStoreStub configStore = new ReleaseDescriptorStoreStub(); + builder.setCompletedPhase( "scm-tag" ); + releaseManager.setConfigStore( configStore ); + + ReleasePerformRequest performRequest = new ReleasePerformRequest(); + performRequest.setReleaseDescriptorBuilder( builder ); + performRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + + try + { + builder.setUseReleaseProfile( false ); + + releaseManager.perform( performRequest ); + fail( "Should have failed to perform" ); + } + catch ( ReleaseFailureException e ) + { + // good + assertTrue( true ); + } + } + + // MRELEASE-758: release:perform no longer removes release.properties + public void testPerformWithDefaultClean() + throws Exception + { + // prepare + ReleasePerformRequest performRequest = new ReleasePerformRequest(); + performRequest.setDryRun( true ); + + ReleaseManagerListener managerListener = mock( ReleaseManagerListener.class ); + performRequest.setReleaseManagerListener( managerListener ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setWorkingDirectory( getTestFile( "target/working-directory" ).getAbsolutePath() ); + performRequest.setReleaseDescriptorBuilder( builder ); + + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + // test + releaseManager.perform( performRequest ); + + // verify + verify( managerListener ).phaseStart( "verify-release-configuration" ); + verify( managerListener ).phaseStart( "verify-completed-prepare-phases" ); + verify( managerListener ).phaseStart( "checkout-project-from-scm" ); + verify( managerListener ).phaseStart( "run-perform-goals" ); + verify( managerListener ).phaseStart( "cleanup" ); + verify( managerListener, times( 5 ) ).phaseEnd(); + + // not part of actual test, but required to confirm 'no more interactions' + verify( managerListener ).goalStart( anyString(), any( List.class ) ); + verify( managerListener ).goalEnd(); + + verifyNoMoreInteractions( managerListener ); + } + + public void testNoScmUrlPerform() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setWorkingDirectory( getTestFile( "target/test/checkout" ).getAbsolutePath() ); + + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + ReleasePerformRequest performRequest = new ReleasePerformRequest(); + performRequest.setReleaseDescriptorBuilder( builder ); + performRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + + try + { + builder.setUseReleaseProfile( false ); + + releaseManager.perform( performRequest ); + + fail( "perform should have failed" ); + } + catch ( ReleaseFailureException e ) + { + assertNull( "check no cause", e.getCause() ); + } + } + + public void testScmExceptionThrown() + throws Exception + { + // prepare + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + File checkoutDirectory = getTestFile( "target/checkout-directory" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkOut( any( ScmRepository.class ), + any( ScmFileSet.class ), + any( ScmTag.class ), + any(CommandParameters.class)) ) + .thenThrow( new ScmException( "..." ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + ReleasePerformRequest performRequest = new ReleasePerformRequest(); + performRequest.setReleaseDescriptorBuilder( builder ); + performRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + performRequest.setReactorProjects( createReactorProjects() ); + + // execute + try + { + releaseManager.perform( performRequest ); + + fail( "commit should have failed" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "check cause", ScmException.class, e.getCause().getClass() ); + } + + // verify + verify( scmProviderMock ).checkOut( any( ScmRepository.class ), any( ScmFileSet.class ), + any( ScmTag.class ), any( CommandParameters.class ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + public void testScmResultFailure() + throws Exception + { + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + File checkoutDirectory = getTestFile( "target/checkout-directory" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + builder.setWorkingDirectory( getTestPath( "target/dummy-project" ) ); + + ScmManager scmManager = (ScmManager) lookup( ScmManager.class ); + ScmProviderStub providerStub = + (ScmProviderStub) scmManager.getProviderByUrl( "scm-url" ); + + providerStub.setCheckOutScmResult( new CheckOutScmResult( "", "", "", false ) ); + + ReleasePerformRequest performRequest = new ReleasePerformRequest(); + performRequest.setReleaseDescriptorBuilder( builder ); + performRequest.setReleaseEnvironment( new DefaultReleaseEnvironment() ); + performRequest.setReactorProjects( createReactorProjects() ); + + try + { + releaseManager.perform( performRequest ); + + fail( "commit should have failed" ); + } + catch ( ReleaseScmCommandException e ) + { + assertNull( "check no other cause", e.getCause() ); + } + } + + // MRELEASE-1042 + public void testKeepProfilesOnPerform() + throws Exception + { + // prepare + ReleasePerformRequest performRequest = new ReleasePerformRequest(); + performRequest.setDryRun( true ); + + ReleaseManagerListener managerListener = mock( ReleaseManagerListener.class ); + performRequest.setReleaseManagerListener( managerListener ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setActivateProfiles( Arrays.asList("aProfile", "anotherOne") ); + builder.setWorkingDirectory( getTestFile( "target/working-directory" ).getAbsolutePath() ); + performRequest.setReleaseDescriptorBuilder( builder ); + + DefaultReleaseManager releaseManager = (DefaultReleaseManager) lookup( ReleaseManager.class, "test" ); + + ReleaseDescriptorBuilder secondBuilder = new ReleaseDescriptorBuilder(); + secondBuilder.setActivateProfiles( new ArrayList( Arrays.asList("aProfile", "bProfile") ) ); + secondBuilder.setScmSourceUrl( "scm-url" ); + ReleaseDescriptorStore configStoreMock = mock( ReleaseDescriptorStore.class ); + when( configStoreMock.read( any( ReleaseDescriptorBuilder.class ) ) ).thenReturn( secondBuilder ); + releaseManager.setConfigStore( configStoreMock ); + + // test + ReleaseResult result = releaseManager.performWithResult( performRequest ); + + // verify + assertTrue( result.getOutput().contains( "-P aProfile,bProfile,anotherOne" ) ); + } + + public void testDetermineWorkingDirectory() + throws Exception + { + DefaultReleaseManager defaultReleaseManager = new DefaultReleaseManager(); + + File checkoutDir = getTestFile( "target/checkout" ); + FileUtils.forceDelete( checkoutDir ); + checkoutDir.mkdirs(); + + File projectDir = getTestFile( "target/checkout/my/project" ); + projectDir.mkdirs(); + + // only checkout dir + assertEquals( checkoutDir, defaultReleaseManager.determineWorkingDirectory( checkoutDir, "" ) ); + assertEquals( checkoutDir, defaultReleaseManager.determineWorkingDirectory( checkoutDir, null ) ); + + // checkout dir and relative path project dir + assertEquals( projectDir, defaultReleaseManager.determineWorkingDirectory( checkoutDir, "my/project" ) ); + assertEquals( projectDir, defaultReleaseManager.determineWorkingDirectory( checkoutDir, "my/project/" ) ); + assertEquals( projectDir, defaultReleaseManager.determineWorkingDirectory( checkoutDir, "my" + File.separator + + "project" ) ); + + FileUtils.forceDelete( checkoutDir ); + } + + // MRELEASE-761 + public void testRollbackCall() + throws Exception + { + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + ReleaseRollbackRequest rollbackRequest = new ReleaseRollbackRequest(); + rollbackRequest.setReleaseDescriptorBuilder( configStore.getReleaseConfiguration() ); + + releaseManager.rollback( rollbackRequest ); + + ReleasePhaseStub phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "rollbackPhase1" ); + + assertTrue( "rollbackPhase1 executed", phase.isExecuted() ); + } + + + // MRELEASE-765 + public void testUpdateVersionsCall() + throws Exception + { + ReleaseManager releaseManager = lookup( ReleaseManager.class, "test" ); + + ReleaseUpdateVersionsRequest updateVersionsRequest = new ReleaseUpdateVersionsRequest(); + updateVersionsRequest.setReleaseDescriptorBuilder( configStore.getReleaseConfiguration() ); + updateVersionsRequest.setUserProperties( new Properties() ); + + releaseManager.updateVersions( updateVersionsRequest ); + + ReleasePhaseStub phase = (ReleasePhaseStub) lookup( ReleasePhase.class, "updateVersionsPhase1" ); + + assertTrue( "updateVersionsPhase1 executed", phase.isExecuted() ); + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/PlexusJUnit4TestCase.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/PlexusJUnit4TestCase.java new file mode 100644 index 000000000..9b491cc29 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/PlexusJUnit4TestCase.java @@ -0,0 +1,291 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.InputStream; + +import org.codehaus.plexus.ContainerConfiguration; +import org.codehaus.plexus.DefaultContainerConfiguration; +import org.codehaus.plexus.DefaultPlexusContainer; +import org.codehaus.plexus.PlexusContainer; +import org.codehaus.plexus.PlexusContainerException; +import org.codehaus.plexus.configuration.PlexusConfiguration; +import org.codehaus.plexus.context.Context; +import org.codehaus.plexus.context.DefaultContext; +import org.junit.After; +import org.junit.Before; + +/** + * Based on PlexusTestCase from org.sonatype.sisu:sisu-inject-plexus + * + * @author Robert Scholte + */ +public abstract class PlexusJUnit4TestCase +{ + private PlexusContainer container; + + private static String basedir; + + @Before + public void setUp() + throws Exception + { + basedir = getBasedir(); + } + + protected void setupContainer() + { + // ---------------------------------------------------------------------------- + // Context Setup + // ---------------------------------------------------------------------------- + + final DefaultContext context = new DefaultContext(); + + context.put( "basedir", getBasedir() ); + + customizeContext( context ); + + final boolean hasPlexusHome = context.contains( "plexus.home" ); + + if ( !hasPlexusHome ) + { + final File f = getTestFile( "target/plexus-home" ); + + if ( !f.isDirectory() ) + { + f.mkdir(); + } + + context.put( "plexus.home", f.getAbsolutePath() ); + } + + // ---------------------------------------------------------------------------- + // Configuration + // ---------------------------------------------------------------------------- + + final String config = getCustomConfigurationName(); + + final ContainerConfiguration containerConfiguration = + new DefaultContainerConfiguration().setName( "test" ).setContext( context.getContextData() ).setClassPathCaching( true ); + + if ( config != null ) + { + containerConfiguration.setContainerConfiguration( config ); + } + else + { + final String resource = getConfigurationName( null ); + + containerConfiguration.setContainerConfiguration( resource ); + } + + customizeContainerConfiguration( containerConfiguration ); + + try + { + container = new DefaultPlexusContainer( containerConfiguration ); + } + catch ( final PlexusContainerException e ) + { + e.printStackTrace(); + fail( "Failed to create plexus container." ); + } + } + + /** + * Allow custom test case implementations do augment the default container configuration before executing tests. + * + * @param containerConfiguration + */ + protected void customizeContainerConfiguration( final ContainerConfiguration containerConfiguration ) + { + } + + protected void customizeContext( final Context context ) + { + } + + protected PlexusConfiguration customizeComponentConfiguration() + { + return null; + } + + @After + public void tearDown() + throws Exception + { + if ( container != null ) + { + container.dispose(); + + container = null; + } + } + + protected PlexusContainer getContainer() + { + if ( container == null ) + { + setupContainer(); + } + + return container; + } + + protected InputStream getConfiguration() + throws Exception + { + return getConfiguration( null ); + } + + @SuppressWarnings( "unused" ) + protected InputStream getConfiguration( final String subname ) + throws Exception + { + return getResourceAsStream( getConfigurationName( subname ) ); + } + + protected String getCustomConfigurationName() + { + return null; + } + + /** + * Allow the retrieval of a container configuration that is based on the name of the test class being run. So if you + * have a test class called org.foo.FunTest, then this will produce a resource name of org/foo/FunTest.xml which + * would be used to configure the Plexus container before running your test. + * + * @param subname + * @return + */ + protected String getConfigurationName( final String subname ) + { + return getClass().getName().replace( '.', '/' ) + ".xml"; + } + + protected InputStream getResourceAsStream( final String resource ) + { + return getClass().getResourceAsStream( resource ); + } + + protected ClassLoader getClassLoader() + { + return getClass().getClassLoader(); + } + + // ---------------------------------------------------------------------- + // Container access + // ---------------------------------------------------------------------- + + protected Object lookup( final String componentKey ) + throws Exception + { + return getContainer().lookup( componentKey ); + } + + protected Object lookup( final String role, final String roleHint ) + throws Exception + { + return getContainer().lookup( role, roleHint ); + } + + protected T lookup( final Class componentClass ) + throws Exception + { + return getContainer().lookup( componentClass ); + } + + protected T lookup( final Class componentClass, final String roleHint ) + throws Exception + { + return getContainer().lookup( componentClass, roleHint ); + } + + protected void release( final Object component ) + throws Exception + { + getContainer().release( component ); + } + + // ---------------------------------------------------------------------- + // Helper methods for sub classes + // ---------------------------------------------------------------------- + + public static File getTestFile( final String path ) + { + return new File( getBasedir(), path ); + } + + @SuppressWarnings( "hiding" ) + public static File getTestFile( final String basedir, final String path ) + { + File basedirFile = new File( basedir ); + + if ( !basedirFile.isAbsolute() ) + { + basedirFile = getTestFile( basedir ); + } + + return new File( basedirFile, path ); + } + + public static String getTestPath( final String path ) + { + return getTestFile( path ).getAbsolutePath(); + } + + @SuppressWarnings( "hiding" ) + public static String getTestPath( final String basedir, final String path ) + { + return getTestFile( basedir, path ).getAbsolutePath(); + } + + public static String getBasedir() + { + if ( basedir != null ) + { + return basedir; + } + + basedir = System.getProperty( "basedir" ); + + if ( basedir == null ) + { + basedir = new File( "" ).getAbsolutePath(); + } + + return basedir; + } + + public String getTestConfiguration() + { + return getTestConfiguration( getClass() ); + } + + public static String getTestConfiguration( final Class clazz ) + { + final String s = clazz.getName().replace( '.', '/' ); + + return s.substring( 0, s.indexOf( "$" ) ) + ".xml"; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStoreTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStoreTest.java new file mode 100644 index 000000000..e563fab00 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStoreTest.java @@ -0,0 +1,499 @@ +package org.apache.maven.shared.release.config; + +import static org.junit.Assert.assertNotEquals; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder.BuilderReleaseDescriptor; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.phase.AbstractReleaseTestCase; +import org.apache.maven.shared.release.scm.IdentifiedScm; +import org.codehaus.plexus.PlexusTestCase; +import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher; + +/** + * Test the properties store. + * + * @author Brett Porter + */ +public class PropertiesReleaseDescriptorStoreTest + extends PlexusTestCase +{ + private PropertiesReleaseDescriptorStore store; + + private SecDispatcher secDispatcher; + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + store = (PropertiesReleaseDescriptorStore) lookup( ReleaseDescriptorStore.class, "properties" ); + secDispatcher = lookup( SecDispatcher.class, "mng-4384" ); + } + + public void testReadFromFile() + throws ReleaseDescriptorStoreException + { + File file = getTestFile( "target/test-classes/release.properties" ); + + ReleaseDescriptor config = store.read( file ).build(); + + ReleaseDescriptor expected = createExpectedReleaseConfiguration().build(); + + assertEquals( "check matches", expected, config ); + } + + public void testReadFromFileUsingWorkingDirectory() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setWorkingDirectory( AbstractReleaseTestCase.getPath( getTestFile( "target/test-classes" ) ) ); + ReleaseDescriptor config = store.read( builder ).build(); + + ReleaseDescriptorBuilder expected = createExpectedReleaseConfiguration(); + expected.setWorkingDirectory( builder.build().getWorkingDirectory() ); + + assertEquals( "check matches", expected.build(), config ); + } + + public void testReadFromEmptyFile() + throws ReleaseDescriptorStoreException + { + File file = getTestFile( "target/test-classes/empty-release.properties" ); + + BuilderReleaseDescriptor config = store.read( file ).build(); + + assertDefaultReleaseConfiguration( config ); + } + + public void testReadMissingFile() + throws ReleaseDescriptorStoreException + { + File file = getTestFile( "target/test-classes/no-release.properties" ); + + BuilderReleaseDescriptor config = store.read( file ).build(); + + assertDefaultReleaseConfiguration( config ); + } + + public void testMergeFromEmptyFile() + throws ReleaseDescriptorStoreException, IOException + { + File file = getTestFile( "target/test-classes/empty-release.properties" ); + + ReleaseDescriptorBuilder mergeDescriptor = createMergeConfiguration(); + ReleaseDescriptor config = store.read( mergeDescriptor, file ).build(); + + assertEquals( "Check configurations merged", mergeDescriptor.build(), config ); + } + + public void testMergeFromMissingFile() + throws ReleaseDescriptorStoreException, IOException + { + File file = getTestFile( "target/test-classes/no-release.properties" ); + + ReleaseDescriptorBuilder mergeDescriptor = createMergeConfiguration(); + ReleaseDescriptor config = store.read( mergeDescriptor, file ).build(); + + assertEquals( "Check configurations merged", mergeDescriptor.build(), config ); + } + + public void testWriteToNewFile() + throws Exception + { + File file = getTestFile( "target/test-classes/new-release.properties" ); + file.delete(); + assertFalse( "Check file doesn't exist", file.exists() ); + + ReleaseDescriptorBuilder config = createReleaseConfigurationForWriting(); + + store.write( config.build(), file ); + + ReleaseDescriptor rereadDescriptor = store.read( file ).build(); + + assertAndAdjustScmPassword( config, rereadDescriptor ); + assertAndAdjustScmPrivateKeyPassPhrase( config, rereadDescriptor ); + + assertEquals( "compare configuration", config.build(), rereadDescriptor ); + } + + public void testWriteToWorkingDirectory() + throws Exception + { + File file = getTestFile( "target/test-classes/new/release.properties" ); + file.delete(); + assertFalse( "Check file doesn't exist", file.exists() ); + file.getParentFile().mkdirs(); + + ReleaseDescriptorBuilder config = createReleaseConfigurationForWriting(); + config.setWorkingDirectory( AbstractReleaseTestCase.getPath( file.getParentFile() ) ); + + store.write( config.build() ); + + ReleaseDescriptorBuilder rereadDescriptorBuilder = store.read( file ); + rereadDescriptorBuilder.setWorkingDirectory( AbstractReleaseTestCase.getPath( file.getParentFile() ) ); + + assertAndAdjustScmPassword( config, rereadDescriptorBuilder.build() ); + assertAndAdjustScmPrivateKeyPassPhrase( config, rereadDescriptorBuilder.build() ); + + assertEquals( "compare configuration", config.build(), rereadDescriptorBuilder.build() ); + } + + public void testWriteToNewFileRequiredOnly() + throws ReleaseDescriptorStoreException + { + File file = getTestFile( "target/test-classes/new-release.properties" ); + file.delete(); + assertFalse( "Check file doesn't exist", file.exists() ); + + ReleaseDescriptorBuilder config = new ReleaseDescriptorBuilder(); + config.setCompletedPhase( "completed-phase-write" ); + config.setScmSourceUrl( "url-write" ); + + store.write( config.build(), file ); + + ReleaseDescriptor rereadDescriptor = store.read( file ).build(); + + assertEquals( "compare configuration", config.build(), rereadDescriptor ); + } + + public void testWriteToNewFileDottedIds() + throws ReleaseDescriptorStoreException + { + File file = getTestFile( "target/test-classes/new-release.properties" ); + file.delete(); + assertFalse( "Check file doesn't exist", file.exists() ); + + ReleaseDescriptorBuilder config = new ReleaseDescriptorBuilder(); + config.setCompletedPhase( "completed-phase-write" ); + config.setScmSourceUrl( "url-write" ); + + config.addReleaseVersion( "group.id:artifact.id", "1.1" ); + config.addDevelopmentVersion( "group.id:artifact.id", "1.2-SNAPSHOT" ); + + IdentifiedScm scm = new IdentifiedScm(); + scm.setId( "id" ); + scm.setConnection( "connection" ); + scm.setDeveloperConnection( "devConnection" ); + scm.setTag( "tag" ); + scm.setUrl( "url" ); + config.addOriginalScmInfo( "group.id:artifact.id", scm ); + + store.write( config.build(), file ); + + ReleaseDescriptor rereadDescriptor = store.read( file ).build(); + + assertEquals( "compare configuration", config.build(), rereadDescriptor ); + } + + public void testWriteToNewFileNullMappedScm() + throws ReleaseDescriptorStoreException + { + File file = getTestFile( "target/test-classes/new-release.properties" ); + file.delete(); + assertFalse( "Check file doesn't exist", file.exists() ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setCompletedPhase( "completed-phase-write" ); + builder.setScmSourceUrl( "url-write" ); + + builder.addReleaseVersion( "group.id:artifact.id", "1.1" ); + builder.addDevelopmentVersion( "group.id:artifact.id", "1.2-SNAPSHOT" ); + + builder.addOriginalScmInfo( "group.id:artifact.id", null ); + + store.write( builder.build(), file ); + + ReleaseDescriptor rereadDescriptor = store.read( file ).build(); + + assertNull( "check null scm is mapped correctly", + rereadDescriptor.getOriginalScmInfo( "group.id:artifact.id" ) ); + + assertEquals( "compare configuration", builder.build(), rereadDescriptor ); + } + + public void testOverwriteFile() + throws Exception + { + File file = getTestFile( "target/test-classes/rewrite-release.properties" ); + assertTrue( "Check file already exists", file.exists() ); + + ReleaseDescriptorBuilder config = createReleaseConfigurationForWriting(); + + store.write( config.build(), file ); + + ReleaseDescriptor rereadDescriptor = store.read( file ).build(); + + assertAndAdjustScmPassword( config, rereadDescriptor ); + assertAndAdjustScmPrivateKeyPassPhrase( config, rereadDescriptor ); + + assertEquals( "compare configuration", config.build(), rereadDescriptor ); + } + + public void testDeleteFile() + throws ReleaseDescriptorStoreException, IOException + { + File file = getTestFile( "target/test-classes/delete/release.properties" ); + file.getParentFile().mkdirs(); + file.createNewFile(); + assertTrue( "Check file already exists", file.exists() ); + + ReleaseDescriptorBuilder config = createReleaseConfigurationForWriting(); + config.setWorkingDirectory( AbstractReleaseTestCase.getPath( file.getParentFile() ) ); + + store.delete( config.build() ); + + assertFalse( "Check file already exists", file.exists() ); + } + + public void testMissingDeleteFile() + throws ReleaseDescriptorStoreException, IOException + { + File file = getTestFile( "target/test-classes/delete/release.properties" ); + file.getParentFile().mkdirs(); + file.delete(); + assertFalse( "Check file already exists", file.exists() ); + + ReleaseDescriptorBuilder config = createReleaseConfigurationForWriting(); + config.setWorkingDirectory( AbstractReleaseTestCase.getPath( file.getParentFile() ) ); + + store.delete( config.build() ); + + assertFalse( "Check file already exists", file.exists() ); + } + + public void testWriteEncryptedProperties() + throws Exception + { + final String scmPassword = "s3cr3t_SCMPASSWORD"; + final String scmPassPhrase = "s3cr3t_SCMPASSPHRASE"; + + ReleaseDescriptorBuilder config = new ReleaseDescriptorBuilder(); + config.setCompletedPhase( "completed-phase-write" ); + config.setScmSourceUrl( "url-write" ); + + config.setScmPassword( scmPassword ); + config.setScmPrivateKeyPassPhrase( scmPassPhrase ); + + File file = getTestFile( "target/test-classes/encrypt/release.properties" ); + file.getParentFile().mkdirs(); + + store.write( config.build(), file ); + + Properties persistedProperties = new Properties(); + try ( InputStream is = new FileInputStream( file ) ) + { + persistedProperties.load( is ); + } + + String persistedPassword = persistedProperties.getProperty( "scm.password" ); + assertNotNull( persistedPassword ); + assertNotEquals( scmPassword, persistedPassword ); + + String persistedPassPhrase = persistedProperties.getProperty( "scm.passphrase" ); + assertNotNull( persistedPassPhrase ); + assertNotEquals( scmPassPhrase, persistedPassPhrase ); + + ReleaseDescriptorBuilder builder = store.read( file ); + BuilderReleaseDescriptor descriptor = builder.build(); + assertEquals( scmPassword, descriptor.getScmPassword() ); + assertEquals( scmPassPhrase, descriptor.getScmPrivateKeyPassPhrase() ); + } + + private ReleaseDescriptorBuilder createReleaseConfigurationForWriting() + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setCompletedPhase( "completed-phase-write" ); + builder.setCommitByProject( true ); + builder.setScmSourceUrl( "url-write" ); + builder.setScmId( "id-write" ); + builder.setScmUsername( "username-write" ); + builder.setScmPassword( "password-write" ); + builder.setScmPrivateKey( "private-key-write" ); + builder.setScmPrivateKeyPassPhrase( "passphrase-write" ); + builder.setScmTagBase( "tag-base-write" ); + builder.setScmBranchBase( "branch-base-write" ); + builder.setScmReleaseLabel( "tag-write" ); + builder.setAdditionalArguments( "additional-args-write" ); + builder.setPreparationGoals( "preparation-goals-write" ); + builder.setCompletionGoals( "completion-goals-write" ); + builder.setPomFileName( "pom-file-name-write" ); + + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.addDevelopmentVersion( "groupId:artifactId", "1.1-SNAPSHOT" ); + + IdentifiedScm scm = new IdentifiedScm(); + scm.setId( "id-write" ); + scm.setConnection( "connection-write" ); + scm.setDeveloperConnection( "developerConnection-write" ); + scm.setUrl( "url-write" ); + scm.setTag( "tag-write" ); + builder.addOriginalScmInfo( "groupId:artifactId", scm ); + + scm = new IdentifiedScm(); + scm.setConnection( "connection-write" ); + // omit optional elements + builder.addOriginalScmInfo( "groupId:subproject1", scm ); + + return builder; + } + + private static void assertDefaultReleaseConfiguration( BuilderReleaseDescriptor config ) + { + assertNull( "Expected no completedPhase", config.getCompletedPhase() ); + assertFalse( "Expected no commitPerProject", config.isCommitByProject() ); + assertNull( "Expected no id", config.getScmId() ); + assertNull( "Expected no url", config.getScmSourceUrl() ); + assertNull( "Expected no username", config.getScmUsername() ); + assertNull( "Expected no password", config.getScmPassword() ); + assertNull( "Expected no privateKey", config.getScmPrivateKey() ); + assertNull( "Expected no passphrase", config.getScmPrivateKeyPassPhrase() ); + assertNull( "Expected no tagBase", config.getScmTagBase() ); + assertNull( "Expected no tag", config.getScmReleaseLabel() ); + assertNull( "Expected no additional arguments", config.getAdditionalArguments() ); + assertNull( "Expected no preparation goals", config.getPreparationGoals() ); + assertNull( "Expected no completion goals", config.getCompletionGoals() ); + assertNull( "Expected no pom file name", config.getPomFileName() ); + + assertNull( "Expected no workingDirectory", config.getWorkingDirectory() ); + assertFalse( "Expected no generateReleasePoms", config.isGenerateReleasePoms() ); + assertFalse( "Expected no useEditMode", config.isScmUseEditMode() ); + assertTrue( "Expected default interactive", config.isInteractive() ); + assertFalse( "Expected no addScema", config.isAddSchema() ); + + for ( ReleaseStageVersions versions : config.getProjectVersions().values() ) + { + assertNull( "Expected no release version mappings", versions.getRelease() ); + assertNull( "Expected no dev version mappings", versions.getDevelopment() ); + } + assertTrue( "Expected no scm mappings", config.getOriginalScmInfo().isEmpty() ); + assertNotNull( "Expected resolved snapshot dependencies map", config.getResolvedSnapshotDependencies() ); + } + + public ReleaseDescriptorBuilder createMergeConfiguration() + throws IOException + { + ReleaseDescriptorBuilder releaseDescriptor = new ReleaseDescriptorBuilder(); + + releaseDescriptor.setScmSourceUrl( "scm-url" ); + releaseDescriptor.setScmUsername( "username" ); + // Not setting other optional SCM settings for brevity + + File workingDir = getTestFile( "target/test-working-directory" ); + if ( !workingDir.exists() ) + { + assertTrue( "Failed to create the directory, along with all necessary parent directories", + workingDir.mkdirs() ); + } + + releaseDescriptor.setWorkingDirectory( AbstractReleaseTestCase.getPath( workingDir ) ); + // Not setting non-override setting completedPhase + + return releaseDescriptor; + } + + private void assertAndAdjustScmPassword( ReleaseDescriptorBuilder expected, ReleaseDescriptor original ) + throws Exception + { + String expectedPassword = expected.build().getScmPassword(); + String originalPassword = original.getScmPassword(); + + // encrypting the same password twice doesn't have to be the same result + if ( expectedPassword != null ? !expectedPassword.equals( originalPassword ) : originalPassword != null ) + { + assertEquals( secDispatcher.decrypt( expectedPassword ), secDispatcher.decrypt( originalPassword ) ); + + expected.setScmPassword( originalPassword ); + } + assertEquals( expected.build().getScmPassword(), original.getScmPassword() ); + } + + private void assertAndAdjustScmPrivateKeyPassPhrase( ReleaseDescriptorBuilder expected, ReleaseDescriptor original ) + throws Exception + { + String expectedPassPhrase = expected.build().getScmPrivateKeyPassPhrase(); + String originalPassPhrase = original.getScmPrivateKeyPassPhrase(); + + // encrypting the same passphrase twice doesn't have to be the same result + if ( expectedPassPhrase != null ? !expectedPassPhrase.equals( originalPassPhrase ) : originalPassPhrase != null ) + { + assertEquals( secDispatcher.decrypt( expectedPassPhrase ), secDispatcher.decrypt( originalPassPhrase ) ); + + expected.setScmPrivateKeyPassPhrase( originalPassPhrase ); + } + assertEquals( expected.build().getScmPrivateKeyPassPhrase(), original.getScmPrivateKeyPassPhrase() ); + } + + private ReleaseDescriptorBuilder createExpectedReleaseConfiguration() + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setCompletedPhase( "step1" ); + builder.setCommitByProject( true ); + builder.setScmId( "scm-id" ); + builder.setScmSourceUrl( "scm-url" ); + builder.setScmUsername( "username" ); + builder.setScmPassword( "password" ); + builder.setScmPrivateKey( "private-key" ); + builder.setScmPrivateKeyPassPhrase( "passphrase" ); + builder.setScmTagBase( "tagBase" ); + builder.setScmTagNameFormat( "expectedTagNameFormat" ); + builder.setScmBranchBase( "branchBase" ); + builder.setScmReleaseLabel( "tag" ); + builder.setAdditionalArguments( "additional-arguments" ); + builder.setPreparationGoals( "preparation-goals" ); + builder.setCompletionGoals( "completion-goals" ); + builder.setPomFileName( "pom-file-name" ); + builder.setWorkingDirectory( null ); + builder.setGenerateReleasePoms( false ); + builder.setScmUseEditMode( false ); + builder.setInteractive( true ); + builder.setAddSchema( false ); + builder.addReleaseVersion( "groupId:artifactId1", "2.0" ); + builder.addReleaseVersion( "groupId:artifactId2", "3.0" ); + builder.addDevelopmentVersion( "groupId:artifactId1", "2.1-SNAPSHOT" ); + builder.addDevelopmentVersion( "groupId:artifactId2", "3.0.1-SNAPSHOT" ); + IdentifiedScm scm = new IdentifiedScm(); + scm.setId( "id" ); + scm.setConnection( "connection" ); + scm.setDeveloperConnection( "developerConnection" ); + scm.setUrl( "url" ); + scm.setTag( "tag" ); + builder.addOriginalScmInfo( "groupId:artifactId1", scm ); + scm = new IdentifiedScm(); + scm.setId( null ); + scm.setConnection( "connection2" ); + scm.setUrl( "url2" ); + scm.setTag( null ); + scm.setDeveloperConnection( null ); + builder.addOriginalScmInfo( "groupId:artifactId2", scm ); + builder.addDependencyReleaseVersion( "external:artifactId", "1.0" ); + builder.addDependencyDevelopmentVersion( "external:artifactId", "1.1-SNAPSHOT" ); + + return builder; + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/ReleaseDescriptorStoreStub.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/ReleaseDescriptorStoreStub.java new file mode 100644 index 000000000..1352d288a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/ReleaseDescriptorStoreStub.java @@ -0,0 +1,55 @@ +package org.apache.maven.shared.release.config; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Test stub for the release configuration store that holds a single configuration in memory. + * + * @author Brett Porter + */ +public class ReleaseDescriptorStoreStub + implements ReleaseDescriptorStore +{ + /** + * The release configuration to use. + */ + private ReleaseDescriptorBuilder releaseDescriptor = new ReleaseDescriptorBuilder(); + + @Override + public ReleaseDescriptorBuilder read( ReleaseDescriptorBuilder mergeDescriptor ) + { + return mergeDescriptor; + } + + @Override + public void write( ReleaseDescriptor config ) + { + } + + @Override + public void delete( ReleaseDescriptor config ) + { + } + + public ReleaseDescriptorBuilder getReleaseConfiguration() + { + return releaseDescriptor; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/ReleaseUtilsTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/ReleaseUtilsTest.java new file mode 100644 index 000000000..22faa9760 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/config/ReleaseUtilsTest.java @@ -0,0 +1,306 @@ +package org.apache.maven.shared.release.config; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.ArtifactUtils; +import org.apache.maven.model.Scm; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder.BuilderReleaseDescriptor; +import org.apache.maven.shared.release.phase.AbstractReleaseTestCase; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.Properties; + +/** + * ReleaseDescriptor Tester. + * + * @author Brett Porter + */ +public class ReleaseUtilsTest + extends TestCase +{ + public void testEquals() + throws IOException + { + ReleaseDescriptorBuilder originalReleaseDescriptor = createReleaseDescriptor(); + ReleaseDescriptorBuilder builder = copyReleaseDescriptor( originalReleaseDescriptor.build() ); + doEqualsAssertions( builder, originalReleaseDescriptor, "other", new File( "target/test-working-directory" ) ); + originalReleaseDescriptor = createReleaseDescriptor(); + builder = copyReleaseDescriptor( originalReleaseDescriptor.build() ); + doEqualsAssertions( originalReleaseDescriptor, builder, "other", new File( "target/test-working-directory" ) ); + + originalReleaseDescriptor = createReleaseDescriptor(); + builder = copyReleaseDescriptor( originalReleaseDescriptor.build() ); + doEqualsAssertions( builder, originalReleaseDescriptor, null, null ); + originalReleaseDescriptor = createReleaseDescriptor(); + builder = copyReleaseDescriptor( originalReleaseDescriptor.build() ); + doEqualsAssertions( originalReleaseDescriptor, builder, null, null ); + + assertEquals( "test ==", builder, builder ); + Object obj = this; + assertFalse( "test class instance", builder.equals( obj ) ); + } + + private static void doEqualsAssertions( ReleaseDescriptorBuilder releaseDescriptor, + ReleaseDescriptorBuilder originalReleaseDescriptor, String other, File otherFile ) + throws IOException + { + BuilderReleaseDescriptor origConfig = originalReleaseDescriptor.build(); + ReleaseDescriptorBuilder configBuilder = releaseDescriptor; + assertEquals( "Check original comparison", configBuilder.build(), origConfig ); + + configBuilder.setScmSourceUrl( other ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setScmSourceUrl( origConfig.getScmSourceUrl() ); + + configBuilder.setAdditionalArguments( other ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setAdditionalArguments( origConfig.getAdditionalArguments() ); + + configBuilder.setAddSchema( !origConfig.isAddSchema() ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setAddSchema( origConfig.isAddSchema() ); + + configBuilder.setGenerateReleasePoms( !origConfig.isAddSchema() ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setGenerateReleasePoms( origConfig.isGenerateReleasePoms() ); + + configBuilder.setScmUseEditMode( !origConfig.isScmUseEditMode() ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setScmUseEditMode( origConfig.isScmUseEditMode() ); + + configBuilder.setInteractive( !origConfig.isInteractive() ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setInteractive( origConfig.isInteractive() ); + + configBuilder.setCommitByProject( !origConfig.isCommitByProject() ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setCommitByProject( origConfig.isCommitByProject() ); + + configBuilder.setCompletedPhase( other ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setCompletedPhase( origConfig.getCompletedPhase() ); + + configBuilder.setScmPrivateKeyPassPhrase( other ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setScmPrivateKeyPassPhrase( origConfig.getScmPrivateKeyPassPhrase() ); + + configBuilder.setScmPassword( other ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setScmPassword( origConfig.getScmPassword() ); + + configBuilder.setScmUsername( other ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setScmUsername( origConfig.getScmUsername() ); + + configBuilder.setScmPrivateKey( other ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setScmPrivateKey( origConfig.getScmPrivateKey() ); + + configBuilder.setPomFileName( other ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setPomFileName( origConfig.getPomFileName() ); + + configBuilder.setPreparationGoals( other ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setPreparationGoals( origConfig.getPreparationGoals() ); + + configBuilder.setScmReleaseLabel( other ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setScmReleaseLabel( origConfig.getScmReleaseLabel() ); + + configBuilder.setScmTagBase( other ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder.setScmTagBase( origConfig.getScmTagBase() ); + + if ( otherFile != null ) + { + if ( !otherFile.exists() ) + { + assertTrue( "Failed to create the directory, along with all necessary parent directories", + otherFile.mkdirs() ); + } + configBuilder.setWorkingDirectory( AbstractReleaseTestCase.getPath( otherFile ) ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + } + + configBuilder.setWorkingDirectory( origConfig.getWorkingDirectory() ); + + // sanity check the test was resetting correctly + assertEquals( "Check original comparison", configBuilder.build(), origConfig ); + + configBuilder.addDevelopmentVersion( "groupId:artifactId", "1.0-SNAPSHOT" ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder = copyReleaseDescriptor( origConfig ); + + configBuilder.addReleaseVersion( "groupId:artifactId", "1.0" ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder = copyReleaseDescriptor( origConfig ); + + configBuilder.addOriginalScmInfo( "groupId:artifactId", new Scm() ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + configBuilder = copyReleaseDescriptor( origConfig ); + + configBuilder.addOriginalScmInfo( "groupId:artifactId", new Scm() ); + origConfig.addOriginalScmInfo( "foo", new Scm() ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + origConfig = createReleaseDescriptor().build(); + configBuilder = copyReleaseDescriptor( origConfig ); + + configBuilder.addOriginalScmInfo( "groupId:artifactId", new Scm() ); + origConfig.addOriginalScmInfo( "groupId:artifactId", new Scm() ); + assertEquals( "Check original comparison", configBuilder.build(), origConfig ); + origConfig = createReleaseDescriptor().build(); + configBuilder = copyReleaseDescriptor( origConfig ); + + configBuilder.addOriginalScmInfo( "groupId:artifactId", getScm( "conn", "dev", "url", "tag" ) ); + origConfig.addOriginalScmInfo( "groupId:artifactId", getScm( "conn", "dev", "url", "tag" ) ); + assertEquals( "Check original comparison", configBuilder.build(), origConfig ); + origConfig = createReleaseDescriptor().build(); + configBuilder = copyReleaseDescriptor( origConfig ); + + configBuilder.addOriginalScmInfo( "groupId:artifactId", getScm( "-", "dev", "url", "tag" ) ); + origConfig.addOriginalScmInfo( "groupId:artifactId", getScm( "conn", "dev", "url", "tag" ) ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + origConfig = createReleaseDescriptor().build(); + configBuilder = copyReleaseDescriptor( origConfig ); + + configBuilder.addOriginalScmInfo( "groupId:artifactId", getScm( "conn", "-", "url", "tag" ) ); + origConfig.addOriginalScmInfo( "groupId:artifactId", getScm( "conn", "dev", "url", "tag" ) ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + origConfig = createReleaseDescriptor().build(); + configBuilder = copyReleaseDescriptor( origConfig ); + + configBuilder.addOriginalScmInfo( "groupId:artifactId", getScm( "conn", "dev", "-", "tag" ) ); + origConfig.addOriginalScmInfo( "groupId:artifactId", getScm( "conn", "dev", "url", "tag" ) ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + origConfig = createReleaseDescriptor().build(); + configBuilder = copyReleaseDescriptor( origConfig ); + + configBuilder.addOriginalScmInfo( "groupId:artifactId", getScm( "conn", "dev", "url", "-" ) ); + origConfig.addOriginalScmInfo( "groupId:artifactId", getScm( "conn", "dev", "url", "tag" ) ); + assertFalse( "Check original comparison", configBuilder.build().equals( origConfig ) ); + } + + public void testHashCode() + throws IOException + { + ReleaseDescriptor releaseDescriptor = createReleaseDescriptor().build(); + + assertEquals( "Check hash code", releaseDescriptor.hashCode(), + createReleaseDescriptor( releaseDescriptor.getWorkingDirectory() ).build().hashCode() ); + } + + public void testLoadResolvedDependencies() + { + Properties properties = new Properties(); + String dependencyKey = ArtifactUtils.versionlessKey( "com.groupId", "artifactId" ); + properties.put( "dependency." + dependencyKey + ".release", "1.3" ); + properties.put( "dependency." + dependencyKey + ".development", "1.3-SNAPSHOT" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + ReleaseUtils.copyPropertiesToReleaseDescriptor( properties, builder ); + ReleaseDescriptor descriptor = builder.build(); + + assertEquals( "1.3", descriptor.getDependencyReleaseVersion( dependencyKey ) ); + assertEquals( "1.3-SNAPSHOT", descriptor.getDependencyDevelopmentVersion( dependencyKey ) ); + } + + // MRELEASE-750 + public void testArtifactIdEndswithDependency() + { + Properties properties = new Properties(); + String relDependencyKey = ArtifactUtils.versionlessKey( "com.release.magic", "dependency" ); + properties.put( "dependency." + relDependencyKey + ".release", "1.3" ); + String devDependencyKey = ArtifactUtils.versionlessKey( "com.development.magic", "dependency" ); + properties.put( "dependency." + devDependencyKey + ".development", "1.3-SNAPSHOT" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + ReleaseUtils.copyPropertiesToReleaseDescriptor( properties, builder ); + ReleaseDescriptor descriptor = builder.build(); + + assertEquals( "1.3", descriptor.getDependencyReleaseVersion( relDependencyKey ) ); + assertEquals( "1.3-SNAPSHOT", descriptor.getDependencyDevelopmentVersion( devDependencyKey ) ); + } + + // MRELEASE-834 + public void testSystemPropertyStartingWithDependency() + { + Properties properties = new Properties(); + properties.setProperty( "dependency.locations.enabled", "false" ); + ReleaseUtils.copyPropertiesToReleaseDescriptor( properties, new ReleaseDescriptorBuilder() ); + } + + // MRELEASE-1038 + public void testActiveProfilesProperty() + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + Properties properties = new Properties(); + properties.setProperty( "exec.activateProfiles", "aProfile,anotherOne" ); + ReleaseUtils.copyPropertiesToReleaseDescriptor( properties, builder ); + + assertEquals( Arrays.asList("aProfile", "anotherOne"), builder.build().getActivateProfiles() ); + } + + private static ReleaseDescriptorBuilder copyReleaseDescriptor( ReleaseDescriptor originalReleaseDescriptor ) + { + return createReleaseDescriptor( originalReleaseDescriptor.getWorkingDirectory() ); + } + + private static Scm getScm( String connection, String developerConnection, String url, String tag ) + { + Scm scm = new Scm(); + scm.setConnection( connection ); + scm.setDeveloperConnection( developerConnection ); + scm.setTag( tag ); + scm.setUrl( url ); + return scm; + } + + private static ReleaseDescriptorBuilder createReleaseDescriptor() + throws IOException + { + File workingDirectory = new File( "." ); + + return createReleaseDescriptor(AbstractReleaseTestCase.getPath( workingDirectory ) ); + } + + private static ReleaseDescriptorBuilder createReleaseDescriptor( String workingDirectory ) + { + ReleaseDescriptorBuilder releaseDescriptor = new ReleaseDescriptorBuilder(); + releaseDescriptor.setScmSourceUrl( "scm-url" ); + releaseDescriptor.setCompletedPhase( "completed-phase" ); + releaseDescriptor.setScmPrivateKeyPassPhrase( "passphrase" ); + releaseDescriptor.setScmPassword( "password" ); + releaseDescriptor.setScmPrivateKey( "private-key" ); + releaseDescriptor.setScmTagBase( "tag-base" ); + releaseDescriptor.setScmReleaseLabel( "tag" ); + releaseDescriptor.setScmUsername( "username" ); + releaseDescriptor.setWorkingDirectory( workingDirectory ); + releaseDescriptor.setAdditionalArguments( "additional-arguments" ); + releaseDescriptor.setPomFileName( "pom-file-name" ); + releaseDescriptor.setPreparationGoals( "preparation-goals" ); + + return releaseDescriptor; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/AbstractMavenExecutorTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/AbstractMavenExecutorTest.java new file mode 100644 index 000000000..5b7f904c9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/AbstractMavenExecutorTest.java @@ -0,0 +1,110 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Matchers.isNull; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import junit.framework.TestCase; + +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.env.ReleaseEnvironment; + +public class AbstractMavenExecutorTest + extends TestCase +{ + + public void testGoalSeparation() + throws MavenExecutorException + { + AbstractMavenExecutor executor = spy( new AbstractMavenExecutorSpy() ); + + executor.executeGoals( null, (String) null, new DefaultReleaseEnvironment(), true, null, null, null ); + verify( executor ).executeGoals( isNull( File.class ), eq( new ArrayList() ), + isA( ReleaseEnvironment.class ), eq( true ), isNull( String.class ), + isNull( String.class ), isNull( ReleaseResult.class ) ); + reset( executor ); + + executor.executeGoals( null, " clean verify ", new DefaultReleaseEnvironment(), true, null, null, null ); + verify( executor ).executeGoals( isNull( File.class ), + eq( Arrays.asList( "clean", "verify" ) ), + isA( ReleaseEnvironment.class ), eq( true ), isNull( String.class ), + isNull( String.class ), isNull( ReleaseResult.class ) ); + reset( executor ); + + executor.executeGoals( null, ",clean,verify,", new DefaultReleaseEnvironment(), true, null, null, null ); + verify( executor ).executeGoals( isNull( File.class ), + eq( Arrays.asList( "clean", "verify" ) ), + isA( ReleaseEnvironment.class ), eq( true ), isNull( String.class ), + isNull( String.class ), isNull( ReleaseResult.class ) ); + reset( executor ); + + executor.executeGoals( null, "\nclean\nverify\n", new DefaultReleaseEnvironment(), true, null, null, null ); + verify( executor ).executeGoals( isNull( File.class ), + eq( Arrays.asList( "clean", "verify" ) ), + isA( ReleaseEnvironment.class ), eq( true ), isNull( String.class ), + isNull( String.class ), isNull( ReleaseResult.class ) ); + reset( executor ); + + executor.executeGoals( null, "\rclean\rverify\r", new DefaultReleaseEnvironment(), true, null, null, null ); + verify( executor ).executeGoals( isNull( File.class ), + eq( Arrays.asList( "clean", "verify" ) ), + isA( ReleaseEnvironment.class ), eq( true ), isNull( String.class ), + isNull( String.class ), isNull( ReleaseResult.class ) ); + reset( executor ); + + executor.executeGoals( null, "\r\nclean\r\nverify\r\n", new DefaultReleaseEnvironment(), true, null, null, null ); + verify( executor ).executeGoals( isNull( File.class ), + eq( Arrays.asList( "clean", "verify" ) ), + isA( ReleaseEnvironment.class ), eq( true ), isNull( String.class ), + isNull( String.class ), isNull( ReleaseResult.class ) ); + reset( executor ); + + executor.executeGoals( null, "\tclean\tverify\t", new DefaultReleaseEnvironment(), true, null, null, null ); + verify( executor ).executeGoals( isNull( File.class ), + eq( Arrays.asList( "clean", "verify" ) ), + isA( ReleaseEnvironment.class ), eq( true ), isNull( String.class ), + isNull( String.class ), isNull( ReleaseResult.class ) ); + reset( executor ); + } + + protected class AbstractMavenExecutorSpy + extends AbstractMavenExecutor + { + + @Override + protected void executeGoals( File workingDirectory, List goals, ReleaseEnvironment releaseEnvironment, + boolean interactive, String additionalArguments, String pomFileName, + ReleaseResult result ) + throws MavenExecutorException + { + } + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/CommandLineFactoryTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/CommandLineFactoryTest.java new file mode 100644 index 000000000..4bdedb05c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/CommandLineFactoryTest.java @@ -0,0 +1,56 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.PlexusTestCase; +import org.codehaus.plexus.util.cli.Commandline; + +import java.util.Locale; + +/** + * Test the command line factory. + * + * @author Brett Porter + */ +public class CommandLineFactoryTest + extends PlexusTestCase +{ + private CommandLineFactory factory; + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + + factory = (CommandLineFactory) lookup( CommandLineFactory.class ); + } + + public void testCreation() + throws Exception + { + Commandline cl = factory.createCommandLine( "exec" ); + + String executable = cl.getExecutable(); + assertTrue( "Check executable " + executable, executable.contains("exec") ); + assertNotNull( "Check environment", cl.getEnvironmentVariables() ); + assertFalse( "Check environment", cl.getEnvironmentVariables().length == 0 ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/ForkedMavenExecutorTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/ForkedMavenExecutorTest.java new file mode 100644 index 000000000..8b655932a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/ForkedMavenExecutorTest.java @@ -0,0 +1,365 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.mockito.Matchers.endsWith; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Matchers.isNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Writer; + +import org.apache.maven.settings.Proxy; +import org.apache.maven.settings.Server; +import org.apache.maven.settings.Settings; +import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.util.cli.Arg; +import org.codehaus.plexus.util.cli.CommandLineException; +import org.codehaus.plexus.util.cli.Commandline; +import org.mockito.ArgumentCaptor; +import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher; + +/** + * Test the forked Maven executor. + * + * @author Brett Porter + */ +public class ForkedMavenExecutorTest + extends PlexusTestCase +{ + private ForkedMavenExecutor executor; + + private SecDispatcher secDispatcher; + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + + executor = (ForkedMavenExecutor) lookup( MavenExecutor.class, "forked-path" ); + + secDispatcher = (SecDispatcher) lookup( SecDispatcher.class, "mng-4384" ); + } + + public void testExecution() + throws Exception + { + // prepare + File workingDirectory = getTestFile( "target/working-directory" ); + Process mockProcess = mock( Process.class ); + when( mockProcess.getInputStream() ).thenReturn( mock( InputStream.class ) ); + when( mockProcess.getErrorStream() ).thenReturn( mock( InputStream.class ) ); + when( mockProcess.getOutputStream() ).thenReturn( mock( OutputStream.class ) ); + when( mockProcess.waitFor() ).thenReturn( 0 ); + + Commandline commandLineMock = mock( Commandline.class ); + when( commandLineMock.execute() ).thenReturn( mockProcess ); + + Arg valueArgument = mock( Arg.class ); + when( commandLineMock.createArg() ).thenReturn( valueArgument ); + + CommandLineFactory commandLineFactoryMock = mock( CommandLineFactory.class ); + when( commandLineFactoryMock.createCommandLine( isA( String.class ) /*"mvn"*/ ) ).thenReturn( commandLineMock ); + + executor.setCommandLineFactory( commandLineFactoryMock ); + + // execute + executor.executeGoals( workingDirectory, "clean integration-test", new DefaultReleaseEnvironment(), false, null, + null, new ReleaseResult() ); + + // verify + verify( mockProcess ).getInputStream(); + verify( mockProcess ).getErrorStream(); + verify( mockProcess ).getOutputStream(); + verify( mockProcess ).waitFor(); + verify( commandLineMock ).setWorkingDirectory( workingDirectory.getAbsolutePath() ); + verify( commandLineMock ).addEnvironment( "MAVEN_TERMINATE_CMD", "on" ); + verify( commandLineMock ).addEnvironment( eq( "M2_HOME" ), isNull( String.class ) ); + verify( commandLineMock ).execute(); + verify( commandLineMock, times( 3 ) ).createArg(); + verify( valueArgument ).setValue( "clean" ); + verify( valueArgument ).setValue( "integration-test" ); + verify( valueArgument ).setValue( "--batch-mode" ); + verify( commandLineFactoryMock ).createCommandLine( endsWith( "mvn" ) ); + + verifyNoMoreInteractions( mockProcess, commandLineFactoryMock, commandLineMock, valueArgument ); + } + + public void testExecutionWithCustomPomFile() + throws Exception + { + File workingDirectory = getTestFile( "target/working-directory" ); + Process mockProcess = mock( Process.class ); + when( mockProcess.getInputStream() ).thenReturn( mock( InputStream.class ) ); + when( mockProcess.getErrorStream() ).thenReturn( mock( InputStream.class ) ); + when( mockProcess.getOutputStream() ).thenReturn( mock( OutputStream.class ) ); + when( mockProcess.waitFor() ).thenReturn( 0 ); + + Commandline commandLineMock = mock( Commandline.class ); + when( commandLineMock.execute() ).thenReturn( mockProcess ); + + Arg argMock = mock( Arg.class ); + when( commandLineMock.createArg() ).thenReturn( argMock ); + + CommandLineFactory commandLineFactoryMock = mock( CommandLineFactory.class ); + when( commandLineFactoryMock.createCommandLine( isA( String.class ) /* "mvn" */ ) ).thenReturn( commandLineMock ); + + executor.setCommandLineFactory( commandLineFactoryMock ); + + // execute + executor.executeGoals( workingDirectory, "clean integration-test", new DefaultReleaseEnvironment(), false, null, "my-pom.xml", + new ReleaseResult() ); + // verify + verify( mockProcess ).getInputStream(); + verify( mockProcess ).getErrorStream(); + verify( mockProcess ).getOutputStream(); + verify( mockProcess ).waitFor(); + verify( commandLineMock ).setWorkingDirectory( workingDirectory.getAbsolutePath() ); + verify( commandLineMock ).addEnvironment( "MAVEN_TERMINATE_CMD", "on" ); + verify( commandLineMock ).addEnvironment( eq( "M2_HOME" ), isNull( String.class ) ); + verify( commandLineMock ).execute(); + verify( commandLineMock, times( 5 ) ).createArg(); + verify( argMock ).setValue( "clean" ); + verify( argMock ).setValue( "integration-test" ); + verify( argMock ).setValue( "-f" ); + verify( argMock ).setValue( "my-pom.xml" ); + verify( argMock ).setValue( "--batch-mode" ); + verify( commandLineFactoryMock ).createCommandLine( endsWith( "mvn" ) ); + + verifyNoMoreInteractions( mockProcess, commandLineMock, argMock, commandLineFactoryMock ); + } + + public void testExecutionWithArguments() + throws Exception + { + File workingDirectory = getTestFile( "target/working-directory" ); + Process mockProcess = mock( Process.class ); + when( mockProcess.getInputStream() ).thenReturn( mock( InputStream.class ) ); + when( mockProcess.getErrorStream() ).thenReturn( mock( InputStream.class ) ); + when( mockProcess.getOutputStream() ).thenReturn( mock( OutputStream.class ) ); + when( mockProcess.waitFor() ).thenReturn( 0 ); + + Commandline commandLineMock = mock( Commandline.class ); + when( commandLineMock.execute() ).thenReturn( mockProcess ); + + Arg argMock = mock( Arg.class ); + when( commandLineMock.createArg() ).thenReturn( argMock ); + + CommandLineFactory commandLineFactoryMock = mock( CommandLineFactory.class ); + when( commandLineFactoryMock.createCommandLine( endsWith( "mvn" ) ) ).thenReturn( commandLineMock ); + + executor.setCommandLineFactory( commandLineFactoryMock ); + + // execute + String arguments = "-DperformRelease=true -Dmaven.test.skip=true"; + executor.executeGoals( workingDirectory, "clean integration-test", new DefaultReleaseEnvironment(), false, arguments, null, new ReleaseResult() ); + + // verify + verify( mockProcess ).getInputStream(); + verify( mockProcess ).getErrorStream(); + verify( mockProcess ).getOutputStream(); + verify( mockProcess ).waitFor(); + verify( commandLineMock ).setWorkingDirectory( workingDirectory.getAbsolutePath() ); + verify( commandLineMock ).addEnvironment( "MAVEN_TERMINATE_CMD", "on" ); + verify( commandLineMock ).addEnvironment( eq( "M2_HOME" ), isNull( String.class ) ); + verify( commandLineMock ).execute(); + verify( commandLineMock, times( 4 ) ).createArg(); + verify( argMock ).setValue( "clean" ); + verify( argMock ).setValue( "integration-test" ); + verify( argMock ).setValue( "--batch-mode" ); + verify( argMock ).setLine( "-DperformRelease=true -Dmaven.test.skip=true" ); + verify( commandLineFactoryMock ).createCommandLine( endsWith( "mvn" ) ); + + verifyNoMoreInteractions( mockProcess, commandLineMock, argMock, commandLineFactoryMock ); + } + + public void testExecutionWithNonZeroExitCode() + throws Exception + { + // prepare + File workingDirectory = getTestFile( "target/working-directory" ); + Process mockProcess = mock( Process.class ); + when( mockProcess.getInputStream() ).thenReturn( mock( InputStream.class ) ); + when( mockProcess.getErrorStream() ).thenReturn( mock( InputStream.class ) ); + when( mockProcess.getOutputStream() ).thenReturn( mock( OutputStream.class ) ); + when( mockProcess.waitFor() ).thenReturn( 1 ); + when( mockProcess.exitValue() ).thenReturn( 1 ); // why was this here in the original test? + + Commandline commandLineMock = mock( Commandline.class ); + when( commandLineMock.execute() ).thenReturn( mockProcess ); + + Arg argMock = mock( Arg.class ); + when( commandLineMock.createArg() ).thenReturn( argMock ); + + CommandLineFactory commandLineFactoryMock = mock( CommandLineFactory.class ); + when( commandLineFactoryMock.createCommandLine( endsWith( "mvn" ) ) ).thenReturn( commandLineMock ); + + executor.setCommandLineFactory( commandLineFactoryMock ); + + // execute + try + { + executor.executeGoals( workingDirectory, "clean integration-test", new DefaultReleaseEnvironment(), false, null, null, new ReleaseResult() ); + + fail( "Should have thrown an exception" ); + } + catch ( MavenExecutorException e ) + { + assertEquals( "Check exit code", 1, e.getExitCode() ); + } + + // verify + verify( mockProcess ).getInputStream(); + verify( mockProcess ).getErrorStream(); + verify( mockProcess ).getOutputStream(); + verify( mockProcess ).waitFor(); +// verify( mockProcess ).exitValue(); + verify( commandLineMock ).setWorkingDirectory( workingDirectory.getAbsolutePath() ); + verify( commandLineMock ).addEnvironment( "MAVEN_TERMINATE_CMD", "on" ); + verify( commandLineMock ).addEnvironment( eq( "M2_HOME" ), isNull( String.class ) ); + verify( commandLineMock ).execute(); + verify( commandLineMock, times( 3 ) ).createArg(); + verify( argMock ).setValue( "clean" ); + verify( argMock ).setValue( "integration-test" ); + verify( argMock ).setValue( "--batch-mode" ); + verify( commandLineFactoryMock ).createCommandLine( endsWith( "mvn" ) ); + + verifyNoMoreInteractions( mockProcess, commandLineMock, argMock, commandLineFactoryMock ); + } + + public void testExecutionWithCommandLineException() + throws Exception + { + // prepare + File workingDirectory = getTestFile( "target/working-directory" ); + + Commandline commandLineMock = mock( Commandline.class ); + when( commandLineMock.execute() ).thenThrow( new CommandLineException( "..." ) ); + + Arg argMock = mock( Arg.class ); + when ( commandLineMock.createArg() ).thenReturn( argMock ); + + CommandLineFactory commandLineFactoryMock = mock( CommandLineFactory.class ); + when( commandLineFactoryMock.createCommandLine( endsWith( "mvn" ) ) ).thenReturn( commandLineMock ); + + executor.setCommandLineFactory( commandLineFactoryMock ); + + // execute + try + { + executor.executeGoals( workingDirectory, "clean integration-test", new DefaultReleaseEnvironment(), false, null, null, new ReleaseResult() ); + + fail( "Should have thrown an exception" ); + } + catch ( MavenExecutorException e ) + { + assertEquals( "Check cause", CommandLineException.class, e.getCause().getClass() ); + } + + // verify + verify( commandLineMock ).setWorkingDirectory( workingDirectory.getAbsolutePath() ); + verify( commandLineMock ).addEnvironment( "MAVEN_TERMINATE_CMD", "on" ); + verify( commandLineMock ).addEnvironment( eq( "M2_HOME" ), isNull( String.class ) ); + verify( commandLineMock ).execute(); + verify( commandLineMock, times( 3 ) ).createArg(); + verify( argMock ).setValue( "clean" ); + verify( argMock ).setValue( "integration-test" ); + verify( argMock ).setValue( "--batch-mode" ); + verify( commandLineFactoryMock ).createCommandLine( endsWith( "mvn" ) ); + + verifyNoMoreInteractions( commandLineMock, argMock, commandLineFactoryMock ); + } + + public void testEncryptSettings() + throws Exception + { + // prepare + File workingDirectory = getTestFile( "target/working-directory" ); + Process mockProcess = mock( Process.class ); + when( mockProcess.getInputStream() ).thenReturn( mock( InputStream.class ) ); + when( mockProcess.getErrorStream() ).thenReturn( mock( InputStream.class ) ); + when( mockProcess.getOutputStream() ).thenReturn( mock( OutputStream.class ) ); + when( mockProcess.waitFor() ).thenReturn( 0 ); + + Commandline commandLineMock = mock( Commandline.class ); + when( commandLineMock.execute() ).thenReturn( mockProcess ); + + Arg valueArgument = mock( Arg.class ); + when( commandLineMock.createArg() ).thenReturn( valueArgument ); + + CommandLineFactory commandLineFactoryMock = mock( CommandLineFactory.class ); + when( commandLineFactoryMock.createCommandLine( isA( String.class ) /* "mvn" */) ).thenReturn( commandLineMock ); + + executor.setCommandLineFactory( commandLineFactoryMock ); + + Settings settings = new Settings(); + Server server = new Server(); + server.setPassphrase( "server_passphrase" ); + server.setPassword( "server_password" ); + settings.addServer( server ); + Proxy proxy = new Proxy(); + proxy.setPassword( "proxy_password" ); + settings.addProxy( proxy ); + + DefaultReleaseEnvironment releaseEnvironment = new DefaultReleaseEnvironment(); + releaseEnvironment.setSettings( settings ); + + AbstractMavenExecutor executorSpy = spy( executor ); + SettingsXpp3Writer settingsWriter = mock( SettingsXpp3Writer.class ); + + ArgumentCaptor encryptedSettings = ArgumentCaptor.forClass( Settings.class ); + + when( executorSpy.getSettingsWriter() ).thenReturn( settingsWriter ); + + executorSpy.executeGoals( workingDirectory, "validate", releaseEnvironment, false, null, null, new ReleaseResult() ); + + verify( settingsWriter ).write( isA( Writer.class ), encryptedSettings.capture() ); + + assertNotSame( settings, encryptedSettings.getValue() ); + + Server encryptedServer = encryptedSettings.getValue().getServers().get( 0 ); + assertEquals( "server_passphrase", secDispatcher.decrypt( encryptedServer.getPassphrase() ) ); + assertEquals( "server_password", secDispatcher.decrypt( encryptedServer.getPassword() ) ); + + Proxy encryptedProxy = encryptedSettings.getValue().getProxies().get( 0 ); + assertEquals( "proxy_password", secDispatcher.decrypt( encryptedProxy.getPassword() ) ); + + File settingsSecurity = new File( System.getProperty( "user.home" ), ".m2/settings-security.xml" ); + if ( settingsSecurity.exists() ) + { + assertFalse( "server_passphrase".equals( encryptedServer.getPassphrase() ) ); + assertFalse( "server_password".equals( encryptedServer.getPassword() ) ); + assertFalse( "proxy_password".equals( encryptedProxy.getPassword() ) ); + } + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/InvokerMavenExecutorTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/InvokerMavenExecutorTest.java new file mode 100644 index 000000000..57327e205 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/InvokerMavenExecutorTest.java @@ -0,0 +1,198 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.io.Writer; + +import org.apache.maven.settings.Proxy; +import org.apache.maven.settings.Server; +import org.apache.maven.settings.Settings; +import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer; +import org.apache.maven.shared.invoker.DefaultInvocationRequest; +import org.apache.maven.shared.invoker.InvocationRequest; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.logging.Logger; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher; + +public class InvokerMavenExecutorTest + extends PlexusTestCase +{ + + private InvokerMavenExecutor executor; + + private SecDispatcher secDispatcher; + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + + executor = (InvokerMavenExecutor) lookup( MavenExecutor.class, "invoker" ); + + secDispatcher = (SecDispatcher) lookup( SecDispatcher.class, "mng-4384" ); + } + + @Test + public void testThreads() + throws Exception + { + Logger logger = mock( Logger.class ); + executor.enableLogging( logger ); + + InvocationRequest req = new DefaultInvocationRequest(); + executor.setupRequest( req, null, "-T 3" ); + assertEquals( "3", req.getThreads() ); + + req = new DefaultInvocationRequest(); + executor.setupRequest( req, null, "-T4" ); + assertEquals( "4", req.getThreads() ); + + req = new DefaultInvocationRequest(); + executor.setupRequest( req, null, "\"-T5\"" ); + assertEquals( "5", req.getThreads() ); + } + + @Test + public void testBatch() + throws Exception + { + Logger logger = mock( Logger.class ); + executor.enableLogging( logger ); + + InvocationRequest req = new DefaultInvocationRequest(); + // bug: assertEquals( true, req.isInteractive() ); + + req = new DefaultInvocationRequest(); + req.setInteractive( true ); + executor.setupRequest( req, null, "-B" ); + assertEquals( false, req.isInteractive() ); + + req = new DefaultInvocationRequest(); + req.setInteractive( true ); + executor.setupRequest( req, null, "\"-B\"" ); + assertEquals( false, req.isInteractive() ); + } + + @Test + public void testUserToolchains() + throws Exception + { + Logger logger = mock( Logger.class ); + executor.enableLogging( logger ); + + InvocationRequest req = new DefaultInvocationRequest(); + executor.setupRequest( req, null, "-t mytoolchains.xml" ); + assertEquals( new File( "mytoolchains.xml" ), req.getToolchainsFile() ); + + req = new DefaultInvocationRequest(); + executor.setupRequest( req, null, "-tmytoolchains.xml" ); + assertEquals( new File( "mytoolchains.xml" ), req.getToolchainsFile() ); + + req = new DefaultInvocationRequest(); + executor.setupRequest( req, null, "\"-tmytoolchains.xml\"" ); + assertEquals( new File( "mytoolchains.xml" ), req.getToolchainsFile() ); + } + + @Test + public void testGlobalSettings() + throws Exception + { + Logger logger = mock( Logger.class ); + executor.enableLogging( logger ); + + InvocationRequest req = new DefaultInvocationRequest(); + executor.setupRequest( req, null, "-gs custom-settings.xml" ); + assertEquals( "custom-settings.xml", req.getGlobalSettingsFile().getPath() ); + + req = new DefaultInvocationRequest(); + executor.setupRequest( req, null, "--global-settings other-settings.xml" ); + assertEquals( "other-settings.xml", req.getGlobalSettingsFile().getPath() ); + } + + public void testEncryptSettings() + throws Exception + { + // prepare + File workingDirectory = getTestFile( "target/working-directory" ); + workingDirectory.mkdirs(); + + + Settings settings = new Settings(); + Server server = new Server(); + server.setPassphrase( "server_passphrase" ); + server.setPassword( "server_password" ); + settings.addServer( server ); + Proxy proxy = new Proxy(); + proxy.setPassword( "proxy_password" ); + settings.addProxy( proxy ); + + DefaultReleaseEnvironment releaseEnvironment = new DefaultReleaseEnvironment(); + releaseEnvironment.setSettings( settings ); + releaseEnvironment.setMavenHome( new File( System.getProperty( "injectedMavenHome" ) ) ); + + InvokerMavenExecutor executorSpy = spy( executor ); + SettingsXpp3Writer settingsWriter = mock( SettingsXpp3Writer.class ); + + ArgumentCaptor encryptedSettings = ArgumentCaptor.forClass( Settings.class ); + + when( executorSpy.getSettingsWriter() ).thenReturn( settingsWriter ); + when( executorSpy.getOutputHandler() ).thenReturn( null ); + when( executorSpy.getInvokerLogger() ).thenReturn( null ); + + try + { + executorSpy.executeGoals( workingDirectory, "validate", releaseEnvironment, false, null, null, new ReleaseResult() ); + } + catch ( MavenExecutorException e ) + { + } + + verify( settingsWriter ).write( isA( Writer.class ), encryptedSettings.capture() ); + + assertNotSame( settings, encryptedSettings.getValue() ); + + Server encryptedServer = encryptedSettings.getValue().getServers().get( 0 ); + assertEquals( "server_passphrase", secDispatcher.decrypt( encryptedServer.getPassphrase() ) ); + assertEquals( "server_password", secDispatcher.decrypt( encryptedServer.getPassword() ) ); + + Proxy encryptedProxy = encryptedSettings.getValue().getProxies().get( 0 ); + assertEquals( "proxy_password", secDispatcher.decrypt( encryptedProxy.getPassword() ) ); + + File settingsSecurity = new File( System.getProperty( "user.home" ), ".m2/settings-security.xml" ); + if ( settingsSecurity.exists() ) + { + assertFalse( "server_passphrase".equals( encryptedServer.getPassphrase() ) ); + assertFalse( "server_password".equals( encryptedServer.getPassword() ) ); + assertFalse( "proxy_password".equals( encryptedProxy.getPassword() ) ); + } + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/TeeConsumerTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/TeeConsumerTest.java new file mode 100644 index 000000000..d7d2e04ef --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/TeeConsumerTest.java @@ -0,0 +1,61 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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 java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +/** + * Test the consumer that tees output both to a stream and into an internal buffer for later. + * + * @author Brett Porter + */ +public class TeeConsumerTest + extends TestCase +{ + private TeeConsumer consumer; + + private ByteArrayOutputStream out; + + private static final String LS = System.getProperty( "line.separator" ); + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + + out = new ByteArrayOutputStream(); + consumer = new TeeConsumer( new PrintStream( out ), "xxx " ); + } + + public void testConsumeLine() + { + consumer.consumeLine( "line" ); + + assertEquals( "Check output", "xxx line" + LS, out.toString() ); + + assertEquals( "Check content", "line" + LS, consumer.getContent() ); + + assertEquals( "Check toString", "line" + LS, consumer.toString() ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/TeeOutputStreamTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/TeeOutputStreamTest.java new file mode 100644 index 000000000..5b6cbf7ac --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/exec/TeeOutputStreamTest.java @@ -0,0 +1,63 @@ +package org.apache.maven.shared.release.exec; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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 java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +/** + * Test the output stream that tees output both to a stream and into an internal buffer for later. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class TeeOutputStreamTest + extends TestCase +{ + private TeeOutputStream stream; + + private ByteArrayOutputStream out; + + private static final String LS = System.getProperty( "line.separator" ); + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + + out = new ByteArrayOutputStream(); + stream = new TeeOutputStream( new PrintStream( out ), "xxx " ); + } + + public void testConsumeLine() + throws Exception + { + stream.write( ( "the first line" + LS + "line2" + LS + "3" + LS ).getBytes() ); + + assertEquals( "Check output", "xxx the first line" + LS + "xxx line2" + LS + "xxx 3" + LS, out.toString() ); + + assertEquals( "Check content", "the first line" + LS + "line2" + LS + "3" + LS, stream.getContent() ); + + assertEquals( "Check toString", "the first line" + LS + "line2" + LS + "3" + LS, stream.toString() ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractBackupPomsPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractBackupPomsPhaseTest.java new file mode 100644 index 000000000..ce8e00efa --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractBackupPomsPhaseTest.java @@ -0,0 +1,93 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.project.MavenProject; +import org.apache.maven.shared.release.PlexusJUnit4TestCase; +import org.codehaus.plexus.util.ReaderFactory; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +/** + * @author Edwin Punzalan + */ +public abstract class AbstractBackupPomsPhaseTest + extends PlexusJUnit4TestCase +{ + private final String pomFilename = "pom.xml"; + + protected final String releaseBackupSuffix = ".releaseBackup"; + + protected ReleasePhase phase; + + @Override + public void setUp() + throws Exception + { + super.setUp(); + + phase = getReleasePhase(); + } + + abstract ReleasePhase getReleasePhase() + throws Exception; + + protected List getReactorProjects( String projectPath ) + throws Exception + { + List reactorProjects = new ArrayList<>(); + + File pomFile = new File( projectPath, pomFilename ); + + MavenProject mainProject = createMavenProject( pomFile ); + + reactorProjects.add( mainProject ); + + for ( String module : mainProject.getModel().getModules() ) + { + File modulePom = new File( projectPath + "/" + module, pomFilename ); + + MavenProject subproject = createMavenProject( modulePom ); + + reactorProjects.add( subproject ); + } + + return reactorProjects; + } + + private MavenProject createMavenProject( File pomFile ) + throws Exception + { + MavenXpp3Reader reader = new MavenXpp3Reader(); + + Model model = reader.read( ReaderFactory.newXmlReader( pomFile ) ); + + MavenProject project = new MavenProject( model ); + + project.setFile( pomFile ); + + return project; + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractEditModeRewritingReleasePhaseTestCase.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractEditModeRewritingReleasePhaseTestCase.java new file mode 100644 index 000000000..4e1372879 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractEditModeRewritingReleasePhaseTestCase.java @@ -0,0 +1,206 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.command.edit.EditScmResult; +import org.apache.maven.scm.manager.ScmManagerStub; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.provider.ScmProviderStub; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.scm.DefaultScmRepositoryConfigurator; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator; +import org.junit.Test; + +/** + * Base class with tests for rewriting POMs with edit mode. + * + * @author Brett Porter + */ +public abstract class AbstractEditModeRewritingReleasePhaseTestCase + extends AbstractRewritingReleasePhaseTestCase +{ + public AbstractEditModeRewritingReleasePhaseTestCase( String modelETL ) + { + super( modelETL ); + } + + @Test + public void testRewriteBasicPomWithEditMode() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom" ); + builder.setScmUseEditMode( true ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomWithEditModeFailure() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom" ); + builder.setScmUseEditMode( true ); + mapNextVersion( builder, "groupId:artifactId" ); + + ScmManagerStub scmManager = new ScmManagerStub(); + DefaultScmRepositoryConfigurator configurator = + (DefaultScmRepositoryConfigurator) lookup( ScmRepositoryConfigurator.class, "default" ); + configurator.setScmManager( scmManager ); + + ScmProviderStub providerStub = (ScmProviderStub) scmManager.getProviderByUrl( ReleaseUtils.buildReleaseDescriptor( builder ).getScmSourceUrl() ); + providerStub.setEditScmResult( new EditScmResult( "", "", "", false ) ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseScmCommandException e ) + { + assertNull( "Check no other cause", e.getCause() ); + } + } + + @Test + public void testRewriteBasicPomWithEditModeException() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom" ); + builder.setScmUseEditMode( true ); + mapNextVersion( builder, "groupId:artifactId" ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.edit( isA( ScmRepository.class ), + isA( ScmFileSet.class ) ) ).thenThrow( new ScmException( "..." ) ); + + ScmManagerStub scmManager = new ScmManagerStub(); + DefaultScmRepositoryConfigurator configurator = + (DefaultScmRepositoryConfigurator) lookup( ScmRepositoryConfigurator.class, "default" ); + configurator.setScmManager( scmManager ); + scmManager.setScmProvider( scmProviderMock ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "Check cause", ScmException.class, e.getCause().getClass() ); + } + // verify + verify( scmProviderMock ).edit( isA( ScmRepository.class ), isA( ScmFileSet.class ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testRewritePomPluginDependencies() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-snapshot-plugin-deps" ); + ReleaseDescriptorBuilder builder = createDefaultConfiguration( reactorProjects, "internal-snapshot-plugin-deps" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomUnmappedPluginDependencies() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-snapshot-plugin-deps" ); + ReleaseDescriptorBuilder builder = createUnmappedConfiguration( reactorProjects, "internal-snapshot-plugin-deps" ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testRewritePomProfile() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-snapshot-profile" ); + ReleaseDescriptorBuilder builder = createDefaultConfiguration( reactorProjects, "internal-snapshot-profile" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomUnmappedProfile() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-snapshot-profile" ); + ReleaseDescriptorBuilder builder = createUnmappedConfiguration( reactorProjects, "internal-snapshot-profile" ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractReleaseTestCase.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractReleaseTestCase.java new file mode 100644 index 000000000..989fad22a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractReleaseTestCase.java @@ -0,0 +1,422 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertFalse; + +import java.io.File; +import java.io.IOException; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.LinkOption; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.StandardCopyOption; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import org.apache.commons.lang.SystemUtils; +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.artifact.factory.ArtifactFactory; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.DefaultArtifactRepository; +import org.apache.maven.artifact.repository.MavenArtifactRepository; +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; +import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; +import org.apache.maven.lifecycle.LifecycleExecutionException; +import org.apache.maven.model.Profile; +import org.apache.maven.model.Repository; +import org.apache.maven.project.DefaultProjectBuildingRequest; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.ProjectBuilder; +import org.apache.maven.project.ProjectBuildingRequest; +import org.apache.maven.project.ProjectBuildingRequest.RepositoryMerging; +import org.apache.maven.project.artifact.InvalidDependencyVersionException; +import org.apache.maven.project.ProjectBuildingResult; +import org.apache.maven.project.ProjectSorter; +import org.apache.maven.repository.internal.MavenRepositorySystemSession; +import org.apache.maven.shared.release.PlexusJUnit4TestCase; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager; +import org.sonatype.aether.repository.WorkspaceReader; +import org.sonatype.aether.repository.WorkspaceRepository; +import org.xmlunit.builder.DiffBuilder; +import org.xmlunit.diff.Comparison; +import org.xmlunit.diff.ComparisonResult; +import org.xmlunit.diff.ComparisonType; +import org.xmlunit.diff.DefaultNodeMatcher; +import org.xmlunit.diff.Diff; +import org.xmlunit.diff.DifferenceEvaluator; +import org.xmlunit.diff.ElementSelectors; + +/** + * Base class for some release tests. + * + * @author Brett Porter + */ +public abstract class AbstractReleaseTestCase + extends PlexusJUnit4TestCase +{ + protected ProjectBuilder projectBuilder; + + protected ArtifactRepository localRepository; + + private ArtifactFactory artifactFactory; + + protected ReleasePhase phase; + + @Override + public void setUp() + throws Exception + { + super.setUp(); + + projectBuilder = lookup( ProjectBuilder.class ); + artifactFactory = lookup( ArtifactFactory.class ); + + ArtifactRepositoryLayout layout = lookup( ArtifactRepositoryLayout.class, "default" ); + String localRepoPath = getTestFile( "target/local-repository" ).getAbsolutePath().replace( '\\', '/' ); + localRepository = new MavenArtifactRepository( "local", "file://" + localRepoPath, layout, null, null ); + } + + protected Path getWorkingDirectory( String workingDir ) + { + return Paths.get( getBasedir(), "target/test-classes" ).resolve( Paths.get( "projects", workingDir ) ) ; + } + + protected List createReactorProjects( String path, String subpath ) + throws Exception + { + return createReactorProjects( path, path, subpath ); + } + + protected ReleaseDescriptorBuilder createReleaseDescriptorBuilder( List reactorProjects ) + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + for ( MavenProject project : reactorProjects ) + { + builder.putOriginalVersion( project.getGroupId() + ':' + project.getArtifactId(), project.getVersion() ); + } + return builder; + } + + /** + * + * @param sourcePath sourceDirectory to copy from + * @param targetPath targetDirectory to copy to + * @param executionRoot sub directory of targetPath in case the root pom.xml is not used (e.g. flat projects) + * @return all Maven projects + * @throws Exception if any occurs + */ + protected List createReactorProjects( String sourcePath, String targetPath, String executionRoot ) + throws Exception + { + final Path testCaseRootFrom = Paths.get( getBasedir(), "src/test/resources" ).resolve( Paths.get( "projects", sourcePath ) ) ; + + final Path testCaseRootTo = getWorkingDirectory( targetPath ); + + // Recopy the test resources since they are modified in some tests + Files.walkFileTree( testCaseRootFrom, new SimpleFileVisitor() { + + @Override + public FileVisitResult visitFile( Path file, BasicFileAttributes attrs ) + throws IOException + { + Path relPath = testCaseRootFrom.relativize( file ); + + if ( !relPath.toFile().getName().startsWith( "expected-" ) ) + { + Files.createDirectories( testCaseRootTo.resolve( relPath ).getParent() ); + + Files.copy( file, testCaseRootTo.resolve( relPath ), StandardCopyOption.REPLACE_EXISTING ); + } + + return FileVisitResult.CONTINUE; + } + }); + + Path projectFile; + if ( executionRoot == null ) + { + projectFile = testCaseRootTo.resolve( "pom.xml" ); + } + else + { + projectFile = testCaseRootTo.resolve( Paths.get( executionRoot, "pom.xml" ) ); + } + + List repos = + Collections.singletonList( new DefaultArtifactRepository( "central", + getRemoteRepositoryURL(), + new DefaultRepositoryLayout() ) ); + + Repository repository = new Repository(); + repository.setId( "central" ); + repository.setUrl( getRemoteRepositoryURL() ); + + Profile profile = new Profile(); + profile.setId( "profile" ); + profile.addRepository( repository ); + + ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest(); + buildingRequest.setLocalRepository( localRepository ); + buildingRequest.setRemoteRepositories( repos ); + buildingRequest.setPluginArtifactRepositories( repos ); + buildingRequest.setRepositoryMerging( RepositoryMerging.REQUEST_DOMINANT ); + MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession(); + repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepository.getBasedir() ) ); + buildingRequest.setRepositorySession( repositorySession ); + buildingRequest.addProfile( profile ); + buildingRequest.setActiveProfileIds( Arrays.asList( profile.getId() ) ); + buildingRequest.setResolveDependencies( true ); + + List buildingResults = + projectBuilder.build( Collections.singletonList( projectFile.toFile() ), true, buildingRequest ); + + List reactorProjects = new ArrayList<>(); + for ( ProjectBuildingResult buildingResult : buildingResults ) + { + reactorProjects.add( buildingResult.getProject() ) ; + } + + WorkspaceReader simpleReactorReader = new SimpleReactorWorkspaceReader( reactorProjects ); + repositorySession.setWorkspaceReader( simpleReactorReader ); + + ProjectSorter sorter = new ProjectSorter( reactorProjects ); + reactorProjects = sorter.getSortedProjects(); + + List resolvedProjects = new ArrayList<>( reactorProjects.size() ); + for ( MavenProject project : reactorProjects ) + { + MavenProject resolvedProject = projectBuilder.build( project.getFile(), buildingRequest ).getProject(); + + // from LifecycleDependencyResolver + if ( project.getDependencyArtifacts() == null ) + { + try + { + resolvedProject.setDependencyArtifacts( resolvedProject.createArtifacts( artifactFactory, null, null ) ); + } + catch ( InvalidDependencyVersionException e ) + { + throw new LifecycleExecutionException( e ); + } + } + + resolvedProjects.add( resolvedProject ); + } + return resolvedProjects; + } + + protected static Map getProjectsAsMap( List reactorProjects ) + { + Map map = new HashMap<>(); + for ( MavenProject project : reactorProjects ) + { + map.put( ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ), project ); + } + return map; + } + + protected boolean comparePomFiles( List reactorProjects ) + throws IOException + { + return comparePomFiles( reactorProjects, true ); + } + + protected boolean comparePomFiles( List reactorProjects, boolean normalizeLineEndings ) + throws IOException + { + comparePomFiles( reactorProjects, "", normalizeLineEndings ); + + // TODO: return void since this is redundant + return true; + } + + protected void comparePomFiles( List reactorProjects, String expectedFileSuffix ) + throws IOException + { + comparePomFiles( reactorProjects, expectedFileSuffix, true ); + } + + protected void comparePomFiles( List reactorProjects, String expectedFileSuffix, boolean normalizeLineEndings ) + throws IOException + { + for ( MavenProject project : reactorProjects ) + { + comparePomFiles( project, expectedFileSuffix, normalizeLineEndings ); + } + } + + protected void comparePomFiles( MavenProject project, String expectedFileSuffix ) + throws IOException + { + comparePomFiles( project, expectedFileSuffix, true ); + } + + protected void comparePomFiles( MavenProject project, String expectedFileSuffix, boolean normalizeLineEndings ) + throws IOException + { + File actualFile = project.getFile(); + File expectedFile = new File( actualFile.getParentFile(), "expected-pom" + expectedFileSuffix + ".xml" ); + + comparePomFiles( expectedFile, actualFile, normalizeLineEndings, false ); + } + + protected void comparePomFiles( File expectedFile, File actualFile ) + throws IOException + { + comparePomFiles( expectedFile, actualFile, true, false ); + } + + protected void comparePomFiles( File expectedFile, File actualFile, boolean normalizeLineEndings, boolean ignoreComments ) + throws IOException + { + StringBuffer sb = new StringBuffer( "Check the transformed POM " + actualFile ); + sb.append( SystemUtils.LINE_SEPARATOR ); + + final String remoteRepositoryURL = getRemoteRepositoryURL(); + + DiffBuilder diffBuilder = DiffBuilder.compare( expectedFile ).withTest( actualFile ); + if ( normalizeLineEndings ) + { + diffBuilder = diffBuilder.normalizeWhitespace(); + } + if ( ignoreComments ) + { + diffBuilder.ignoreComments(); + } + // Order of elements has changed between M2 and M3, so match by name + diffBuilder.withNodeMatcher( new DefaultNodeMatcher( ElementSelectors.byName ) ).checkForSimilar(); + + diffBuilder.withDifferenceEvaluator( new DifferenceEvaluator() + { + @Override + public ComparisonResult evaluate( Comparison comparison, ComparisonResult outcome ) + { + if ( "${remoterepo}".equals( comparison.getControlDetails().getValue() ) && + remoteRepositoryURL.equals( comparison.getTestDetails().getValue() ) ) + { + return ComparisonResult.EQUAL; + } + else if ( outcome == ComparisonResult.DIFFERENT + && comparison.getType() == ComparisonType.CHILD_NODELIST_SEQUENCE ) + { + // Order of elements has changed between M2 and M3 + return ComparisonResult.EQUAL; + } + else if ( outcome == ComparisonResult.DIFFERENT + && comparison.getType() == ComparisonType.TEXT_VALUE + && "${project.build.directory}/site".equals( comparison.getTestDetails().getValue() ) ) + { + // M2 was target/site, M3 is ${project.build.directory}/site + return ComparisonResult.EQUAL; + } + else + { + return outcome; + } + } + } ); + + Diff diff = diffBuilder.build(); + + sb.append( diff.toString() ); + + assertFalse( sb.toString(), diff.hasDifferences() ); + } + + private String getRemoteRepositoryURL() + throws IOException + { + File testFile = getTestFile( "src/test/remote-repository" ); + if (testFile.getAbsolutePath().equals( testFile.getCanonicalPath() ) ) + { + return "file://" + getTestFile( "src/test/remote-repository" ).getAbsolutePath().replace( '\\', '/' ); + } + return "file://" + getTestFile( "src/test/remote-repository" ).getCanonicalPath().replace( '\\', '/' ); + } + + public static String getPath( File file ) + throws IOException + { + return file.toPath().toRealPath( LinkOption.NOFOLLOW_LINKS ).toString(); + } + + /** + * WorkspaceReader to find versions and artifacts from reactor + */ + private static final class SimpleReactorWorkspaceReader + implements WorkspaceReader + { + private final List reactorProjects; + + private SimpleReactorWorkspaceReader( List reactorProjects ) + { + this.reactorProjects = reactorProjects; + } + + @Override + public WorkspaceRepository getRepository() + { + return null; + } + + @Override + public List findVersions( org.sonatype.aether.artifact.Artifact artifact ) + { + for ( MavenProject mavenProject : reactorProjects ) + { + if ( Objects.equals( artifact.toString(), mavenProject.getArtifact().toString() ) ) + { + return Collections.singletonList( mavenProject.getArtifact().getVersion() ); + } + } + return Collections.emptyList(); + } + + @Override + public File findArtifact( org.sonatype.aether.artifact.Artifact artifact ) + { + for ( MavenProject mavenProject : reactorProjects ) + { + String pom = mavenProject.getGroupId() + ':' + mavenProject.getArtifactId() + ":pom:" + + mavenProject.getVersion(); + if ( Objects.equals( artifact.toString(), pom ) ) + { + return mavenProject.getFile(); + } + else if ( Objects.equals( artifact.toString(), mavenProject.getArtifact().toString() ) ) + { + // just an existing, content doesn't matter + return mavenProject.getFile(); + } + } + return null; + } + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractRewritingReleasePhaseTestCase.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractRewritingReleasePhaseTestCase.java new file mode 100644 index 000000000..0cba62b6b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractRewritingReleasePhaseTestCase.java @@ -0,0 +1,770 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verifyNoMoreInteractions; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.scm.DefaultScmRepositoryConfigurator; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator; +import org.apache.maven.shared.release.stubs.ScmManagerStub; +import org.apache.maven.shared.release.transform.jdom.JDomModelETLFactory; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +/** + * Base class with tests for rewriting POMs. + * + * @author Brett Porter + */ +@RunWith(Parameterized.class) +public abstract class AbstractRewritingReleasePhaseTestCase + extends AbstractReleaseTestCase +{ + private String modelETL; + + @Parameters + public static Collection data() + { + return Arrays.asList( new Object[][] { { JDomModelETLFactory.ROLE_HINT } } ); + } + + public AbstractRewritingReleasePhaseTestCase( String modelETL ) + { + this.modelETL = modelETL; + } + + @Override + public void setUp() + throws Exception + { + super.setUp(); + phase = lookup( ReleasePhase.class, getRoleHint() ); + + if( phase instanceof AbstractRewritePomsPhase) + { + ((AbstractRewritePomsPhase) phase).setModelETL( modelETL ); + ((AbstractRewritePomsPhase) phase).setStartTime( 0 ); + } + } + + protected abstract String getRoleHint(); + + @Test + public void testRewriteBasicPom() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomEntities() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom-entities" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom-entities" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomNamespace() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom-namespace" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom-namespace" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomWithEncoding() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom-with-encoding" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom-with-encoding" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomWithParent() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-with-parent" ); + ReleaseDescriptorBuilder builder = createConfigurationForPomWithParentAlternateNextVersion( reactorProjects, "pom-with-parent" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomWithUnmappedParent() + throws Exception + { + + List reactorProjects = createReactorProjects( "pom-with-parent" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "pom-with-parent" ); + + // Process the child first + reactorProjects = new ArrayList<>( reactorProjects ); + Collections.reverse( reactorProjects ); + + mapAlternateNextVersion( builder, "groupId:subproject1" ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testRewritePomWithReleasedParent() + throws Exception + { + + List reactorProjects = createReactorProjects( "pom-with-released-parent" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "pom-with-released-parent" ); + + mapAlternateNextVersion( builder, "groupId:subproject1" ); + builder.addReleaseVersion( "groupId:artifactId", "1" ); + builder.addDevelopmentVersion( "groupId:artifactId", "1" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + protected abstract void mapAlternateNextVersion( ReleaseDescriptorBuilder config, String projectId ); + + @Test + public void testRewritePomWithInheritedVersion() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-with-inherited-version" ); + ReleaseDescriptorBuilder builder = createConfigurationForWithParentNextVersion( reactorProjects, "pom-with-inherited-version" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomWithChangedInheritedVersion() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-with-inherited-version" ); + ReleaseDescriptorBuilder builder = createConfigurationForPomWithParentAlternateNextVersion( reactorProjects, "pom-with-inherited-version" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + MavenProject project = getProjectsAsMap( reactorProjects ).get( "groupId:subproject1" ); + comparePomFiles( project, "-version-changed" ); + } + + protected abstract ReleaseDescriptorBuilder createConfigurationForPomWithParentAlternateNextVersion( List reactorProjects, String workingDirectory ) + throws Exception; + + @Test + public void testRewritePomDependencies() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-snapshot-dependencies" ); + ReleaseDescriptorBuilder builder = createDefaultConfiguration( reactorProjects, "internal-snapshot-dependencies" ); + mapNextVersion( builder, "groupId:subsubproject" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomUnmappedDependencies() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-snapshot-dependencies" ); + ReleaseDescriptorBuilder builder = createUnmappedConfiguration( reactorProjects, "internal-snapshot-dependencies" ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testRewritePomDependenciesDifferentVersion() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-differing-snapshot-dependencies" ); + ReleaseDescriptorBuilder builder = createDifferingVersionConfiguration( reactorProjects, "internal-differing-snapshot-dependencies" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteManagedPomDependencies() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-managed-snapshot-dependency" ); + ReleaseDescriptorBuilder builder = createMappedConfiguration( reactorProjects, "internal-managed-snapshot-dependency" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteManagedPomUnmappedDependencies() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-managed-snapshot-dependency" ); + ReleaseDescriptorBuilder builder = createUnmappedConfiguration( reactorProjects, "internal-managed-snapshot-dependency" ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testRewritePomPlugins() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-snapshot-plugins" ); + ReleaseDescriptorBuilder builder = createDefaultConfiguration( reactorProjects, "internal-snapshot-plugins" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomUnmappedPlugins() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-snapshot-plugins" ); + ReleaseDescriptorBuilder builder = createUnmappedConfiguration( reactorProjects, "internal-snapshot-plugins" ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testRewritePomPluginsDifferentVersion() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-differing-snapshot-plugins" ); + ReleaseDescriptorBuilder builder = createDifferingVersionConfiguration( reactorProjects, "internal-differing-snapshot-plugins" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteManagedPomPlugins() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-managed-snapshot-plugin" ); + ReleaseDescriptorBuilder builder = createMappedConfiguration( reactorProjects, "internal-managed-snapshot-plugin" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteManagedPomUnmappedPlugins() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-managed-snapshot-plugin" ); + ReleaseDescriptorBuilder builder = createUnmappedConfiguration( reactorProjects, "internal-managed-snapshot-plugin" ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testRewritePomReportPlugins() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-snapshot-report-plugins" ); + ReleaseDescriptorBuilder builder = createDefaultConfiguration( reactorProjects, "internal-snapshot-report-plugins" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomUnmappedReportPlugins() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-snapshot-report-plugins" ); + ReleaseDescriptorBuilder builder = createUnmappedConfiguration( reactorProjects, "internal-snapshot-report-plugins" ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testRewritePomReportPluginsDifferentVersion() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-differing-snapshot-report-plugins" ); + ReleaseDescriptorBuilder builder = createDifferingVersionConfiguration( reactorProjects, "internal-differing-snapshot-report-plugins" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + @Ignore( "Extensions being part of reactor is not supported anymore" ) + public void testRewritePomExtension() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-snapshot-extension" ); + ReleaseDescriptorBuilder builder = createDefaultConfiguration( reactorProjects, "internal-snapshot-extension" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + @Ignore( "Extensions being part of reactor is not supported anymore" ) + public void testRewritePomUnmappedExtension() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-snapshot-extension" ); + ReleaseDescriptorBuilder builder = createUnmappedConfiguration( reactorProjects, "internal-snapshot-extension" ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + @Ignore( "Extensions being part of reactor is not supported anymore" ) + public void testRewritePomExtensionDifferentVersion() + throws Exception + { + List reactorProjects = createReactorProjects( "internal-differing-snapshot-extension" ); + ReleaseDescriptorBuilder builder = createDifferingVersionConfiguration( reactorProjects, "internal-differing-snapshot-extension" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + @Ignore( "Extensions being part of reactor is not supported anymore" ) + public void testRewritePomExtensionUndefinedVersion() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-without-extension-version" ); + ReleaseDescriptorBuilder builder = createDefaultConfiguration( reactorProjects, "pom-without-extension-version" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteAddSchema() + throws Exception + { + boolean copyFiles = true; + + // Run a second time to check they are not duplicated + for ( int i = 0; i < 2; i++ ) + { + String path = "basic-pom"; + List reactorProjects = prepareReactorProjects( path ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom" ); + mapNextVersion( builder, "groupId:artifactId" ); + builder.setAddSchema( true ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + comparePomFiles( reactorProjects, "-with-schema" ); + + copyFiles = false; + + verifyReactorProjects( path, copyFiles ); + } + } + + @Test + public void testSimulateRewriteEditModeSkipped() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom" ); + builder.setScmUseEditMode( true ); + mapNextVersion( builder, "groupId:artifactId" ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + + ScmManagerStub scmManager = new ScmManagerStub(); + DefaultScmRepositoryConfigurator configurator = + (DefaultScmRepositoryConfigurator) lookup( ScmRepositoryConfigurator.class ); + configurator.setScmManager( scmManager ); + scmManager.setScmProvider( scmProviderMock ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testRewriteUnmappedPom() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom" ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testRewriteBasicPomWithScmRepoException() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom" ); + builder.setScmUseEditMode( true ); + builder.setScmSourceUrl( "scm:svn:fail" ); + mapNextVersion( builder, "groupId:artifactId" ); + + ScmManager scmManager = lookup( ScmManager.class ); + if ( scmManager instanceof ScmManagerStub ) + { + ((ScmManagerStub) scmManager ).setException( new ScmRepositoryException( "..." ) ); + } + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseScmRepositoryException e ) + { + assertNull( "Check no additional cause", e.getCause() ); + } + } + + @Test + public void testRewriteBasicPomWithNoSuchProviderException() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom" ); + builder.setScmUseEditMode( true ); + builder.setScmSourceUrl( "scm:fail:path" ); + mapNextVersion( builder, "groupId:artifactId" ); + + ScmManager scmManager = (ScmManager) lookup( ScmManager.class ); + if ( scmManager instanceof ScmManagerStub ) + { + ((ScmManagerStub) scmManager ).setException( new NoSuchScmProviderException( "..." ) );; + } + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseExecutionException e ) + { + // verify + assertEquals( "Check cause", NoSuchScmProviderException.class, e.getCause().getClass() ); + } + } + + @Test + public void testRewriteWhitespaceAroundValues() + throws Exception + { + List reactorProjects = createReactorProjects( "whitespace-around-values" ); + ReleaseDescriptorBuilder builder = createConfigurationForPomWithParentAlternateNextVersion( reactorProjects, "whitespace-around-values" ); + mapNextVersion( builder, "groupId:subproject2" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteCommentsAroundValues() + throws Exception + { + List reactorProjects = createReactorProjects( "comments-around-values" ); + ReleaseDescriptorBuilder builder = createConfigurationForPomWithParentAlternateNextVersion( reactorProjects, "comments-around-values" ); + mapNextVersion( builder, "groupId:subproject2" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteCDataAroundValues() + throws Exception + { + List reactorProjects = createReactorProjects( "cdata-around-values" ); + ReleaseDescriptorBuilder builder = createConfigurationForPomWithParentAlternateNextVersion( reactorProjects, "cdata-around-values" ); + mapNextVersion( builder, "groupId:subproject2" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testCleanNoProjects() + throws Exception + { + // This occurs when it is release:perform run standalone. Just check there are no errors. + ( (ResourceGenerator) phase ).clean( Collections.emptyList() ); + } + + protected ReleaseDescriptorBuilder createUnmappedConfiguration( List reactorProjects, String workingDirectory ) + throws Exception + { + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, workingDirectory ); + + unmapNextVersion( builder, "groupId:subproject1" ); + mapNextVersion( builder, "groupId:subproject2" ); + mapNextVersion( builder, "groupId:subproject3" ); + mapNextVersion( builder, "groupId:artifactId" ); + return builder; + } + + protected List createReactorProjects( String path ) + throws Exception + { + return prepareReactorProjects( path ); + } + + protected ReleaseDescriptorBuilder createDefaultConfiguration( List reactorProjects, String workingDirectory ) + throws Exception + { + ReleaseDescriptorBuilder builder = createMappedConfiguration( reactorProjects, workingDirectory ); + + mapNextVersion( builder, "groupId:subproject4" ); + return builder; + } + + protected ReleaseDescriptorBuilder createMappedConfiguration( List reactorProjects, String workingDirectory ) + throws Exception + { + ReleaseDescriptorBuilder builder = createDifferingVersionConfiguration( reactorProjects, workingDirectory ); + + mapNextVersion( builder, "groupId:subproject3" ); + return builder; + } + + private ReleaseDescriptorBuilder createDifferingVersionConfiguration( List reactorProjects, String workingDirectory ) + throws Exception + { + ReleaseDescriptorBuilder builder = createConfigurationForWithParentNextVersion( reactorProjects, workingDirectory ); + + mapNextVersion( builder, "groupId:subproject2" ); + return builder; + } + + protected abstract ReleaseDescriptorBuilder createConfigurationForWithParentNextVersion( List reactorProjects, String workingDirectory ) + throws Exception; + + protected abstract void unmapNextVersion( ReleaseDescriptorBuilder config, String projectId ); + + protected abstract void mapNextVersion( ReleaseDescriptorBuilder config, String projectId ); + + protected ReleaseDescriptorBuilder createDescriptorFromBasicPom( List reactorProjects, String workingDirectory ) + throws Exception + { + return createDescriptorFromProjects( reactorProjects, workingDirectory ); + } + + protected abstract String readTestProjectFile( String fileName ) + throws IOException; + + @Test + public void testRewritePomDependenciesWithNamespace() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-with-namespace" ); + ReleaseDescriptorBuilder builder = createDefaultConfiguration( reactorProjects, "pom-with-namespace" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + protected abstract List prepareReactorProjects( String path ) + throws Exception; + + protected void verifyReactorProjects( String path, boolean copyFiles ) + throws Exception + { + } + + protected ReleaseDescriptorBuilder createDescriptorFromProjects( List reactorProjects, String workingDirectory ) + { + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( new ReleaseDescriptorBuilder(), reactorProjects ); + builder.setWorkingDirectory( getWorkingDirectory( workingDirectory ).toString() ); + return builder; + } + + private ReleaseDescriptorBuilder createDescriptorFromProjects( ReleaseDescriptorBuilder builder, List reactorProjects ) + { + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + + for ( MavenProject project : reactorProjects ) + { + String key = project.getGroupId() + ':' + project.getArtifactId(); + builder.putOriginalVersion( key, project.getVersion() ); + builder.addOriginalScmInfo( key, project.getScm() ); + } + + if ( rootProject.getScm() == null ) + { + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo/trunk" ); + } + else + { + builder.setScmSourceUrl( rootProject.getScm().getConnection() ); + } + + return builder; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhaseTest.java new file mode 100644 index 000000000..3a6bbae2e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhaseTest.java @@ -0,0 +1,100 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.List; + +import org.apache.maven.model.Model; +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.junit.Test; + +public class AbstractScmCommitPhaseTest +{ + @Test + public void testDefaultCreatePomFiles() + throws Exception + { + List files = + AbstractScmCommitPhase.createPomFiles( ReleaseUtils.buildReleaseDescriptor( new ReleaseDescriptorBuilder() ), + createProject( "artifactId", "1.0-SNAPSHOT", + new File( "pom.xml" ) ) ); + assertEquals( "Number of created files", files.size(), 1 ); + assertTrue( files.contains( new File( "pom.xml" ) ) ); + } + + + @Test + public void testCreatePomFilesSuppressCommitBeforeTag() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setSuppressCommitBeforeTagOrBranch( true ); + List files = + AbstractScmCommitPhase.createPomFiles( ReleaseUtils.buildReleaseDescriptor( builder ), + createProject( "artifactId", "1.0-SNAPSHOT", new File( "pom.xml" ) ) ); + assertEquals( "Number of created files", files.size(), 1 ); + assertTrue( files.contains( new File( "pom.xml" ) ) ); + } + + @Test + public void testCreatePomFilesWithReleasePom() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setGenerateReleasePoms( true ); + List files = + AbstractScmCommitPhase.createPomFiles( ReleaseUtils.buildReleaseDescriptor( builder ), + createProject( "artifactId", "1.0-SNAPSHOT", new File( "pom.xml" ) ) ); + assertEquals( "Number of created files", files.size(), 2 ); + assertTrue( files.contains( new File( "pom.xml" ) ) ); + assertTrue( files.contains( new File( "release-pom.xml" ) ) ); + } + + @Test + public void testCreatePomFilesWithReleasePomAndSuppressCommitBeforeTag() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setGenerateReleasePoms( true ); + builder.setSuppressCommitBeforeTagOrBranch( true ); + List files = + AbstractScmCommitPhase.createPomFiles( ReleaseUtils.buildReleaseDescriptor( builder ), + createProject( "artifactId", "1.0-SNAPSHOT", new File( "pom.xml" ) ) ); + assertEquals( "Number of created files", files.size(), 1 ); + assertTrue( files.contains( new File( "pom.xml" ) ) ); + } + + private static MavenProject createProject( String artifactId, String version, File file ) + { + Model model = new Model(); + model.setGroupId( "groupId" ); + model.setArtifactId( artifactId ); + model.setVersion( version ); + MavenProject project = new MavenProject( model ); + project.setFile( file ); + return project; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/BranchInputVariablesPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/BranchInputVariablesPhaseTest.java new file mode 100644 index 000000000..1ff575f7c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/BranchInputVariablesPhaseTest.java @@ -0,0 +1,333 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.util.Collections; +import java.util.List; + +import org.apache.maven.model.Model; +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.PlexusJUnit4TestCase; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.codehaus.plexus.components.interactivity.Prompter; +import org.codehaus.plexus.components.interactivity.PrompterException; +import org.junit.Test; + +/** + * Test the variable input phase. + * + * @author Brett Porter + */ +public class BranchInputVariablesPhaseTest + extends PlexusJUnit4TestCase +{ + private InputVariablesPhase phase; + + @Override + public void setUp() + throws Exception + { + super.setUp(); + phase = (InputVariablesPhase) lookup( ReleasePhase.class, "branch-input-variables" ); + } + + @Test + public void testInputVariablesInteractive() + throws Exception + { + // prepare + Prompter mockPrompter = mock( Prompter.class ); + when( mockPrompter.prompt( isA( String.class ) ) ).thenReturn( "tag-value", "simulated-tag-value" ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "tag-value", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "simulated-tag-value", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + verify( mockPrompter, times( 2 ) ).prompt( isA( String.class ) ); + verifyNoMoreInteractions( mockPrompter ); + } + + @Test + public void testUnmappedVersion() + throws Exception + { + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Expected an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertNull( "check no cause", e.getCause() ); + } + + builder = new ReleaseDescriptorBuilder(); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Expected an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertNull( "check no cause", e.getCause() ); + } + } + + @Test + public void testInputVariablesNonInteractiveConfigured() + throws Exception + { + // prepare + Prompter mockPrompter = mock( Prompter.class ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + builder.setScmReleaseLabel( "tag-value" ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "tag-value", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + builder.setScmReleaseLabel( "simulated-tag-value" ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "simulated-tag-value", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // never use prompter + verifyNoMoreInteractions( mockPrompter ); + } + + @Test + public void testInputVariablesInteractiveConfigured() + throws Exception + { + // prepare + Prompter mockPrompter = mock( Prompter.class ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmReleaseLabel( "tag-value" ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "tag-value", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.setScmReleaseLabel( "simulated-tag-value" ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "simulated-tag-value", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // never use prompter + verifyNoMoreInteractions( mockPrompter ); + } + + @Test + public void testPrompterException() + throws Exception + { + // prepare + Prompter mockPrompter = mock( Prompter.class ); + when( mockPrompter.prompt( isA( String.class ), + isA( String.class ) ) ).thenThrow( new PrompterException( "..." ) ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Expected an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "No branch name was given.", e.getMessage() ); + } + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + // execute + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Expected an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "No branch name was given.", e.getMessage() ); + } + + // verify + verify( mockPrompter, times( 2 ) ).prompt( isA( String.class ) ); + verifyNoMoreInteractions( mockPrompter ); + } + + @Test + public void testBranchOperation() + throws Exception + { + assertTrue( phase.isBranchOperation() ); + } + + @Test + public void testEmptyBranchName() + throws Exception + { + // prepare + Prompter mockPrompter = mock( Prompter.class ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + builder.setScmReleaseLabel( null ); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Expected an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "No branch name was given.", e.getMessage() ); + } + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + builder.setScmReleaseLabel( null ); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + // execute + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Expected an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "No branch name was given.", e.getMessage() ); + } + + // never use prompter + verifyNoMoreInteractions( mockPrompter ); + } + + @Test + public void testNamingPolicy() throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setInteractive( false ); + builder.setProjectNamingPolicyId( "stub" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertEquals( "STUB", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + } + + private static MavenProject createProject( String artifactId, String version ) + { + Model model = new Model(); + model.setGroupId( "groupId" ); + model.setArtifactId( artifactId ); + model.setVersion( version ); + return new MavenProject( model ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhaseTest.java new file mode 100644 index 000000000..3e8010718 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhaseTest.java @@ -0,0 +1,1261 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.codehaus.plexus.components.interactivity.Prompter; +import org.codehaus.plexus.components.interactivity.PrompterException; +import org.junit.Test; + +/** + * Test the dependency snapshot check phase. + * + * @author Brett Porter + */ +public class CheckDependencySnapshotsPhaseTest + extends AbstractReleaseTestCase +{ + private static final String NO = "no"; + + private static final String YES = "yes"; + + private static final List YES_NO_ARRAY = Arrays.asList( YES, NO ); + + private static final String DEFAULT_CHOICE = "1"; + + private static final List CHOICE_ARRAY = Arrays.asList( "0", DEFAULT_CHOICE, "2", "3" ); + + @Override + public void setUp() + throws Exception + { + super.setUp(); + + phase = lookup( ReleasePhase.class, "check-dependency-snapshots" ); + } + + @Test + public void testNoSnapshotDependencies() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder();; + List reactorProjects = createDescriptorFromProjects( "no-snapshot-dependencies" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testNoSnapshotRangeDependencies() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "no-snapshot-range-dependencies" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createMockPrompter( YES, DEFAULT_CHOICE, new VersionPair( "1.1", "1.2-SNAPSHOT" ) ) ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.setPrompter( createMockPrompter( YES, DEFAULT_CHOICE, new VersionPair( "1.1", "1.2-SNAPSHOT" ) ) ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + // MRELEASE-985 + @Test + public void testSnapshotDependenciesInProjectAndResolveFromCommandLine() throws Exception { + List reactorProjects = createDescriptorFromProjects( "internal-snapshot-dependencies-no-reactor" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + builder.addDependencyReleaseVersion("groupId:test", "1.0"); + builder.addDependencyDevelopmentVersion("groupId:test", "1.1"); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + assertTrue( true ); + } + catch ( ReleaseFailureException e ) + { + fail( "There should be no failed execution" ); + } + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + assertTrue( true ); + } + catch ( ReleaseFailureException e ) + { + fail( "There should be no failed execution" ); + } + } + + @Test + public void testSnapshotDependenciesInProjectOnly() + throws Exception + { + List reactorProjects = createDescriptorFromProjects( "internal-snapshot-dependencies" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testSnapshotReleasePluginNonInteractive() + throws Exception + { + List reactorProjects = createDescriptorFromProjects( "snapshot-release-plugin" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + builder.setInteractive( false ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testSnapshotReleasePluginInteractiveDeclined() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "snapshot-release-plugin" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createMockPrompterWithSnapshotReleasePlugin( NO, NO ) ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + phase.setPrompter( createMockPrompterWithSnapshotReleasePlugin( NO, NO ) ); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testSnapshotReleasePluginInteractiveAcceptedForExecution() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "snapshot-release-plugin" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createYesMockPrompter() ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( true ); + } + + @Test + public void testSnapshotReleasePluginInteractiveAcceptedForSimulation() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "snapshot-release-plugin" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createYesMockPrompter() ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( true ); + } + + @Test + public void testSnapshotReleasePluginInteractiveInvalid() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "snapshot-release-plugin" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createMockPrompterWithSnapshotReleasePlugin( "donkey", NO ) ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + phase.setPrompter( createMockPrompterWithSnapshotReleasePlugin( "donkey", NO ) ); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testSnapshotReleasePluginInteractiveException() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "snapshot-release-plugin" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + Prompter mockPrompter = mock( Prompter.class ); + when( mockPrompter.prompt( anyString(), eq( YES_NO_ARRAY ), + eq( NO ) ) ).thenThrow( new PrompterException( "..." ) ); + phase.setPrompter( mockPrompter ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "Check cause", PrompterException.class, e.getCause().getClass() ); + } + + mockPrompter = mock( Prompter.class ); + when( mockPrompter.prompt( anyString(), eq( YES_NO_ARRAY ), + eq( NO ) ) ).thenThrow( new PrompterException( "..." ) ); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "Check cause", PrompterException.class, e.getCause().getClass() ); + } + } + + @Test + public void testSnapshotDependenciesInProjectOnlyMismatchedVersion() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "internal-differing-snapshot-dependencies" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testSnapshotManagedDependenciesInProjectOnly() + throws Exception + { + List reactorProjects = createDescriptorFromProjects( "internal-managed-snapshot-dependency" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testSnapshotUnusedInternalManagedDependency() + throws Exception + { + List reactorProjects = + createDescriptorFromProjects( "unused-internal-managed-snapshot-dependency" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testSnapshotUnusedExternalManagedDependency() + throws Exception + { + List reactorProjects = + createDescriptorFromProjects( "unused-external-managed-snapshot-dependency" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testSnapshotExternalManagedDependency() + throws Exception + { + List reactorProjects = createDescriptorFromProjects( "external-managed-snapshot-dependency" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + builder.setInteractive( false ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testSnapshotDependenciesOutsideProjectOnlyNonInteractive() + throws Exception + { + List reactorProjects = createDescriptorFromProjects( "external-snapshot-dependencies" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + builder.setInteractive( false ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testRangeSnapshotDependenciesOutsideProjectOnlyNonInteractive() + throws Exception + { + List reactorProjects = createDescriptorFromProjects( "external-range-snapshot-dependencies" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + builder.setInteractive( false ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testSnapshotDependenciesOutsideProjectOnlyInteractiveWithSnapshotsResolved() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "external-snapshot-dependencies" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createMockPrompter( YES, DEFAULT_CHOICE, new VersionPair( "1.0", "1.1-SNAPSHOT" ), + new VersionPair( "1.0", "1.0" ) ) ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // validate + ReleaseDescriptor descriptor = ReleaseUtils.buildReleaseDescriptor( builder ); + + assertEquals( "1.0", descriptor.getDependencyReleaseVersion( "external:artifactId" ) ); + assertEquals( "1.1-SNAPSHOT", descriptor.getDependencyDevelopmentVersion( "external:artifactId" ) ); + + builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createMockPrompter( YES, DEFAULT_CHOICE, new VersionPair( "1.0", "1.1-SNAPSHOT" ) ) ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + } + + @Test + public void testSnapshotDependenciesSelectOlderRelease() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "external-snapshot-dependencies" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createMockPrompter( YES, DEFAULT_CHOICE, new VersionPair( "0.9", "1.0-SNAPSHOT" ), + new VersionPair( "1.0", "1.0-SNAPSHOT" ) ) ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // validate + ReleaseDescriptor descriptor = ReleaseUtils.buildReleaseDescriptor( builder ); + + assertEquals( "0.9", descriptor.getDependencyReleaseVersion( "external:artifactId" ) ); + assertEquals( "1.0-SNAPSHOT", descriptor.getDependencyDevelopmentVersion( "external:artifactId" ) ); + } + + @Test + public void testSnapshotDependenciesSelectDefaults() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "external-snapshot-dependencies" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createMockPrompter( YES, DEFAULT_CHOICE, new VersionPair( "1.0", "1.0" ) ) ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // validate + ReleaseDescriptor descriptor = ReleaseUtils.buildReleaseDescriptor( builder ); + + assertEquals( "1.0", descriptor.getDependencyReleaseVersion( "external:artifactId" ) ); + assertEquals( "1.0", descriptor.getDependencyDevelopmentVersion( "external:artifactId" ) ); + } + + @Test + public void testSnapshotDependenciesUpdateAllOnlyDependenciesNeeded() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "external-snapshot-dependencies" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createMockPrompter( YES, "0", new VersionPair( "1.0", "1.0" ) ) ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // validate + ReleaseDescriptor descriptor = ReleaseUtils.buildReleaseDescriptor( builder ); + + assertEquals( "1.0", descriptor.getDependencyReleaseVersion( "external:artifactId" ) ); + assertEquals( "1.0", descriptor.getDependencyDevelopmentVersion( "external:artifactId" ) ); + } + + @Test + public void testSnapshotDependenciesUpdateAll() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "external-snapshot-all" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + Prompter mockPrompter = + createMockPrompter( YES, "0", + Arrays.asList( new VersionPair( "1.0", "1.0" ), new VersionPair( "1.1", "1.1" ), + new VersionPair( "1.2", "1.2" ), new VersionPair( "1.3", "1.3" ) ) ); + phase.setPrompter( mockPrompter ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // validate + ReleaseDescriptor descriptor = ReleaseUtils.buildReleaseDescriptor( builder ); + + assertEquals( "1.0", descriptor.getDependencyReleaseVersion( "external:artifactId" ) ); + assertEquals( "1.0", descriptor.getDependencyDevelopmentVersion( "external:artifactId" ) ); + } + + // MRELEASE-589 + @Test + public void testSnapshotDependenciesOutsideMultimoduleProjectOnlyInteractiveWithSnapshotsResolved() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = + createDescriptorFromProjects( "multimodule-external-snapshot-dependencies" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + VersionPair pair = new VersionPair( "1.0", "1.1-SNAPSHOT" ); + VersionPair defaultPair = new VersionPair( "1.0", "1.0" ); + Prompter mockPrompter = + createMockPrompter( "yes", "1", Arrays.asList( pair, pair ), Arrays.asList( defaultPair, defaultPair ) ); + phase.setPrompter( mockPrompter ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + ReleaseDescriptor descriptor = ReleaseUtils.buildReleaseDescriptor( builder ); + + assertEquals( "1.0", descriptor.getDependencyReleaseVersion( "external:artifactId" ) ); + assertEquals( "1.1-SNAPSHOT", descriptor.getDependencyDevelopmentVersion( "external:artifactId" ) ); + + assertEquals( "1.0", descriptor.getDependencyReleaseVersion( "external:artifactId2" ) ); + assertEquals( "1.1-SNAPSHOT", descriptor.getDependencyDevelopmentVersion( "external:artifactId2" ) ); + } + + @Test + public void testSnapshotDependenciesInsideAndOutsideProject() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = + createDescriptorFromProjects( "internal-and-external-snapshot-dependencies" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testNoSnapshotReportPlugins() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder();; + List reactorProjects = createDescriptorFromProjects( "no-snapshot-report-plugins" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testSnapshotReportPluginsInProjectOnly() + throws Exception + { + List reactorProjects = createDescriptorFromProjects( "internal-snapshot-report-plugins" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testSnapshotReportPluginsOutsideProjectOnly() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "external-snapshot-report-plugins" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testSnapshotReportPluginsInsideAndOutsideProject() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = + createDescriptorFromProjects( "internal-and-external-snapshot-report-plugins" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testNoSnapshotPlugins() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder();; + List reactorProjects = createDescriptorFromProjects( "no-snapshot-plugins" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testSnapshotPluginsInProjectOnly() + throws Exception + { + List reactorProjects = createDescriptorFromProjects( "internal-snapshot-plugins" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testSnapshotManagedPluginInProjectOnly() + throws Exception + { + List reactorProjects = createDescriptorFromProjects( "internal-managed-snapshot-plugin" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testSnapshotUnusedInternalManagedPlugin() + throws Exception + { + List reactorProjects = createDescriptorFromProjects( "unused-internal-managed-snapshot-plugin" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testSnapshotUnusedExternalManagedPlugin() + throws Exception + { + List reactorProjects = createDescriptorFromProjects( "unused-external-managed-snapshot-plugin" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testSnapshotExternalManagedPlugin() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "external-managed-snapshot-plugin" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testSnapshotPluginsOutsideProjectOnly() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "external-snapshot-plugins" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testSnapshotPluginsInsideAndOutsideProject() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "internal-and-external-snapshot-plugins" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testSnapshotExternalParent() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "external-snapshot-parent/child" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testSnapshotExternalParentAdjusted() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "external-snapshot-parent/child" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + Prompter mockPrompter = createMockPrompter( YES, DEFAULT_CHOICE, new VersionPair( "1.0-test", "1.0-test" ), + new VersionPair( "1.0", "1.0-test" ) ); + phase.setPrompter( mockPrompter ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // validate + ReleaseDescriptor descriptor = ReleaseUtils.buildReleaseDescriptor( builder ); + + assertEquals( "1.0-test", descriptor.getDependencyReleaseVersion( "groupId:parent-external" ) ); + assertEquals( "1.0-test", descriptor.getDependencyDevelopmentVersion( "groupId:parent-external" ) ); + } + + @Test + public void testReleaseExternalParent() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder();; + List reactorProjects = createDescriptorFromProjects( "external-parent/child" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testSnapshotExternalExtension() + throws Exception + { + CheckDependencySnapshotsPhase phase = + (CheckDependencySnapshotsPhase) lookup( ReleasePhase.class, "check-dependency-snapshots" ); + + List reactorProjects = createDescriptorFromProjects( "external-snapshot-extension" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + phase.setPrompter( createNoMockPrompter() ); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testSnapshotInternalExtension() + throws Exception + { + List reactorProjects = createDescriptorFromProjects( "internal-snapshot-extension" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testReleaseExternalExtension() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder();; + List reactorProjects = createDescriptorFromProjects( "external-extension" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testAllowTimestampedSnapshots() + throws Exception + { + List reactorProjects = + createDescriptorFromProjects( "external-timestamped-snapshot-dependencies" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( reactorProjects ); + + builder.setInteractive( false ); + + // confirm POM fails without allowTimestampedSnapshots + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Should have failed execution" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + // check whether flag allows + builder.setAllowTimestampedSnapshots( true ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // successful execution is verification enough + assertTrue( true ); + } + + private List createDescriptorFromProjects( String path ) + throws Exception + { + String dir = "check-dependencies/" + Objects.toString( path, "" ); + return createReactorProjects( dir, dir, null ); + } + + private Prompter createNoMockPrompter() + throws PrompterException + { + return createYesNoMockPrompter( false ); + } + + private Prompter createYesMockPrompter() + throws PrompterException + { + return createYesNoMockPrompter( true ); + } + + private Prompter createYesNoMockPrompter( boolean yes ) + throws PrompterException + { + Prompter mockPrompter = mock( Prompter.class ); + + when( mockPrompter.prompt( anyString(), eq( YES_NO_ARRAY ), eq( NO ) ) ).thenReturn( yes ? YES : NO ); + + return mockPrompter; + } + + private Prompter createMockPrompterWithSnapshotReleasePlugin( String useSnapshotReleasePlugin, + String resolveSnapshots ) + throws PrompterException + { + Prompter mockPrompter = mock( Prompter.class ); + + when( mockPrompter.prompt( anyString(), eq( YES_NO_ARRAY ), eq( NO ) ) ).thenReturn( useSnapshotReleasePlugin ); + when( mockPrompter.prompt( anyString(), eq( YES_NO_ARRAY ), eq( NO ) ) ).thenReturn( resolveSnapshots ); + + return mockPrompter; + } + + private Prompter createMockPrompter( String resolveSnapshots, String resolutionType, VersionPair resolvedVersions ) + throws PrompterException + { + return createMockPrompter( resolveSnapshots, resolutionType, resolvedVersions, resolvedVersions ); + } + + private Prompter createMockPrompter( String resolveSnapshots, String resolutionType, VersionPair resolvedVersions, + VersionPair defaultVersions ) + throws PrompterException + { + return createMockPrompter( resolveSnapshots, resolutionType, Collections.singletonList( resolvedVersions ), + Collections.singletonList( defaultVersions ) ); + } + + private Prompter createMockPrompter( String resolveSnapshots, String resolutionType, + List resolvedVersions ) + throws PrompterException + { + return createMockPrompter( resolveSnapshots, resolutionType, resolvedVersions, resolvedVersions ); + } + + private Prompter createMockPrompter( String resolveSnapshots, String resolutionType, + List resolvedVersions, List defaultVersions ) + throws PrompterException + { + Prompter mockPrompter = mock( Prompter.class ); + + when( mockPrompter.prompt( anyString(), eq( YES_NO_ARRAY ), eq( NO ) ) ).thenReturn( resolveSnapshots ); + when( mockPrompter.prompt( anyString(), eq( CHOICE_ARRAY ), + eq( DEFAULT_CHOICE ) ) ).thenReturn( resolutionType ); + + for ( int i = 0; i < resolvedVersions.size(); i++ ) + { + when( mockPrompter.prompt( "Which release version should it be set to?", + defaultVersions.get( i ).releaseVersion ) ).thenReturn( resolvedVersions.get( i ).releaseVersion ); + when( mockPrompter.prompt( "What version should the dependency be reset to for development?", + defaultVersions.get( i ).developmentVersion ) ).thenReturn( resolvedVersions.get( i ).developmentVersion ); + } + return mockPrompter; + } + + private static class VersionPair + { + String releaseVersion; + + String developmentVersion; + + public VersionPair( String releaseVersion, String developmentVersion ) + { + this.releaseVersion = releaseVersion; + this.developmentVersion = developmentVersion; + } + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckPomPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckPomPhaseTest.java new file mode 100644 index 000000000..84e78d7d5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckPomPhaseTest.java @@ -0,0 +1,227 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.Scm; +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.codehaus.plexus.PlexusTestCase; + +import java.util.Collections; + +/** + * Test the POM verification check phase. + * + * @author Brett Porter + */ +public class CheckPomPhaseTest + extends PlexusTestCase +{ + private ReleasePhase phase; + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + + phase = (ReleasePhase) lookup( ReleasePhase.class, "check-poms" ); + } + + public void testCorrectlyConfigured() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/repo" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), Collections.singletonList( createProject( "1.0-SNAPSHOT" ) ) ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), Collections.singletonList( createProject( "1.0-SNAPSHOT" ) ) ); + + // successful execution is verification enough + assertTrue( true ); + } + + public void testGetUrlFromProjectConnection() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/repo" ); + + MavenProject project = createProject( "1.0-SNAPSHOT" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), Collections.singletonList( project ) ); + + assertEquals( "Check URL", "scm:svn:file://localhost/tmp/repo", ReleaseUtils.buildReleaseDescriptor( builder ).getScmSourceUrl() ); + } + + public void testGetUrlFromProjectConnectionSimulate() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/repo" ); + + MavenProject project = createProject( "1.0-SNAPSHOT" ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), Collections.singletonList( project ) ); + + assertEquals( "Check URL", "scm:svn:file://localhost/tmp/repo", ReleaseUtils.buildReleaseDescriptor( builder ).getScmSourceUrl() ); + } + + public void testGetUrlFromProjectDevConnection() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm:svn:https://localhost/tmp/repo" ); + + MavenProject project = createProject( "1.0-SNAPSHOT" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), Collections.singletonList( project ) ); + + assertEquals( "Check URL", "scm:svn:https://localhost/tmp/repo", ReleaseUtils.buildReleaseDescriptor( builder ).getScmSourceUrl() ); + } + + public void testGetUrlFromProjectDevConnectionSimulate() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm:svn:https://localhost/tmp/repo" ); + + MavenProject project = createProject( "1.0-SNAPSHOT" ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), Collections.singletonList( project ) ); + + assertEquals( "Check URL", "scm:svn:https://localhost/tmp/repo", ReleaseUtils.buildReleaseDescriptor( builder ).getScmSourceUrl() ); + } + + public void testGetInvalidUrl() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm:cvs:" ); + + MavenProject project = createProject( "1.0-SNAPSHOT" ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), Collections.singletonList( project ) ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseScmRepositoryException e ) + { + assertTrue( true ); + } + } + + public void testGetInvalidProvider() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + MavenProject project = createProject( "1.0-SNAPSHOT" ); + Scm scm = new Scm(); + scm.setConnection( "scm:foo:" ); + project.setScm( scm ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), Collections.singletonList( project ) ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + public void testMissingUrl() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), Collections.singletonList( createProject( "1.0-SNAPSHOT" ) ) ); + + fail( "Should have failed to execute" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), Collections.singletonList( createProject( "1.0-SNAPSHOT" ) ) ); + + fail( "Should have failed to simulate" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + public void testReleasingNonSnapshot() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/repo" ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), Collections.singletonList( createProject( "1.0" ) ) ); + + fail( "Should have failed to execute" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), Collections.singletonList( createProject( "1.0" ) ) ); + + fail( "Should have failed to simulate" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + private static MavenProject createProject( String version ) + { + Model model = new Model(); + + model.setArtifactId( "artifactId" ); + model.setGroupId( "groupId" ); + model.setVersion( version ); + + return new MavenProject( model ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScmTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScmTest.java new file mode 100644 index 000000000..3ac4eb57d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScmTest.java @@ -0,0 +1,262 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.argThat; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.CommandParameters; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmTag; +import org.apache.maven.scm.command.checkout.CheckOutScmResult; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.stubs.ScmManagerStub; +import org.junit.Test; + +/** + * @author Brett Porter + */ +public class CheckoutProjectFromScmTest + extends AbstractReleaseTestCase +{ + private CheckoutProjectFromScm phase; + + @Override + public void setUp() + throws Exception + { + super.setUp(); + + phase = (CheckoutProjectFromScm) lookup( ReleasePhase.class, "checkout-project-from-scm" ); + } + + @Test + public void testExecuteStandard() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + File checkoutDirectory = getTestFile( "target/checkout-test/standard" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + builder.setScmReleaseLabel( "release-label" ); + String sourceUrl = "file://localhost/tmp/scm-repo/trunk"; + String scmUrl = "scm:svn:" + sourceUrl; + builder.setScmSourceUrl( scmUrl ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + SvnScmProviderRepository scmProviderRepository = new SvnScmProviderRepository( sourceUrl ); + ScmRepository repository = new ScmRepository( "svn", scmProviderRepository ); + when( scmProviderMock.checkOut( eq( repository ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ), + any( CommandParameters.class))) + .thenReturn( new CheckOutScmResult( "",null ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + stub.addScmRepositoryForUrl( scmUrl, repository ); + + String dir = "scm-commit/single-pom"; + List reactorProjects = createReactorProjects( dir, dir, null ); + builder.setWorkingDirectory( getWorkingDirectory( dir ).toString() ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // prepare + assertEquals( "", ReleaseUtils.buildReleaseDescriptor( builder ).getScmRelativePathProjectDirectory() ); + + verify( scmProviderMock ).checkOut( eq( repository ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ), + any( CommandParameters.class )); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testExecuteMultiModuleWithDeepSubprojects() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + File checkoutDirectory = getTestFile( "target/checkout-test/multimodule-with-deep-subprojects" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + builder.setScmReleaseLabel( "release-label" ); + String sourceUrl = "file://localhost/tmp/scm-repo/trunk"; + String scmUrl = "scm:svn:" + sourceUrl; + builder.setScmSourceUrl( scmUrl ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + SvnScmProviderRepository scmProviderRepository = new SvnScmProviderRepository( sourceUrl ); + ScmRepository repository = new ScmRepository( "svn", scmProviderRepository ); + when( scmProviderMock.checkOut( eq( repository ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ), + any(CommandParameters.class))) + .thenReturn( new CheckOutScmResult( "", null ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + stub.addScmRepositoryForUrl( scmUrl, repository ); + + String dir = "scm-commit/multimodule-with-deep-subprojects"; + List reactorProjects = createReactorProjects( dir, dir, null ); + builder.setWorkingDirectory( getWorkingDirectory( dir ).toString() ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "", ReleaseUtils.buildReleaseDescriptor( builder ).getScmRelativePathProjectDirectory() ); + + verify( scmProviderMock ).checkOut( eq( repository ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ), + any( CommandParameters.class )); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testExecuteFlatMultiModule() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + File checkoutDirectory = getTestFile( "target/checkout-test/flat-multi-module" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + builder.setScmReleaseLabel( "release-label" ); + String sourceUrl = "file://localhost/tmp/scm-repo/trunk/root-project"; + String scmUrl = "scm:svn:" + sourceUrl; + builder.setScmSourceUrl( scmUrl ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + SvnScmProviderRepository scmProviderRepository = new SvnScmProviderRepository( sourceUrl ); + ScmRepository repository = new ScmRepository( "svn", scmProviderRepository ); + when( scmProviderMock.checkOut( eq( repository ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ), + any( CommandParameters.class )) ) + .thenReturn( new CheckOutScmResult( "",null ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + stub.addScmRepositoryForUrl( scmUrl, repository ); + + List reactorProjects = + createReactorProjects( "rewrite-for-release/pom-with-parent-flat", "root-project" ); + builder.setWorkingDirectory( getWorkingDirectory( "rewrite-for-release/pom-with-parent-flat" ) .toString() ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "not found root-project but " + ReleaseUtils.buildReleaseDescriptor( builder ).getScmRelativePathProjectDirectory(), "root-project", + ReleaseUtils.buildReleaseDescriptor( builder ).getScmRelativePathProjectDirectory() ); + + verify( scmProviderMock ).checkOut( eq( repository ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ), + any( CommandParameters.class )); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testNoSuchScmProviderExceptionThrown() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setWorkingDirectory( getTestFile( "target/test/checkout" ).getAbsolutePath() ); + + ScmManagerStub scmManagerStub = (ScmManagerStub) lookup( ScmManager.class ); + scmManagerStub.setException( new NoSuchScmProviderException( "..." ) ); + + String dir = "scm-commit/single-pom"; + List reactorProjects = createReactorProjects( dir, dir, null ); + + // execute + try + { + builder.setUseReleaseProfile( false ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "commit should have failed" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "check cause", NoSuchScmProviderException.class, e.getCause().getClass() ); + } + } + + @Test + public void testScmRepositoryExceptionThrown() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setWorkingDirectory( getTestFile( "target/test/checkout" ).getAbsolutePath() ); + + ScmManagerStub scmManagerStub = (ScmManagerStub) lookup( ScmManager.class ); + scmManagerStub.setException( new ScmRepositoryException( "..." ) ); + + String dir = "scm-commit/single-pom"; + List reactorProjects = createReactorProjects( dir, dir, null ); + + // execute + try + { + builder.setUseReleaseProfile( false ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "commit should have failed" ); + } + catch ( ReleaseScmRepositoryException e ) + { + assertNull( "Check no additional cause", e.getCause() ); + } + } + +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CreateBackupPomsPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CreateBackupPomsPhaseTest.java new file mode 100644 index 000000000..44e43ee59 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CreateBackupPomsPhaseTest.java @@ -0,0 +1,136 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.Iterator; +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.junit.Test; + +/** + * @author Edwin Punzalan + */ +public class CreateBackupPomsPhaseTest + extends AbstractBackupPomsPhaseTest +{ + @Override + ReleasePhase getReleasePhase() + throws Exception + { + return (ReleasePhase) lookup( ReleasePhase.class, "create-backup-poms" ); + } + + @Test + public void testBasicPom() + throws Exception + { + String projectPath = "target/test-classes/projects/create-backup-poms/basic-pom"; + + // should create backup files + runExecuteOnProjects( projectPath ); + + // should delete backup files + runCleanOnProjects( projectPath ); + + // should re-create backup files + runSimulateOnProjects( projectPath ); + } + + @Test + public void testMultiModulePom() + throws Exception + { + String projectPath = "target/test-classes/projects/create-backup-poms/pom-with-modules"; + + // should create backup files + runExecuteOnProjects( projectPath ); + + // should delete backup files + runCleanOnProjects( projectPath ); + + // should re-create backup files + runSimulateOnProjects( projectPath ); + } + + private void runExecuteOnProjects( String path ) + throws Exception + { + List projects = getReactorProjects( getTestPath( path ) ); + + phase.execute( null, new DefaultReleaseEnvironment(), projects ); + + testProjectBackups( projects, true ); + } + + private void runSimulateOnProjects( String path ) + throws Exception + { + List projects = getReactorProjects( getTestPath( path ) ); + + phase.simulate( null, new DefaultReleaseEnvironment(), projects ); + + testProjectBackups( projects, true ); + } + + private void runCleanOnProjects( String path ) + throws Exception + { + List projects = getReactorProjects( getTestPath( path ) ); + + ( (ResourceGenerator) phase ).clean( projects ); + + testProjectBackups( projects, false ); + } + + protected void testProjectBackups( List reactorProjects, boolean created ) + throws Exception + { + for( Iterator projects = reactorProjects.iterator(); projects.hasNext(); ) + { + MavenProject project = projects.next(); + + File pomFile = project.getFile(); + + File backupFile = new File( pomFile.getAbsolutePath() + releaseBackupSuffix ); + + if ( created ) + { + assertTrue( "Check if backup file was created.", backupFile.exists() ); + + String pomContents = ReleaseUtil.readXmlFile( pomFile ); + + String backupContents = ReleaseUtil.readXmlFile( backupFile ); + + assertTrue( "Check if pom and backup files are identical", pomContents.equals( backupContents ) ); + } + else + { + assertFalse( "Check if backup file is not present", backupFile.exists() ); + } + } + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/EndReleasePhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/EndReleasePhaseTest.java new file mode 100644 index 000000000..990bd4144 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/EndReleasePhaseTest.java @@ -0,0 +1,69 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; + +import org.apache.maven.shared.release.PlexusJUnit4TestCase; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.junit.Test; + +/** + * Test the the end release phase. Nothing to see here really, but we want to make sure it is configured. + * + * @author Brett Porter + */ +public class EndReleasePhaseTest + extends PlexusJUnit4TestCase +{ + private ReleasePhase phase; + + @Override + public void setUp() + throws Exception + { + super.setUp(); + + phase = lookup( ReleasePhase.class, "end-release" ); + } + + @Test + public void testExecute() + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = phase.execute( ReleaseUtils.buildReleaseDescriptor( new ReleaseDescriptorBuilder() ), new DefaultReleaseEnvironment(), null ); + + assertEquals( ReleaseResult.SUCCESS, result.getResultCode() ); + } + + @Test + public void testSimulate() + throws ReleaseExecutionException, ReleaseFailureException + { + ReleaseResult result = phase.simulate( ReleaseUtils.buildReleaseDescriptor( new ReleaseDescriptorBuilder() ), new DefaultReleaseEnvironment(), null ); + + assertEquals( ReleaseResult.SUCCESS, result.getResultCode() ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhaseTest.java new file mode 100644 index 000000000..ad381eead --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhaseTest.java @@ -0,0 +1,321 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertTrue; + +import static org.mockito.Matchers.argThat; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmFileStatus; +import org.apache.maven.scm.command.add.AddScmResult; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.manager.ScmManagerStub; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.junit.Test; + +/** + * Test the generate release POMs phase. + * + * @author Mark Hobson + */ +public class GenerateReleasePomsPhaseTest + extends AbstractRewritingReleasePhaseTestCase +{ + private static final String NEXT_VERSION = "1.0"; + + private static final String ALTERNATIVE_NEXT_VERSION = "2.0"; + + private ScmProvider scmProviderMock; + + public GenerateReleasePomsPhaseTest( String modelETL ) + { + super( modelETL ); + } + + @Override + public void setUp() + throws Exception + { + super.setUp(); + + scmProviderMock = null; + } + + @Override + protected String getRoleHint() + { + return "generate-release-poms"; + } + + // TODO: MRELEASE-262 + // @Test public void testRewriteInternalRangeDependency() throws Exception + // { + // List reactorProjects = createReactorProjects( "internal-snapshot-range-dependency" ); + // ReleaseDescriptor config = createMappedConfiguration( reactorProjects ); + // + // phase.execute( config, null, reactorProjects ); + // + // compareFiles( reactorProjects ); + // } + + @Test + public void testRewriteExternalRangeDependency() + throws Exception + { + List reactorProjects = createReactorProjects( "external-range-dependency" ); + ReleaseDescriptorBuilder builder = createMappedConfiguration( reactorProjects, "external-range-dependency" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + comparePomFiles( reactorProjects ); + } + + // MRELEASE-787 + @Test + public void testSuppressCommitBeforeTagOrBranch() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setGenerateReleasePoms( true ); + builder.setSuppressCommitBeforeTagOrBranch( true ); + builder.setRemoteTagging( false ); + builder.setPinExternals( false ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + verify( scmProviderMock ).add( isA( ScmRepository.class ), isA( ScmFileSet.class ) ); + + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testSuppressCommitBeforeTagOrBranchAndReomoteTagging() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setGenerateReleasePoms( true ); + builder.setSuppressCommitBeforeTagOrBranch( true ); + builder.setRemoteTagging( true ); + builder.setPinExternals( false ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + verify( scmProviderMock ).add( isA( ScmRepository.class ), isA( ScmFileSet.class ) ); + + verifyNoMoreInteractions( scmProviderMock ); + } + + // MRELEASE-808 + @Test + public void testFinalName() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-with-finalname" ); + ReleaseDescriptorBuilder builder = createConfigurationForWithParentNextVersion( reactorProjects, "pom-with-finalname" ); + builder.setGenerateReleasePoms( true ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + /* + * @see + * org.apache.maven.shared.release.phase.AbstractRewritingReleasePhaseTestCase#createDescriptorFromProjects(java. + * util.List) + */ + @Override + protected ReleaseDescriptorBuilder createDescriptorFromProjects( List reactorProjects, String workingDirectory ) + { + ReleaseDescriptorBuilder builder = super.createDescriptorFromProjects( reactorProjects, workingDirectory ); + builder.setScmReleaseLabel( "release-label" ); + builder.setGenerateReleasePoms( true ); + return builder; + } + + /* + * @see org.apache.maven.shared.release.phase.AbstractRewritingReleasePhaseTestCase#createReactorProjects(java.lang. + * String, boolean) + */ + @Override + protected List prepareReactorProjects( String path ) + throws Exception + { + String dir = "generate-release-poms/" + path; + List reactorProjects = createReactorProjects( dir, dir, null ); + + scmProviderMock = mock( ScmProvider.class ); + + List releasePoms = new ArrayList<>(); + + for ( MavenProject project : reactorProjects ) + { + releasePoms.add( ReleaseUtil.getReleasePom( project ) ); + } + + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile(), releasePoms ); + + when( scmProviderMock.add( isA( ScmRepository.class ), + argThat( new IsScmFileSetEquals( fileSet ) ) ) ).thenReturn( new AddScmResult( "...", + Collections.singletonList( new ScmFile( "pom.xml", ScmFileStatus.ADDED ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + return reactorProjects; + } + + @Override + protected void verifyReactorProjects( String path, boolean copyFiles ) + throws Exception + { + String dir = "generate-release-poms/"+ path; + List reactorProjects = createReactorProjects( dir, dir, null ); + + List releasePoms = new ArrayList<>(); + + for ( Iterator iterator = reactorProjects.iterator(); iterator.hasNext(); ) + { + MavenProject project = iterator.next(); + + releasePoms.add( ReleaseUtil.getReleasePom( project ) ); + } + + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile(), releasePoms ); + + verify( scmProviderMock ).add( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Override + protected void mapNextVersion( ReleaseDescriptorBuilder config, String projectId ) + { + config.addReleaseVersion( projectId, NEXT_VERSION ); + } + + /* + * @see + * org.apache.maven.shared.release.phase.AbstractRewritingReleasePhaseTestCase#mapAlternateNextVersion(org.apache. + * maven.shared.release.config.ReleaseDescriptor, java.lang.String) + */ + @Override + protected void mapAlternateNextVersion( ReleaseDescriptorBuilder config, String projectId ) + { + config.addReleaseVersion( projectId, ALTERNATIVE_NEXT_VERSION ); + } + + /* + * @see + * org.apache.maven.shared.release.phase.AbstractRewritingReleasePhaseTestCase#unmapNextVersion(org.apache.maven. + * shared.release.config.ReleaseDescriptor, java.lang.String) + */ + @Override + protected void unmapNextVersion( ReleaseDescriptorBuilder config, String projectId ) + { + // nothing to do + } + + /* + * @see org.apache.maven.shared.release.phase.AbstractRewritingReleasePhaseTestCase# + * createConfigurationForPomWithParentAlternateNextVersion(java.util.List) + */ + @Override + protected ReleaseDescriptorBuilder createConfigurationForPomWithParentAlternateNextVersion( List reactorProjects, String workingDirectory ) + throws Exception + { + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, workingDirectory ); + + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", ALTERNATIVE_NEXT_VERSION ); + + return builder; + } + + /* + * @see org.apache.maven.shared.release.phase.AbstractRewritingReleasePhaseTestCase# + * createConfigurationForWithParentNextVersion(java.util.List) + */ + @Override + protected ReleaseDescriptorBuilder createConfigurationForWithParentNextVersion( List reactorProjects, String workingDirectory ) + throws Exception + { + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, workingDirectory ); + + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", NEXT_VERSION ); + + return builder; + } + + /* + * @see + * org.apache.maven.shared.release.phase.AbstractRewritingReleasePhaseTestCase#readTestProjectFile(java.lang.String) + */ + @Override + protected String readTestProjectFile( String fileName ) + throws IOException + { + return ReleaseUtil.readXmlFile( getTestFile( "target/test-classes/projects/generate-release-poms/" + + fileName ) ); + } + + /* + * @see + * org.apache.maven.shared.release.phase.AbstractReleaseTestCase#compareFiles(org.apache.maven.project.MavenProject, + * java.lang.String) + */ + // @Override + @Override + protected void comparePomFiles( MavenProject project, String expectedFileSuffix, boolean normalizeLineEndings ) + throws IOException + { + File actualFile = ReleaseUtil.getReleasePom( project ); + File expectedFile = + new File( actualFile.getParentFile(), "expected-release-pom" + expectedFileSuffix + ".xml" ); + + comparePomFiles( expectedFile, actualFile, normalizeLineEndings, true ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/InputVariablesPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/InputVariablesPhaseTest.java new file mode 100644 index 000000000..6476f04e5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/InputVariablesPhaseTest.java @@ -0,0 +1,381 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.util.Collections; +import java.util.List; + +import org.apache.maven.model.Model; +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.PlexusJUnit4TestCase; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.codehaus.plexus.components.interactivity.Prompter; +import org.codehaus.plexus.components.interactivity.PrompterException; +import org.junit.Test; + +/** + * Test the variable input phase. + * + * @author Brett Porter + */ +public class InputVariablesPhaseTest + extends PlexusJUnit4TestCase +{ + private InputVariablesPhase phase; + + @Override + public void setUp() + throws Exception + { + super.setUp(); + phase = (InputVariablesPhase) lookup( ReleasePhase.class, "input-variables" ); + } + + @Test + public void testInputVariablesInteractive() + throws Exception + { + // prepare + Prompter mockPrompter = mock( Prompter.class ); + when( mockPrompter.prompt( isA( String.class ), eq( "artifactId-1.0" ) ) ).thenReturn( "tag-value", + "simulated-tag-value" ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "tag-value", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "simulated-tag-value", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + verify( mockPrompter, times( 2 ) ).prompt( isA( String.class ), eq( "artifactId-1.0" ) ); + verifyNoMoreInteractions( mockPrompter ); + } + + @Test + public void testUnmappedVersion() + throws Exception + { + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Expected an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertNull( "check no cause", e.getCause() ); + } + + builder = new ReleaseDescriptorBuilder(); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Expected an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertNull( "check no cause", e.getCause() ); + } + } + + @Test + public void testInputVariablesNonInteractive() + throws Exception + { + // prepare + Prompter mockPrompter = mock( Prompter.class ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "artifactId-1.0", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "artifactId-1.0", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // never use prompter + verifyNoMoreInteractions( mockPrompter ); + } + + @Test + public void testInputVariablesNonInteractiveConfigured() + throws Exception + { + // prepare + Prompter mockPrompter = mock( Prompter.class ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + builder.setScmReleaseLabel( "tag-value" ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "tag-value", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + builder.setScmReleaseLabel( "simulated-tag-value" ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "simulated-tag-value", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // never use prompter + verifyNoMoreInteractions( mockPrompter ); + } + + @Test + public void testInputVariablesInteractiveConfigured() + throws Exception + { + // prepare + Prompter mockPrompter = mock( Prompter.class ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmReleaseLabel( "tag-value" ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "tag-value", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.setScmReleaseLabel( "simulated-tag-value" ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "simulated-tag-value", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // never use prompter + verifyNoMoreInteractions( mockPrompter ); + } + + @Test + public void testPrompterException() + throws Exception + { + // prepare + Prompter mockPrompter = mock( Prompter.class ); + when( mockPrompter.prompt( isA( String.class ), + isA( String.class ) ) ).thenThrow( new PrompterException( "..." ) ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Expected an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "check cause", PrompterException.class, e.getCause().getClass() ); + } + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + // execute + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Expected an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "check cause", PrompterException.class, e.getCause().getClass() ); + } + + // verify + verify( mockPrompter, times( 2 ) ).prompt( isA( String.class ), isA( String.class ) ); + verifyNoMoreInteractions( mockPrompter ); + } + + // MRELEASE-110 + @Test + public void testCvsTag() + throws Exception + { + // prepare + Prompter mockPrompter = mock( Prompter.class ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module" ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "artifactId-1_0", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module" ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "artifactId-1_0", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // never use prompter + verifyNoMoreInteractions( mockPrompter ); + } + + // MRELEASE-159 + @Test + public void testCustomTagFormat() + throws Exception + { + // prepare + Prompter mockPrompter = mock( Prompter.class ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "artifactId-1.0", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + builder.addReleaseVersion( "groupId:artifactId", "1.0" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + builder.setScmTagNameFormat( "simulated-@{artifactId}-@{version}" ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check tag", "simulated-artifactId-1.0", ReleaseUtils.buildReleaseDescriptor( builder ).getScmReleaseLabel() ); + + // never use prompter + verifyNoMoreInteractions( mockPrompter ); + } + + @Test + public void testBranchOperation() + throws Exception + { + assertFalse( phase.isBranchOperation() ); + } + + private static MavenProject createProject( String artifactId, String version ) + { + Model model = new Model(); + model.setGroupId( "groupId" ); + model.setArtifactId( artifactId ); + model.setVersion( version ); + return new MavenProject( model ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmBranchEquals.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmBranchEquals.java new file mode 100644 index 000000000..79840d4b5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmBranchEquals.java @@ -0,0 +1,46 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.ScmBranch; +import org.mockito.ArgumentMatcher; + +/** + * JMock constraint to compare tags since it has no equals method. + * + * @author Brett Porter + */ +public class IsScmBranchEquals implements ArgumentMatcher +{ + private final ScmBranch branch; + + public IsScmBranchEquals( ScmBranch branch ) + { + this.branch = branch; + } + + @Override + public boolean matches( ScmBranch argument ) + { + ScmBranch sb = (ScmBranch) argument; + + return sb.getName().equals( this.branch.getName() ); + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmBranchParametersEquals.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmBranchParametersEquals.java new file mode 100644 index 000000000..537a23804 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmBranchParametersEquals.java @@ -0,0 +1,47 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.ScmBranch; +import org.apache.maven.scm.ScmBranchParameters; + +import org.mockito.ArgumentMatcher; + +/** + * @author olamy + */ +public class IsScmBranchParametersEquals implements ArgumentMatcher +{ + private final ScmBranchParameters scmBranchParameters; + + public IsScmBranchParametersEquals( ScmBranchParameters scmBranchParameters ) + { + this.scmBranchParameters = scmBranchParameters; + } + + @Override + public boolean matches( ScmBranchParameters argument ) + { + ScmBranchParameters sbp = (ScmBranchParameters) argument; + return sbp.getMessage().equals( this.scmBranchParameters.getMessage() ) + && sbp.isRemoteBranching() == this.scmBranchParameters.isRemoteBranching() + && sbp.isPinExternals() == this.scmBranchParameters.isPinExternals(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmFileSetEquals.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmFileSetEquals.java new file mode 100644 index 000000000..51f32a02b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmFileSetEquals.java @@ -0,0 +1,58 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.scm.ScmFileSet; +import org.mockito.ArgumentMatcher; + +/** + * JMock constraint to compare file sets since it has no equals method. + * + * @author Brett Porter + * @todo add an equals() method + */ +public class IsScmFileSetEquals implements ArgumentMatcher +{ + private final ScmFileSet fileSet; + + public IsScmFileSetEquals( ScmFileSet fileSet ) + { + this.fileSet = fileSet; + } + + @Override + public boolean matches( ScmFileSet argument ) + { + ScmFileSet fs = (ScmFileSet) argument; + + try + { + return fs.getBasedir().getCanonicalPath().equals( fileSet.getBasedir().getCanonicalPath() ) + && fs.getFileList().equals( fileSet.getFileList() ); + } + catch ( IOException e ) + { + // should not happened so RuntimeException + throw new RuntimeException(e.getMessage(), e); + } + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmTagEquals.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmTagEquals.java new file mode 100644 index 000000000..c55924787 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmTagEquals.java @@ -0,0 +1,49 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.ScmTag; +import org.mockito.ArgumentMatcher; + +/** + * JMock constraint to compare tags since it has no equals method. + * + * @author Brett Porter + * @todo add an equals() method + */ +public class IsScmTagEquals implements ArgumentMatcher +{ + private final ScmTag tag; + + public IsScmTagEquals( ScmTag tag ) + { + this.tag = tag; + } + + @Override + public boolean matches( ScmTag argument ) + { + ScmTag tag = (ScmTag) argument; + + return tag.getName().equals( this.tag.getName() ); + } + + +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmTagParametersEquals.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmTagParametersEquals.java new file mode 100644 index 000000000..f0d012df1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/IsScmTagParametersEquals.java @@ -0,0 +1,45 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.ScmTagParameters; +import org.mockito.ArgumentMatcher; + +/** + * @author olamy + */ +public class IsScmTagParametersEquals implements ArgumentMatcher +{ + private final ScmTagParameters scmTagParameters; + + public IsScmTagParametersEquals( ScmTagParameters scmTagParameters ) + { + this.scmTagParameters = scmTagParameters; + } + + @Override + public boolean matches( ScmTagParameters argument ) + { + ScmTagParameters stp = (ScmTagParameters) argument; + return stp.getMessage().equals( this.scmTagParameters.getMessage() ) + && stp.isRemoteTagging() == this.scmTagParameters.isRemoteTagging() + && stp.isPinExternals() == this.scmTagParameters.isPinExternals(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/MapDevelopmentVersionPhaseIT.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/MapDevelopmentVersionPhaseIT.java new file mode 100644 index 000000000..bbd55208e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/MapDevelopmentVersionPhaseIT.java @@ -0,0 +1,65 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.model.Model; +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.codehaus.plexus.PlexusTestCase; + +public class MapDevelopmentVersionPhaseIT + extends PlexusTestCase +{ + private MapVersionsPhase mapVersionsPhase; + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + mapVersionsPhase = (MapVersionsPhase) lookup( ReleasePhase.class, "map-development-versions" ); + } + + private static MavenProject createProject( String artifactId, String version ) + { + Model model = new Model(); + model.setGroupId( "groupId" ); + model.setArtifactId( artifactId ); + model.setVersion( version ); + return new MavenProject( model ); + } + + public void testNoUpdateWorkingCopyVersions() throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + builder.setUpdateWorkingCopyVersions( false ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + mapVersionsPhase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertEquals( "1.0", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion( "groupId:artifactId" ) ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/MapVersionsPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/MapVersionsPhaseTest.java new file mode 100644 index 000000000..338d9792b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/MapVersionsPhaseTest.java @@ -0,0 +1,2224 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Matchers.startsWith; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.apache.maven.model.Model; +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.PlexusJUnit4TestCase; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.policy.PolicyException; +import org.apache.maven.shared.release.versions.VersionParseException; +import org.codehaus.plexus.components.interactivity.Prompter; +import org.codehaus.plexus.components.interactivity.PrompterException; +import org.hamcrest.CoreMatchers; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +/** + * Test the version mapping phase. + * + * @author Brett Porter + */ +public class MapVersionsPhaseTest + extends PlexusJUnit4TestCase +{ + private static final String TEST_MAP_BRANCH_VERSIONS = "test-map-branch-versions"; + + private static final String TEST_MAP_DEVELOPMENT_VERSIONS = "test-map-development-versions"; + + private static final String TEST_MAP_RELEASE_VERSIONS = "test-map-release-versions"; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Mock + private Prompter mockPrompter; + + @Override + public void setUp() + throws Exception + { + super.setUp(); + MockitoAnnotations.initMocks( this ); + } + + @Override + public void tearDown() + throws Exception + { + super.tearDown(); + verifyNoMoreInteractions( mockPrompter ); + } + + @Test + public void testExecuteSnapshot_MapRelease() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_RELEASE_VERSIONS ); + MavenProject project = createProject( "artifactId", "1.0-SNAPSHOT" ); + + when( mockPrompter.prompt( startsWith( "What is the release version for \"" + project.getName() + "\"?" ), + eq( "1.0" ) ) ).thenReturn( "2.0" ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( project ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "2.0", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + + verify( mockPrompter ).prompt( startsWith( "What is the release version for \"" + project.getName() + "\"?" ), + eq( "1.0" ) ); + } + + @Test + public void testSimulateSnapshot_MapReleaseVersions() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_RELEASE_VERSIONS ); + MavenProject project = createProject( "artifactId", "1.0-SNAPSHOT" ); + + when( mockPrompter.prompt( startsWith( "What is the release version for \"" + project.getName() + "\"?" ), + eq( "1.0" ) ) ).thenReturn( "2.0" ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( project ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "2.0", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + verify( mockPrompter ).prompt( startsWith( "What is the release version for \"" + project.getName() + "\"?" ), + eq( "1.0" ) ); + } + + // MRELEASE-403: Release plugin ignores given version number + @Test + public void testMapReleaseVersionsInteractiveAddZeroIncremental() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_RELEASE_VERSIONS ); + MavenProject project = createProject( "artifactId", "1.0-SNAPSHOT" ); + + when( mockPrompter.prompt( startsWith( "What is the release version for \"" + project.getName() + "\"?" ), + eq( "1.0" ) ) ).thenReturn( "1.0.0" ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( project ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "1.0.0", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "1.0.0", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + verify( mockPrompter, + times( 2 ) ).prompt( startsWith( "What is the release version for \"" + project.getName() + "\"?" ), + eq( "1.0" ) ); + } + + /** + * Test to release "SNAPSHOT" version MRELEASE-90 + */ + @Test + public void testMapReleaseVersionsInteractiveWithSnaphotVersion() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_RELEASE_VERSIONS ); + MavenProject project = createProject( "artifactId", "SNAPSHOT" ); + + when( mockPrompter.prompt( startsWith( "What is the release version for \"" + project.getName() + "\"?" ), + eq( "1.0" ) ) ).thenReturn( "2.0" ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( project ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "2.0", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "2.0", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + + verify( mockPrompter, + times( 2 ) ).prompt( startsWith( "What is the release version for \"" + project.getName() + "\"?" ), + eq( "1.0" ) ); + } + + /** + * MRELEASE-524: ignores commandline versions in batch mode + */ + @Test + public void testMapReleaseVersionsNonInteractiveWithExplicitVersion() + throws Exception + { + // prepare + List reactorProjects = Collections.singletonList( createProject( "artifactId", "SNAPSHOT" ) ); + + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_RELEASE_VERSIONS ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.addReleaseVersion( "groupId:artifactId", "2.0" ); + + phase.setPrompter( mockPrompter ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "2.0", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.addReleaseVersion( "groupId:artifactId", "2.0" ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "2.0", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + } + + @Test + public void testExecuteSnapshotNonInteractive_MapRelease() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_RELEASE_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "1.0" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + } + + @Test + public void testSimulateSnapshotNonInteractive_MapReleaseVersions() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_RELEASE_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "1.0" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + } + + @Test + public void testMapDevVersionsInteractive() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + MavenProject project = createProject( "artifactId", "1.0" ); + + when( mockPrompter.prompt( startsWith( "What is the new development version for \"" + project.getName() + + "\"?" ), eq( "1.1-SNAPSHOT" ) ) ).thenReturn( "2.0-SNAPSHOT" ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( project ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "2.0-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "2.0-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + + verify( mockPrompter, times( 2 ) ).prompt( startsWith( "What is the new development version for \"" + + project.getName() + "\"?" ), eq( "1.1-SNAPSHOT" ) ); + } + + /** + * MRELEASE-760: updateWorkingCopyVersions=false still bumps up pom versions to next development version + */ + @Test + public void testMapDevVersionsInteractiveDoNotUpdateWorkingCopy() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + MavenProject project = createProject( "artifactId", "1.0" ); + + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( project ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setUpdateWorkingCopyVersions( false ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "1.0", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.setUpdateWorkingCopyVersions( false ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "1.0" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testMapDevVersionsNonInteractive() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "1.1-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "1.1-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + /** + * MRELEASE-524: ignores commandline versions in batch mode + */ + @Test + public void testMapDevVersionsNonInteractiveWithExplicitVersion() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + phase.setPrompter( mockPrompter ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + builder.addDevelopmentVersion( "groupId:artifactId", "2-SNAPSHOT" ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "2-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + builder.addDevelopmentVersion( "groupId:artifactId", "2-SNAPSHOT" ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "2-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testPrompterException() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + when( mockPrompter.prompt( isA( String.class ), + isA( String.class ) ) ).thenThrow( new PrompterException( "..." ) ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Expected an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "check cause", PrompterException.class, e.getCause().getClass() ); + } + + // prepare + builder = new ReleaseDescriptorBuilder(); + + // execute + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Expected an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "check cause", PrompterException.class, e.getCause().getClass() ); + } + + // verify + verify( mockPrompter, times( 2 ) ).prompt( isA( String.class ), isA( String.class ) ); + } + + @Test + public void testAdjustVersionInteractive() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + MavenProject project = createProject( "artifactId", "foo" ); + + when( mockPrompter.prompt( startsWith( "What is the new development version for \"" + project.getName() + + "\"?" ), eq( "1.1-SNAPSHOT" ) ) ).thenReturn( "2.0-SNAPSHOT" ); + phase.setPrompter( mockPrompter ); + + List reactorProjects = Collections.singletonList( project ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "2.0-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + + // prepare + builder = new ReleaseDescriptorBuilder(); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check mapped versions", "2.0-SNAPSHOT" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + + verify( mockPrompter, times( 2 ) ).prompt( startsWith( "What is the new development version for \"" + + project.getName() + "\"?" ), eq( "1.1-SNAPSHOT" ) ); + } + + @Test + public void testAdjustVersionNonInteractive() + throws Exception + { + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "foo" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Expected an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "check cause", VersionParseException.class, e.getCause().getClass() ); + } + + builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Expected an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "check cause", VersionParseException.class, e.getCause().getClass() ); + } + } + + @Test + public void testExecuteSnapshotBranchCreation_DefaultDevelopmentVersion_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setDefaultDevelopmentVersion( "1.1.1-SNAPSHOT" ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.1.1-SNAPSHOT" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testSimulateSnapshotBranchCreation_DefaultDevelopmentVersion_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setDefaultDevelopmentVersion( "1.1.1-SNAPSHOT" ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.1.1-SNAPSHOT" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testExecuteSnapshotBranchCreation_DefaultDevelopmentVersion_NonInteractive_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setDefaultDevelopmentVersion( "1.1.1-SNAPSHOT" ); + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.1.1-SNAPSHOT" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testSimulateSnapshotBranchCreation_DefaultDevelopmentVersion_NonInteractive_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setDefaultDevelopmentVersion( "1.1.1-SNAPSHOT" ); + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.1.1-SNAPSHOT" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testExecuteSnapshotBranchCreation_NonInteractive_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.3-SNAPSHOT" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testSimulateSnapshotBranchCreation_NonInteractive_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.3-SNAPSHOT" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testExecuteSnapshotDefaultDevelopmentVersion_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setDefaultDevelopmentVersion( "1.1.1-SNAPSHOT" ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.1.1-SNAPSHOT" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testSimulateSnapshotDefaultDevelopmentVersion_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setDefaultDevelopmentVersion( "1.1.1-SNAPSHOT" ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.1.1-SNAPSHOT" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testExecuteSnapshotDefaultDevelopmentVersion_NonInteractive_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setDefaultDevelopmentVersion( "1.1.1-SNAPSHOT" ); + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.1.1-SNAPSHOT" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testSimulateSnapshotDefaultDevelopmentVersion_NonInteractive_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setDefaultDevelopmentVersion( "1.1.1-SNAPSHOT" ); + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.1.1-SNAPSHOT" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testExecuteSnapshotNonInteractive_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.3-SNAPSHOT" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testSimulateSnapshotNonInteractive_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.3-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testExecuteSnapshotAutoVersionSubmodules_NotInteractive_MapDevelopment() + throws Exception + { + // verify + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check development versions", "1.3-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + } + + @Test + public void testSimulateSnapshotAutoVersionSubmodules_NotInteractive_MapDevelopment() + throws Exception + { + // verify + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check development versions", "1.3-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + } + + @Test + public void testExecuteReleaseAutoVersionSubmodules_NotInteractive_MapDevelopment() + throws Exception + { + // verify + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check development versions", "1.3-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + } + + @Test + public void testSimulateReleaseAutoVersionSubmodules_NotInteractive_MapDevelopment() + throws Exception + { + // verify + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check development versions", "1.3-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + } + + @Test + public void testExecuteSnapshotAutoVersionSubmodules_NotInteractive_MapRelease() + throws Exception + { + // verify + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_RELEASE_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check release versions", "1.2", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId" ) ); + } + + @Test + public void testSimulateSnapshotAutoVersionSubmodules_NotInteractive_MapRelease() + throws Exception + { + // verify + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_RELEASE_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check release versions", "1.2" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId" ) ); + } + + @Test + public void testExecuteReleaseAutoVersionSubmodules_NotInteractive_MapRelease() + throws Exception + { + // verify + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_RELEASE_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check release versions", "1.2", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId" ) ); + } + + @Test + public void testSimulateReleaseAutoVersionSubmodules_NotInteractive_MapRelease() + throws Exception + { + // verify + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_RELEASE_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check release versions", "1.2", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId" ) ); + } + + @Test + public void testExecuteSnapshotAutoVersionSubmodules_BranchCreation_NotInteractive_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setBranchCreation( true ); + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check development versions", "1.3-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + } + + @Test + public void testSimulateSnapshotAutoVersionSubmodules_BranchCreation_NotInteractive_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setBranchCreation( true ); + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check development versions", "1.3-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + } + + @Test + public void testExecuteReleaseAutoVersionSubmodules_BranchCreation_NotInteractive_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setBranchCreation( true ); + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check development versions", "1.2", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + } + + @Test + public void testSimulateReleaseAutoVersionSubmodules_BranchCreation_NotInteractive_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setBranchCreation( true ); + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check development versions", "1.2", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + } + + @Test + public void testExecuteSnapshotAutoVersionSubmodules_BranchCreation_NotInteractive_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setBranchCreation( true ); + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check release versions", "1.2-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId" ) ); + } + + @Test + public void testSimulateSnapshotAutoVersionSubmodules_BranchCreation_NotInteractive_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setBranchCreation( true ); + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check release versions", "1.2-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId" ) ); + } + + @Test + public void testExecuteReleaseAutoVersionSubmodules_BranchCreation_NotInteractive_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setBranchCreation( true ); + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + /* + * "By default, the POM in the new branch keeps the same version as the local working copy, and the local POM is incremented to the next revision." + * This is true for trunk, but when branching from a tag I would expect the next SNAPSHOT version. For now keep + * '1.2' instead of '1.3-SNAPSHOT' until further investigation. + */ + assertEquals( "Check release versions", "1.2", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion( "groupId:artifactId" ) ); + } + + @Test + public void testSimulateReleaseAutoVersionSubmodules_BranchCreation_NotInteractive_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setBranchCreation( true ); + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + /* + * "By default, the POM in the new branch keeps the same version as the local working copy, and the local POM is incremented to the next revision." + * This is true for trunk, but when branching from a tag I would expect the next SNAPSHOT version. For now keep + * '1.2' instead of '1.3-SNAPSHOT' until further investigation. + */ + assertEquals( "Check release versions", "1.2" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId" ) ); + } + + @Test + public void testExecuteSnapshotBranchCreation_NonInteractive_UpdateBranchVersions_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setInteractive( false ); + builder.setUpdateBranchVersions( true ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + // updateBranchVersions is set to true, so suggest the next snapshot version + // org.apache.maven.release:maven-release-manager:(,2.4) > 1.2-SNAPSHOT + // org.apache.maven.release:maven-release-manager:[2.4,) > 1.3-SNAPSHOT + assertEquals( "Check release versions", "1.3-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion( "groupId:artifactId" ) ); + } + + @Test + public void testSimulateSnapshotBranchCreation_NonInteractive_UpdateBranchVersions_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setInteractive( false ); + builder.setUpdateBranchVersions( true ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + // updateBranchVersions is set to true, so suggest the next snapshot version + // org.apache.maven.release:maven-release-manager:(,2.4) > 1.2-SNAPSHOT + // org.apache.maven.release:maven-release-manager:[2.4,) > 1.3-SNAPSHOT + assertEquals( "Check release versions", "1.3-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion( "groupId:artifactId" ) ); + } + + @Test + public void testExecuteSnapshotBranchCreation_DefaultReleaseVersion_NonInteractive_UpdateBranchVersions_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setDefaultReleaseVersion( "2.1-SNAPSHOT" ); + builder.setInteractive( false ); + builder.setUpdateBranchVersions( true ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check release versions", "2.1-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion( "groupId:artifactId" ) ); + } + + @Test + public void testSimulateSnapshotBranchCreation_DefaultReleaseVersion_NonInteractive_UpdateBranchVersions_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setDefaultReleaseVersion( "2.1-SNAPSHOT" ); + builder.setInteractive( false ); + builder.setUpdateBranchVersions( true ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check release versions", "2.1-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion( "groupId:artifactId" ) ); + } + + @Test + public void testExecuteSnapshotBranchCreation_DefaultReleaseVersion_UpdateBranchVersions_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setDefaultReleaseVersion( "2.1-SNAPSHOT" ); + builder.setUpdateBranchVersions( true ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check release versions", "2.1-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion( "groupId:artifactId" ) ); + } + + @Test + public void testSimulateSnapshotBranchCreation_DefaultReleaseVersion_UpdateBranchVersions_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setDefaultReleaseVersion( "2.1-SNAPSHOT" ); + builder.setUpdateBranchVersions( true ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check release versions", "2.1-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion( "groupId:artifactId" ) ); + } + + @Test + public void testExecuteSnapshotBranchCreation_UpdateBranchVersions_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setUpdateBranchVersions( true ); + + // updateBranchVersions is set to true, so suggest the next snapshot version + // org.apache.maven.release:maven-release-manager:(,2.4) > 1.2-SNAPSHOT + // org.apache.maven.release:maven-release-manager:[2.4,) > 1.3-SNAPSHOT + when( mockPrompter.prompt( startsWith( "What is the branch version for" ), + eq( "1.3-SNAPSHOT" ) ) ).thenReturn( "2.0-SNAPSHOT" ); + phase.setPrompter( mockPrompter ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + // org.apache.maven.release:maven-release-manager:(,2.4) > 1.2-SNAPSHOT + // org.apache.maven.release:maven-release-manager:[2.4,) > 1.3-SNAPSHOT + verify( mockPrompter ).prompt( startsWith( "What is the branch version for" ), eq( "1.3-SNAPSHOT" ) ); + } + + @Test + public void testSimulateSnapshotBranchCreation_UpdateBranchVersions_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setUpdateBranchVersions( true ); + + // updateBranchVersions is set to true, so suggest the next snapshot version + // org.apache.maven.release:maven-release-manager:(,2.4) > 1.2-SNAPSHOT + // org.apache.maven.release:maven-release-manager:[2.4,) > 1.3-SNAPSHOT + when( mockPrompter.prompt( startsWith( "What is the branch version for" ), + eq( "1.3-SNAPSHOT" ) ) ).thenReturn( "2.0-SNAPSHOT" ); + phase.setPrompter( mockPrompter ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + // org.apache.maven.release:maven-release-manager:(,2.4) > 1.2-SNAPSHOT + // org.apache.maven.release:maven-release-manager:[2.4,) > 1.3-SNAPSHOT + verify( mockPrompter ).prompt( startsWith( "What is the branch version for" ), eq( "1.3-SNAPSHOT" ) ); + } + + @Test + public void testExecuteReleaseBranchCreation_UpdateBranchVersions_UpdateVersionsToSnapshot_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setUpdateBranchVersions( true ); + builder.setUpdateVersionsToSnapshot( true ); + + // updateBranchVersions is set to true, so suggest the next snapshot version + // org.apache.maven.release:maven-release-manager:(,2.4) > 1.2-SNAPSHOT (yes, one step back!) + // org.apache.maven.release:maven-release-manager:[2.4,) > 1.3-SNAPSHOT + when( mockPrompter.prompt( startsWith( "What is the branch version for" ), + eq( "1.3-SNAPSHOT" ) ) ).thenReturn( "2.1-SNAPSHOT" ); + phase.setPrompter( mockPrompter ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + // org.apache.maven.release:maven-release-manager:(,2.4) > 1.2-SNAPSHOT (yes, one step back!) + // org.apache.maven.release:maven-release-manager:[2.4,) > 1.3-SNAPSHOT + verify( mockPrompter ).prompt( startsWith( "What is the branch version for" ), eq( "1.3-SNAPSHOT" ) ); + assertEquals( "Check release versions", "2.1-SNAPSHOT" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId" ) ); + } + + @Test + public void testSimulateReleaseBranchCreation_UpdateBranchVersions_UpdateVersionsToSnapshot_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setUpdateBranchVersions( true ); + builder.setUpdateVersionsToSnapshot( true ); + + // updateBranchVersions is set to true, so suggest the next snapshot version + // org.apache.maven.release:maven-release-manager:(,2.4) > 1.2-SNAPSHOT (yes, one step back!) + // org.apache.maven.release:maven-release-manager:[2.4,) > 1.3-SNAPSHOT + when( mockPrompter.prompt( startsWith( "What is the branch version for" ), + eq( "1.3-SNAPSHOT" ) ) ).thenReturn( "2.1-SNAPSHOT" ); + phase.setPrompter( mockPrompter ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + // org.apache.maven.release:maven-release-manager:(,2.4) > 1.2-SNAPSHOT (yes, one step back!) + // org.apache.maven.release:maven-release-manager:[2.4,) > 1.3-SNAPSHOT + verify( mockPrompter ).prompt( startsWith( "What is the branch version for" ), eq( "1.3-SNAPSHOT" ) ); + assertEquals( "Check release versions", "2.1-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId" ) ); + } + + @Test + public void testExecuteSnapshotBranchCreation_UpdateBranchVersions_UpdateVersionsToSnapshot_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setUpdateBranchVersions( true ); + builder.setUpdateVersionsToSnapshot( true ); + + // updateBranchVersions is set to true, so suggest the next snapshot version + // org.apache.maven.release:maven-release-manager:(,2.4) > 1.2-SNAPSHOT + // org.apache.maven.release:maven-release-manager:[2.4,) > 1.3-SNAPSHOT + when( mockPrompter.prompt( startsWith( "What is the branch version for" ), + eq( "1.3-SNAPSHOT" ) ) ).thenReturn( "2.0-SNAPSHOT" ); + phase.setPrompter( mockPrompter ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + // org.apache.maven.release:maven-release-manager:(,2.4) > 1.2-SNAPSHOT + // org.apache.maven.release:maven-release-manager:[2.4,) > 1.3-SNAPSHOT + verify( mockPrompter ).prompt( startsWith( "What is the branch version for" ), eq( "1.3-SNAPSHOT" ) ); + } + + @Test + public void testSimulateSnapshotBranchCreation_UpdateBranchVersions_UpdateVersionsToSnapshot_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setUpdateBranchVersions( true ); + builder.setUpdateVersionsToSnapshot( true ); + + // updateBranchVersions is set to true, so suggest the next snapshot version + // org.apache.maven.release:maven-release-manager:(,2.4) > 1.2-SNAPSHOT + // org.apache.maven.release:maven-release-manager:[2.4,) > 1.3-SNAPSHOT + when( mockPrompter.prompt( startsWith( "What is the branch version for" ), + eq( "1.3-SNAPSHOT" ) ) ).thenReturn( "2.0-SNAPSHOT" ); + phase.setPrompter( mockPrompter ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + // org.apache.maven.release:maven-release-manager:(,2.4) > 1.2-SNAPSHOT + // org.apache.maven.release:maven-release-manager:[2.4,) > 1.3-SNAPSHOT + verify( mockPrompter ).prompt( startsWith( "What is the branch version for" ), eq( "1.3-SNAPSHOT" ) ); + } + + @Test + public void testExecuteReleaseBranchCreation_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + /* + * "By default, the POM in the new branch keeps the same version as the local working copy, and the local POM is incremented to the next revision." + * This is true for trunk, but when branching from a tag I would expect the next SNAPSHOT version. For now keep + * '1.2' instead of '1.3-SNAPSHOT' until further investigation. + */ + assertEquals( "Check release versions", "1.2", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion( "groupId:artifactId" ) ); + } + + @Test + public void testSimulateReleaseBranchCreation_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + /* + * "By default, the POM in the new branch keeps the same version as the local working copy, and the local POM is incremented to the next revision." + * This is true for trunk, but when branching from a tag I would expect the next SNAPSHOT version. For now keep + * '1.2' instead of '1.3-SNAPSHOT' until further investigation. + */ + assertEquals( "Check release versions", "1.2", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId" ) ); + } + + @Test + public void testExecuteReleaseBranchCreation_NonUpdateWorkingCopyVersions_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setUpdateWorkingCopyVersions( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.2", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testSimulateReleaseBranchCreation_NonUpdateWorkingCopyVersions_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setUpdateWorkingCopyVersions( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.2" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testExecuteReleaseBranchCreation_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + // org.apache.maven.release:maven-release-manager:(,2.4) > true + // org.apache.maven.release:maven-release-manager:[2.4,) > false + builder.setInteractive( false ); + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.2" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testSimulateReleaseBranchCreation_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + // org.apache.maven.release:maven-release-manager:(,2.4) > true + // org.apache.maven.release:maven-release-manager:[2.4,) > false + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.2", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testExecuteSnapshotBranchCreation_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check release versions", "1.2-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion( "groupId:artifactId" ) ); + } + + @Test + public void testSimulateSnapshotBranchCreation_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check release versions", "1.2-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion( "groupId:artifactId" ) ); + } + + @Test + public void testExecuteSnapshotBranchCreation_NonUpdateWorkingCopyVersions_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setUpdateWorkingCopyVersions( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.2-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId" ) ); + } + + @Test + public void testSimulateSnapshotBranchCreation_NonUpdateWorkingCopyVersions_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setUpdateWorkingCopyVersions( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + assertEquals( "Check development versions", "1.2-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + } + + @Test + public void testExecuteReleaseBranchCreation_UpdateBranchVersions_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setUpdateBranchVersions( true ); + // org.apache.maven.release:maven-release-manager:(,2.4) > true + // org.apache.maven.release:maven-release-manager:[2.4,) > false + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check release versions", "1.2", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId" ) ); + } + + @Test + public void testSimulateReleaseBranchCreation_UpdateBranchVersions_MapBranch() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setUpdateBranchVersions( true ); + // org.apache.maven.release:maven-release-manager:(,2.4) > true + // org.apache.maven.release:maven-release-manager:[2.4,) > false + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check release versions", "1.2" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check development versions", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId" ) ); + } + + @Test + public void testExecuteSnapshotBranchCreation_UpdateWorkingCopyVersions_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setUpdateWorkingCopyVersions( true ); + + when( mockPrompter.prompt( startsWith( "What is the new working copy version for" ), + eq( "1.3-SNAPSHOT" ) ) ).thenReturn( "2.0-SNAPSHOT" ); + phase.setPrompter( mockPrompter ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( mockPrompter ).prompt( startsWith( "What is the new working copy version for" ), eq( "1.3-SNAPSHOT" ) ); + } + + @Test + public void testSimulateSnapshotBranchCreation_UpdateWorkingCopyVersions_MapDevelopment() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setBranchCreation( true ); + builder.setUpdateWorkingCopyVersions( true ); + + when( mockPrompter.prompt( startsWith( "What is the new working copy version for" ), + eq( "1.3-SNAPSHOT" ) ) ).thenReturn( "2.0-SNAPSHOT" ); + phase.setPrompter( mockPrompter ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( mockPrompter ).prompt( startsWith( "What is the new working copy version for" ), eq( "1.3-SNAPSHOT" ) ); + } + + @Test + public void testExecuteMultiModuleAutoVersionSubmodules__MapDevelopment() + throws Exception + { + // verify + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = new ArrayList<>(); + Collections.addAll( reactorProjects, createProject( "artifactId", "1.2-SNAPSHOT" ), + createProject( "module1", "2.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check development versions", "1.3-SNAPSHOT", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + assertEquals( "Check development versions", "2.0" , ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:module1") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:module1") ); + } + + @Test + public void testSimulateMultiModuleAutoVersionSubmodules__MapDevelopment() + throws Exception + { + // verify + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = new ArrayList<>(); + Collections.addAll( reactorProjects, createProject( "artifactId", "1.2-SNAPSHOT" ), + createProject( "module1", "2.0" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check development versions", "1.3-SNAPSHOT", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion( "groupId:artifactId" ) ); + assertEquals( "Check development versions", "2.0", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:module1") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:module1") ); + } + + @Test + public void testExecuteSnapshotAutoVersionSubmodules_DefaultReleaseVersion_NonInteractive_MapDevelopment() + throws Exception + { + // verify + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = + Collections.singletonList( createProject( "artifactId", "1.2.1-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setDefaultReleaseVersion( "3.0" ); + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check development versions", "3.1-SNAPSHOT" , + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion("groupId:artifactId" ) ); + } + + @Test + public void testSimulateSnapshotAutoVersionSubmodules_DefaultReleaseVersion_NonInteractive_MapDevelopment() + throws Exception + { + // verify + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = + Collections.singletonList( createProject( "artifactId", "1.2.1-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setDefaultReleaseVersion( "3.0" ); + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check development versions", "3.1-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + } + + @Test + public void testExecuteSnapshotAutoVersionSubmodules_DefaultDevelopmentVersion_NonInteractive_MapDevelopment() + throws Exception + { + // verify + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = + Collections.singletonList( createProject( "artifactId", "1.2.1-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setDefaultDevelopmentVersion( "3.0-SNAPSHOT" ); + builder.setInteractive( false ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check development versions", "3.0-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + } + + @Test + public void testSimulateSnapshotAutoVersionSubmodules_DefaultDevelopmentVersion_NonInteractive_MapDevelopment() + throws Exception + { + // verify + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = + Collections.singletonList( createProject( "artifactId", "1.2.1-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setAutoVersionSubmodules( true ); + builder.setDefaultDevelopmentVersion( "3.0-SNAPSHOT" ); + builder.setInteractive( false ); + + // test + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check development versions", "3.0-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + assertNull( "Check release versions", ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + } + + // MRELEASE-511 + @Test + public void testUnusualVersions1() + throws Exception + { + MapVersionsPhase mapReleasephase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_RELEASE_VERSIONS ); + MapVersionsPhase mapDevelopmentphase = + (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = + Collections.singletonList( createProject( "artifactId", "MYB_200909-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setDefaultReleaseVersion( "PPX" ); + builder.setDefaultDevelopmentVersion( "MYB_200909-SNAPSHOT" ); + + // test + mapReleasephase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + mapDevelopmentphase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + assertEquals( "Check development versions", + "MYB_200909-SNAPSHOT", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectDevelopmentVersion("groupId:artifactId") ); + assertEquals( "Check release versions", "PPX", + ReleaseUtils.buildReleaseDescriptor( builder ).getProjectReleaseVersion( "groupId:artifactId" ) ); + } + + // MRELEASE-269 + @Test + public void testContinuousSnapshotCheck() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "bar", "1.11-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + + when( mockPrompter.prompt( startsWith( "What is the new development version for " ), + eq( "1.12-SNAPSHOT" ) ) ).thenReturn( "2.0" ) // wrong, expected SNAPSHOT + .thenReturn( "2.0-SNAPSHOT" ); + phase.setPrompter( mockPrompter ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( mockPrompter, times( 2 ) ).prompt( startsWith( "What is the new development version for " ), + eq( "1.12-SNAPSHOT" ) ); + } + + // MRELEASE-734 + @Test + public void testEmptyDefaultDevelopmentVersion() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "bar", "1.11-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setDefaultDevelopmentVersion( "" ); + + when( mockPrompter.prompt( startsWith( "What is the new development version for " ), + eq( "1.12-SNAPSHOT" ) ) ).thenReturn( "2.0-SNAPSHOT" ); + phase.setPrompter( mockPrompter ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( mockPrompter ).prompt( startsWith( "What is the new development version for " ), + eq( "1.12-SNAPSHOT" ) ); + } + + @Test + public void testEmptyDefaultReleaseVersion() + throws Exception + { + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_RELEASE_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "bar", "1.11-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setDefaultReleaseVersion( "" ); + + when( mockPrompter.prompt( startsWith( "What is the release version for " ), + eq( "1.11" ) ) ).thenReturn( "2.0" ); + phase.setPrompter( mockPrompter ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( mockPrompter ).prompt( startsWith( "What is the release version for " ), eq( "1.11" ) ); + } + + /** + * MRELEASE-975: Test that a PolicyException is thrown when using an unknown policy version hint. + * @throws Exception + */ + @Test + public void testNonExistentVersionPolicy() + throws Exception + { + expectedException.expect( ReleaseExecutionException.class ); + expectedException.expectCause( CoreMatchers.isA( PolicyException.class ) ); + + // prepare + MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_RELEASE_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "artifactId", "1.0-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setProjectVersionPolicyId( "UNKNOWN" ); + + // test + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + } + + @Test + public void testUpdateBranchInvalidDefaultReleaseVersion_NonInteractive() + throws Exception + { + // prepare + ReleasePhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_BRANCH_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "bar", "1.11-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setDefaultReleaseVersion( "3.0" ); + builder.setInteractive( false ); + builder.setUpdateBranchVersions( true ); + + // test + try { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + fail( "Should fail due to invalid version" ); + } + catch( ReleaseExecutionException e ) + { + assertEquals( "3.0 is invalid, expected a snapshot", e.getMessage() ); + } + } + + @Test + public void testUpdateReleaseInvalidDefaultReleaseVersion_NonInteractive() + throws Exception + { + // prepare + ReleasePhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_RELEASE_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "bar", "1.11-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setDefaultReleaseVersion( "3.0-SNAPSHOT" ); + builder.setInteractive( false ); + + // test + try { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + fail( "Should fail due to invalid version" ); + } + catch( ReleaseExecutionException e ) + { + assertEquals( "3.0-SNAPSHOT is invalid, expected a non-snapshot", e.getMessage() ); + } + } + + @Test + public void testUpdateDevelopmentInvalidDefaultDevelopmentVersion_NonInteractive() + throws Exception + { + // prepare + ReleasePhase phase = (MapVersionsPhase) lookup( ReleasePhase.class, TEST_MAP_DEVELOPMENT_VERSIONS ); + + List reactorProjects = Collections.singletonList( createProject( "bar", "1.11-SNAPSHOT" ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setDefaultDevelopmentVersion( "3.0" ); + builder.setInteractive( false ); + + // test + try { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + fail( "Should fail due to invalid version" ); + } + catch( ReleaseExecutionException e ) + { + assertEquals( "3.0 is invalid, expected a snapshot", e.getMessage() ); + } + } + + private static MavenProject createProject( String artifactId, String version ) + { + Model model = new Model(); + model.setGroupId( "groupId" ); + model.setArtifactId( artifactId ); + model.setVersion( version ); + return new MavenProject( model ); + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ReleasePhaseStub.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ReleasePhaseStub.java new file mode 100644 index 000000000..7d28bdf4a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ReleasePhaseStub.java @@ -0,0 +1,102 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptor; +import org.apache.maven.shared.release.env.ReleaseEnvironment; + +import java.util.List; + +/** + * Test stub for testing if a phase is executed. + * + * @author Brett Porter + */ +public class ReleasePhaseStub + implements ReleasePhase, ResourceGenerator +{ + /** + * Whether the phase was simulated. + */ + private boolean simulated; + + /** + * Whether the phase was executed. + */ + private boolean executed; + + /** + * Whether the phase was cleaned. + */ + private boolean cleaned; + + @Override + public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, List reactorProjects ) + { + ReleaseResult result = new ReleaseResult(); + + executed = true; + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + @Override + public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, List reactorProjects ) + { + ReleaseResult result = new ReleaseResult(); + + simulated = true; + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + @Override + public ReleaseResult clean( List reactorProjects ) + { + ReleaseResult result = new ReleaseResult(); + + cleaned = true; + + result.setResultCode( ReleaseResult.SUCCESS ); + + return result; + } + + public boolean isExecuted() + { + return executed; + } + + public boolean isSimulated() + { + return simulated; + } + + public boolean isCleaned() + { + return cleaned; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RemoveReleasePomsPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RemoveReleasePomsPhaseTest.java new file mode 100644 index 000000000..ce8396089 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RemoveReleasePomsPhaseTest.java @@ -0,0 +1,253 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.argThat; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.io.BufferedReader; +import java.io.File; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmFileStatus; +import org.apache.maven.scm.command.remove.RemoveScmResult; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.manager.ScmManagerStub; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.util.IOUtil; +import org.junit.Test; + +/** + * Test the remove release POMs phase. + * + * @author Mark Hobson + */ +public class RemoveReleasePomsPhaseTest + extends AbstractReleaseTestCase +{ + @Override + public void setUp() + throws Exception + { + super.setUp(); + + phase = lookup( ReleasePhase.class, "remove-release-poms" ); + } + + @Test + public void testExecuteBasicPom() + throws Exception + { + // prepare + File workingDirectory = getTestFile( "target/test/checkout" ); + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( workingDirectory ); + MavenProject project = ReleaseUtil.getRootProject( reactorProjects ); + + File releasePom = ReleaseUtil.getReleasePom( project ); + ScmFileSet fileSet = new ScmFileSet( workingDirectory, releasePom ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.remove( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isA( String.class ) ) ).thenReturn( new RemoveScmResult( "...", + Collections.singletonList( new ScmFile( "pom.xml", + ScmFileStatus.DELETED ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).remove( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isA( String.class ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testExecutePomWithModules() + throws Exception + { + // prepare + File workingDirectory = getTestFile( "target/test/checkout" ); + List reactorProjects = createReactorProjects( "pom-with-modules" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + List releasePoms = new ArrayList<>(); + for ( Iterator iterator = reactorProjects.iterator(); iterator.hasNext(); ) + { + MavenProject project = iterator.next(); + File releasePom = ReleaseUtil.getReleasePom( project ); + releasePoms.add( releasePom ); + } + + ScmFileSet fileSet = new ScmFileSet( workingDirectory, releasePoms ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.remove( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isA( String.class ) ) ).thenReturn( new RemoveScmResult( "...", + Collections.singletonList( new ScmFile( "pom.xml", + ScmFileStatus.DELETED ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).remove( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isA( String.class ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testSimulateBasicPom() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // never invoke scmProviderMock + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testExecuteWithSuppressCommitBeforeTag() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + builder.setSuppressCommitBeforeTagOrBranch( true ); + builder.setGenerateReleasePoms( true ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + ReleaseResult result = phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + BufferedReader reader = null; + try + { + reader = new BufferedReader( new StringReader( result.getOutput() ) ); + + assertEquals( "[INFO] Removing release POM for 'artifactId'...", + reader.readLine() ); + assertEquals( "Expected EOF", null, reader.readLine() ); + } + finally + { + IOUtil.close( reader ); + } + + // never invoke scmProviderMock + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testSimulateWithSuppressCommitBeforeTag() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + builder.setSuppressCommitBeforeTagOrBranch( true ); + builder.setGenerateReleasePoms( true ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + ReleaseResult result = phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + BufferedReader reader = null; + try + { + reader = new BufferedReader( new StringReader( result.getOutput() ) ); + + assertEquals( "[INFO] Removing release POM for 'artifactId'...", + reader.readLine() ); + assertEquals( "[INFO] Full run would be removing [" + reactorProjects.get( 0 ).getFile().getParent() + + File.separator + "release-pom.xml]", reader.readLine() ); + assertEquals( "Expected EOF", null, reader.readLine() ); + } + finally + { + IOUtil.close( reader ); + } + + // never invoke scmProviderMock + verifyNoMoreInteractions( scmProviderMock ); + } + + protected List createReactorProjects( String path ) + throws Exception + { + String dir = "remove-release-poms/" + path; + return createReactorProjects( dir, dir, null ); + } + + private ReleaseDescriptorBuilder createReleaseDescriptorBuilder() + { + return createReleaseDescriptorBuilder( getTestFile( "target/test/checkout" ) ); + } + + private ReleaseDescriptorBuilder createReleaseDescriptorBuilder( File workingDirectory ) + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setGenerateReleasePoms( true ); + builder.setWorkingDirectory( workingDirectory.getAbsolutePath() ); + return builder; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RemoveScmTagPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RemoveScmTagPhaseTest.java new file mode 100644 index 000000000..e4dab0ca9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RemoveScmTagPhaseTest.java @@ -0,0 +1,246 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.CommandParameters; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.command.untag.UntagScmResult; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.stubs.ScmManagerStub; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.Matchers; +import org.mockito.Mockito; + +/** + * Test the remove SCM tag phase. + */ +public class RemoveScmTagPhaseTest extends AbstractReleaseTestCase +{ + + @Override + public void setUp() throws Exception + { + + super.setUp(); + + phase = ( ReleasePhase ) lookup( ReleasePhase.class, "remove-scm-tag" ); + + } + + @Test + public void testExecuteOutput() throws Exception + { + + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmReleaseLabel( "release-label" ); + builder.setScmSourceUrl( "scm-url" ); + List reactorProjects = createReactorProjects(); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( getPath( rootProject.getFile().getParentFile() ) ); + builder.setPomFileName( rootProject.getFile().getName() ); + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile() ); + + // mock, only real matcher is the file set + ScmProvider scmProviderMock = Mockito.mock( ScmProvider.class ); + Mockito.when( scmProviderMock.untag( Matchers.isA( ScmRepository.class ), + Matchers.argThat( new IsScmFileSetEquals( fileSet ) ), + Matchers.isA( CommandParameters.class ) ) ) + .thenReturn( new UntagScmResult( "...", "...", "...", true ) ); + ScmManagerStub stub = ( ScmManagerStub ) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + ReleaseResult actual = phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), + new DefaultReleaseEnvironment(), reactorProjects ); + + // verify, actual contains trailing newline + Assert.assertEquals( "[INFO] Removing tag with the label release-label ...", actual.getOutput().trim() ); + + } + + @Test + public void testExecuteResultCode() throws Exception + { + + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmReleaseLabel( "release-label" ); + builder.setScmSourceUrl( "scm-url" ); + List reactorProjects = createReactorProjects(); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( getPath( rootProject.getFile().getParentFile() ) ); + builder.setPomFileName( rootProject.getFile().getName() ); + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile() ); + + // mock, only real matcher is the file set + ScmProvider scmProviderMock = Mockito.mock( ScmProvider.class ); + Mockito.when( scmProviderMock.untag( Matchers.isA( ScmRepository.class ), + Matchers.argThat( new IsScmFileSetEquals( fileSet ) ), + Matchers.isA( CommandParameters.class ) ) ) + .thenReturn( new UntagScmResult( "...", "...", "...", true ) ); + ScmManagerStub stub = ( ScmManagerStub ) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + ReleaseResult actual = phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), + new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + Assert.assertEquals( 0, actual.getResultCode() ); + + } + + @Rule + public ExpectedException exceptionRule = ExpectedException.none(); + + @Test + @Ignore( "We changed the behaviour to warning instead of error." ) + public void testExecuteError() throws Exception + { + + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmReleaseLabel( "release-label" ); + builder.setScmSourceUrl( "scm-url" ); + List reactorProjects = createReactorProjects(); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( getPath( rootProject.getFile().getParentFile() ) ); + builder.setPomFileName( rootProject.getFile().getName() ); + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile() ); + + // mock, only real matcher is the file set + ScmProvider scmProviderMock = Mockito.mock( ScmProvider.class ); + Mockito.when( scmProviderMock.untag( Matchers.isA( ScmRepository.class ), + Matchers.argThat( new IsScmFileSetEquals( fileSet ) ), + Matchers.isA( CommandParameters.class ) ) ) + .thenReturn( new UntagScmResult( "command-line", "provider-message", "command-output", false ) ); + ScmManagerStub stub = ( ScmManagerStub ) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // set up exception rule + exceptionRule.expect( ReleaseScmCommandException.class ); + exceptionRule.expectMessage( + "Unable to remove tag \nProvider message:\nprovider-message\nCommand output:\ncommand-output" ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), + new DefaultReleaseEnvironment(), reactorProjects ); + + } + + @Test + public void testExecuteNoError() throws Exception + { + + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmReleaseLabel( "release-label" ); + builder.setScmSourceUrl( "scm-url" ); + List reactorProjects = createReactorProjects(); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( getPath( rootProject.getFile().getParentFile() ) ); + builder.setPomFileName( rootProject.getFile().getName() ); + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile() ); + + // mock, only real matcher is the file set + ScmProvider scmProviderMock = Mockito.mock( ScmProvider.class ); + Mockito.when( scmProviderMock.untag( Matchers.isA( ScmRepository.class ), + Matchers.argThat( new IsScmFileSetEquals( fileSet ) ), + Matchers.isA( CommandParameters.class ) ) ) + .thenReturn( new UntagScmResult( "command-line", "provider-message", "command-output", false ) ); + ScmManagerStub stub = ( ScmManagerStub ) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + ReleaseResult actual = phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), + new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + Assert.assertEquals( 0, actual.getResultCode() ); + + + } + + @Test + public void testSimulateOutput() throws Exception + { + + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmReleaseLabel( "release-label" ); + builder.setScmSourceUrl( "scm-url" ); + List reactorProjects = createReactorProjects(); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( getPath( rootProject.getFile().getParentFile() ) ); + builder.setPomFileName( rootProject.getFile().getName() ); + + // execute + ReleaseResult actual = phase.simulate(ReleaseUtils.buildReleaseDescriptor( builder ), + new DefaultReleaseEnvironment(), reactorProjects ); + + // verify, actual contains newline + Assert.assertEquals( "[INFO] Full run would remove tag with label: 'release-label'", + actual.getOutput().trim() ); + + } + + @Test + public void testSimulateResultCode() throws Exception + { + + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmReleaseLabel( "release-label" ); + builder.setScmSourceUrl( "scm-url" ); + List reactorProjects = createReactorProjects(); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( getPath( rootProject.getFile().getParentFile() ) ); + builder.setPomFileName( rootProject.getFile().getName() ); + + // execute + ReleaseResult actual = phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), + new DefaultReleaseEnvironment(), reactorProjects ); + + Assert.assertEquals( 0, actual.getResultCode() ); + + } + + private List createReactorProjects() throws Exception + { + return createReactorProjects( "scm-commit/single-pom", "" ); + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RestoreBackupPomsPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RestoreBackupPomsPhaseTest.java new file mode 100644 index 000000000..dacb66a67 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RestoreBackupPomsPhaseTest.java @@ -0,0 +1,112 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.util.FileUtils; +import org.junit.Test; + +/** + * @author Edwin Punzalan + */ +public class RestoreBackupPomsPhaseTest + extends AbstractBackupPomsPhaseTest +{ + private String expectedPomFilename = "expected-pom.xml"; + + @Override + ReleasePhase getReleasePhase() + throws Exception + { + return lookup( ReleasePhase.class, "restore-backup-poms" ); + } + + @Test + public void testBasicPom() + throws Exception + { + String projectPath = "/projects/restore-backup-poms/basic-pom"; + + // copy poms so tests are valid without clean + File sourceDir = getTestFile( "src/test/resources" + projectPath ); + File testDir = getTestFile( "target/test-classes" + projectPath ); + FileUtils.copyDirectoryStructure( sourceDir, testDir ); + + String testPath = "target/test-classes" + projectPath; + + runExecuteOnProjects( testPath ); + } + + @Test + public void testMultiModulePom() + throws Exception + { + String projectPath = "/projects/restore-backup-poms/pom-with-modules"; + + // copy poms so tests are valid without clean + File sourceDir = getTestFile( "src/test/resources" + projectPath ); + File testDir = getTestFile( "target/test-classes" + projectPath ); + FileUtils.copyDirectoryStructure( sourceDir, testDir ); + + String testPath = "target/test-classes" + projectPath; + + runExecuteOnProjects( testPath ); + } + + private void runExecuteOnProjects( String path ) + throws Exception + { + List projects = getReactorProjects( getTestPath( path ) ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm:svn:http://myhost/myrepo" ); + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), projects ); + + testProjectIsRestored( projects ); + } + + private void testProjectIsRestored( List reactorProjects ) + throws Exception + { + for ( MavenProject project : reactorProjects ) + { + File pomFile = project.getFile(); + + File expectedFile = new File( pomFile.getParentFile(), expectedPomFilename ); + + assertTrue( "Check if expected file exists.", expectedFile.exists() ); + + String pomContents = ReleaseUtil.readXmlFile( pomFile ); + + String expectedContents = ReleaseUtil.readXmlFile( expectedFile ); + + assertTrue( "Check if pom and backup files are identical", pomContents.equals( expectedContents ) ); + } + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhaseTest.java new file mode 100644 index 000000000..49642affa --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhaseTest.java @@ -0,0 +1,476 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.util.List; +import java.util.Objects; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.junit.Test; + +/** + * Test the SCM modification check phase. + * + * @author Brett Porter + */ +public class RewritePomsForBranchPhaseTest + extends AbstractEditModeRewritingReleasePhaseTestCase +{ + private static final String NEXT_VERSION = "1.0-SNAPSHOT"; + + private static final String ALTERNATIVE_NEXT_VERSION = "2.0-SNAPSHOT"; + + public RewritePomsForBranchPhaseTest( String modelETL ) + { + super( modelETL ); + } + + @Override + protected String getRoleHint() + { + return "rewrite-poms-for-branch"; + } + + @Override + protected Path getWorkingDirectory( String workingDir ) + { + return super.getWorkingDirectory( "rewrite-for-branch/" + workingDir ); + } + + @Override + protected List prepareReactorProjects( String path ) + throws Exception + { + String dir = "rewrite-for-branch/" + Objects.toString( path, "" ); + return createReactorProjects( dir, path, null ); + } + + @Override + protected String readTestProjectFile( String fileName ) + throws IOException + { + return ReleaseUtil.readXmlFile( getTestFile( "target/test-classes/projects/rewrite-for-branch/" + fileName ) ); + } + + @Test + public void testSimulateRewrite() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom" ); + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + + String expected = readTestProjectFile( "basic-pom/pom.xml" ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + String actual = readTestProjectFile( "basic-pom/pom.xml" ); + assertEquals( "Check the original POM untouched", expected, actual ); + + expected = readTestProjectFile( "basic-pom/expected-pom.xml" ); + actual = readTestProjectFile( "basic-pom/pom.xml.branch" ); + assertEquals( "Check the transformed POM", expected, actual ); + } + + @Test + public void testRewriteWithDashedComments() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom-with-dashes-in-comment" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom-with-dashes-in-comment" ); + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + + String expected = readTestProjectFile( "basic-pom-with-dashes-in-comment/pom.xml" ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + String actual = readTestProjectFile( "basic-pom-with-dashes-in-comment/pom.xml" ); + assertEquals( "Check the original POM is untouched", expected, actual ); + + expected = readTestProjectFile( "basic-pom-with-dashes-in-comment/expected-pom.xml" ); + actual = readTestProjectFile( "basic-pom-with-dashes-in-comment/pom.xml.branch" ); + assertEquals( "Check the transformed POM", expected, actual ); + } + + @Test + public void testClean() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom" ); + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + + File testFile = getTestFile( "target/test-classes/projects/rewrite-for-branch/basic-pom/pom.xml.branch" ); + testFile.delete(); + assertFalse( testFile.exists() ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( testFile.exists() ); + + ( (ResourceGenerator) phase ).clean( reactorProjects ); + + assertFalse( testFile.exists() ); + } + + @Test + public void testCleanNotExists() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom" ); + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + + File testFile = getTestFile( "target/test-classes/projects/rewrite-for-branch/basic-pom/pom.xml.branch" ); + testFile.delete(); + assertFalse( testFile.exists() ); + + ( (ResourceGenerator) phase ).clean( reactorProjects ); + + assertFalse( testFile.exists() ); + } + + // MRELEASE-116 + @Test + public void testScmOverridden() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-with-overridden-scm" ); + ReleaseDescriptorBuilder builder = createConfigurationForWithParentNextVersion( reactorProjects, "pom-with-overridden-scm" ); + builder.addReleaseVersion( "groupId:subsubproject", NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Override + protected void mapAlternateNextVersion( ReleaseDescriptorBuilder config, String projectId ) + { + config.addReleaseVersion( projectId, ALTERNATIVE_NEXT_VERSION ); + } + + @Override + protected void mapNextVersion( ReleaseDescriptorBuilder config, String projectId ) + { + config.addReleaseVersion( projectId, NEXT_VERSION ); + } + + @Override + protected ReleaseDescriptorBuilder createConfigurationForPomWithParentAlternateNextVersion( List reactorProjects, String workingDirectory ) + throws Exception + { + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, workingDirectory ); + + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", ALTERNATIVE_NEXT_VERSION ); + return builder; + } + + @Override + protected ReleaseDescriptorBuilder createConfigurationForWithParentNextVersion( List reactorProjects, String workingDirectory ) + throws Exception + { + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, workingDirectory ); + + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", NEXT_VERSION ); + return builder; + } + + @Override + protected void unmapNextVersion( ReleaseDescriptorBuilder config, String projectId ) + { + // nothing to do + } + + @Test + public void testRewriteBasicPomWithCvs() + throws Exception + { + + List reactorProjects = createReactorProjects( "basic-pom-with-cvs" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-cvs" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomWithScmExpression() + throws Exception + { + + List reactorProjects = createReactorProjects( "basic-pom-with-scm-expression" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-scm-expression" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomWithTagBase() + throws Exception + { + + List reactorProjects = createReactorProjects( "basic-pom-with-tag-base" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-tag-base" ); + builder.setScmBranchBase( "file://localhost/tmp/scm-repo/branches" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomWithTagBaseAndVaryingScmUrls() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom-with-tag-base-and-varying-scm-urls" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-tag-base-and-varying-scm-urls" ); + builder.setScmBranchBase( "file://localhost/tmp/scm-repo/allprojects/branches" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomWithCvsFromTag() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom-with-cvs-from-tag" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-cvs-from-tag" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomWithEmptyScm() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom-with-empty-scm" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-empty-scm" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteInterpolatedVersions() + throws Exception + { + List reactorProjects = createReactorProjects( "interpolated-versions" ); + ReleaseDescriptorBuilder builder = createMappedConfiguration( reactorProjects, "interpolated-versions" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteInterpolatedVersionsDifferentVersion() + throws Exception + { + List reactorProjects = createReactorProjects( "interpolated-versions" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "interpolated-versions" ); + + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", ALTERNATIVE_NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject2", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject3", NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + for ( MavenProject project : reactorProjects ) + { + // skip subproject1 - we don't need to worry about its version mapping change, it has no deps of any kind + if ( !"groupId".equals( project.getGroupId() ) || !"subproject1".equals( project.getArtifactId() ) ) + { + comparePomFiles( project, "-different-version", true ); + } + } + } + + @Test + public void testRewriteBasicPomWithInheritedScm() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom-inherited-scm" ); + ReleaseDescriptorBuilder builder = createConfigurationForWithParentNextVersion( reactorProjects, "basic-pom-inherited-scm" ); + builder.addReleaseVersion( "groupId:subsubproject", NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomWithParentAndProperties() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-with-parent-and-properties" ); + + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "pom-with-parent-and-properties" ); + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", ALTERNATIVE_NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject2", ALTERNATIVE_NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + // MRELEASE-311 + @Test + public void testRewritePomWithDependencyPropertyCoordinate() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-with-property-dependency-coordinate" ); + + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "pom-with-property-dependency-coordinate" ); + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1-3.4", ALTERNATIVE_NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject2", ALTERNATIVE_NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + // MRELEASE-305 + @Test + public void testRewritePomWithScmOfParentEndingWithASlash() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-with-scm-of-parent-ending-with-a-slash" ); + + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "pom-with-scm-of-parent-ending-with-a-slash" ); + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", ALTERNATIVE_NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomWithDeepSubprojects() + throws Exception + { + List reactorProjects = createReactorProjects( "multimodule-with-deep-subprojects" ); + + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "multimodule-with-deep-subprojects" ); + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", ALTERNATIVE_NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject2", ALTERNATIVE_NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomForFlatMultiModule() + throws Exception + { + List reactorProjects = + createReactorProjects( "rewrite-for-branch/pom-with-parent-flat", "pom-with-parent-flat", "root-project" ); + ReleaseDescriptorBuilder builder = + createConfigurationForPomWithParentAlternateNextVersion( reactorProjects, "pom-with-parent-flat" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + // MRELEASE-383 + @Test + public void testRewritePomWithCDATASectionOnWindows() + throws Exception + { + List reactorProjects = createReactorProjects( "cdata-section" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "cdata-section" ); + mapNextVersion( builder, "groupId:artifactId" ); + + AbstractRewritePomsPhase phase = (AbstractRewritePomsPhase) this.phase; + phase.setLs( "\r\n" ); + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // compare POMS without line ending normalization + assertTrue( comparePomFiles( reactorProjects, false ) ); + } + + protected ReleaseDescriptorBuilder createDescriptorFromProjects( List reactorProjects, String workingDirectory ) + { + ReleaseDescriptorBuilder builder = super.createDescriptorFromProjects( reactorProjects, workingDirectory ); + builder.setScmReleaseLabel( "release-label" ); + return builder; + } + + // MRELEASE-454 + @Test + public void testRewritePomWithImportedDependencyManagementInReactor() + throws Exception + { + List reactorProjects = createReactorProjects( "imported-dependency-management-in-reactor" ); + ReleaseDescriptorBuilder builder = createMappedConfiguration( reactorProjects, "imported-dependency-management-in-reactor" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomWithDifferentVersionsAcrossModules() + throws Exception + { + List reactorProjects = createReactorProjects( "modules-with-different-versions" ); + ReleaseDescriptorBuilder builder = createMappedConfiguration( reactorProjects, "modules-with-different-versions" ); + builder.addReleaseVersion( "groupId:subproject2", ALTERNATIVE_NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhaseTest.java new file mode 100644 index 000000000..953694ce0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhaseTest.java @@ -0,0 +1,430 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.util.LinkedList; +import java.util.List; + +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.model.Scm; +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.junit.Test; + +/** + * Test the SCM modification check phase. + * + * @author Brett Porter + */ +public class RewritePomsForDevelopmentPhaseTest + extends AbstractEditModeRewritingReleasePhaseTestCase +{ + private static final String NEXT_VERSION = "1.1-SNAPSHOT"; + + private static final String ALTERNATIVE_NEXT_VERSION = "2.1-SNAPSHOT"; + + private static final String RELEASE_VERSION = "1.0"; + + private static final String ALTERNATIVE_RELEASE_VERSION = "2.0"; + + public RewritePomsForDevelopmentPhaseTest( String modelETL ) + { + super( modelETL ); + } + + @Override + protected String getRoleHint() + { + return "rewrite-poms-for-development"; + } + + @Override + protected Path getWorkingDirectory( String workingDir ) + { + return super.getWorkingDirectory( "rewrite-for-development/" + workingDir ); + } + + @Test + public void testSimulateRewrite() + throws Exception + { + List reactorProjects = createReactorProjectsWhenSimulated( "basic-pom" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom" ); + builder.addReleaseVersion( "groupId:artifactId", RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:artifactId", NEXT_VERSION ); + + String expected = readTestProjectFile( "basic-pom/pom.xml" ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + String actual = readTestProjectFile( "basic-pom/pom.xml" ); + assertEquals( "Check the original POM untouched", expected, actual ); + + expected = readTestProjectFile( "basic-pom/expected-pom.xml" ); + actual = readTestProjectFile( "basic-pom/pom.xml.next" ); + assertEquals( "Check the transformed POM", expected, actual ); + } + + private List createReactorProjectsWhenSimulated( String name ) + throws Exception + { + return createReactorProjects( "rewrite-for-release/" + name, name, null ); + } + + @Test + public void testSimulateRewriteEjbClientDeps() + throws Exception + { + List reactorProjects = + new LinkedList<>( createReactorProjects( "basic-pom-ejb-client-dep/project" ) ); + reactorProjects.addAll( createReactorProjects( "basic-pom-ejb-client-dep/ejb" ) ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom-ejb-client-dep" ); + builder.addReleaseVersion( "groupId:artifactId", RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addDevelopmentVersion( ArtifactUtils.versionlessKey( "groupId", "artifactId1" ), NEXT_VERSION ); + builder.addReleaseVersion( ArtifactUtils.versionlessKey( "groupId", "artifactId1" ), RELEASE_VERSION ); + + String expected = readTestProjectFile( "basic-pom-ejb-client-dep/project/pom.xml" ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + String actual = readTestProjectFile( "basic-pom-ejb-client-dep/project/pom.xml" ); + assertEquals( "Check the original POM untouched", expected, actual ); + + expected = readTestProjectFile( "basic-pom-ejb-client-dep/project/expected-pom.xml" ); + actual = readTestProjectFile( "basic-pom-ejb-client-dep/project/pom.xml.next" ); + assertEquals( "Check the transformed POM", expected, actual ); + } + + @Test + public void testClean() + throws Exception + { + List reactorProjects = createReactorProjectsWhenSimulated( "basic-pom" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom" ); + builder.addReleaseVersion( "groupId:artifactId", RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:artifactId", NEXT_VERSION ); + + File testFile = getTestFile( "target/test-classes/projects/rewrite-for-development/basic-pom/pom.xml.next" ); + testFile.delete(); + assertFalse( testFile.exists() ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( testFile.exists() ); + + ( (ResourceGenerator) phase ).clean( reactorProjects ); + + assertFalse( testFile.exists() ); + } + + @Test + public void testCleanNotExists() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom" ); + + File testFile = getTestFile( "target/test-classes/projects/rewrite-for-development/basic-pom/pom.xml.next" ); + testFile.delete(); + assertFalse( testFile.exists() ); + + ( (ResourceGenerator) phase ).clean( reactorProjects ); + + assertFalse( testFile.exists() ); + } + + @Override + protected String readTestProjectFile( String fileName ) + throws IOException + { + return readTestProjectFile( fileName, "rewrite-for-development/" ); + } + + protected String readTestProjectFile( String fileName, String subpath ) + throws IOException + { + return ReleaseUtil.readXmlFile( getTestFile( "target/test-classes/projects/" + subpath + fileName ) ); + } + + @Override + protected List prepareReactorProjects( String path ) + throws Exception + { + String dir = "rewrite-for-development/" + path; + return createReactorProjects( dir, path, null ); + } + + @Override + protected ReleaseDescriptorBuilder createDescriptorFromBasicPom( List reactorProjects, String workingDirectory ) + throws Exception + { + ReleaseDescriptorBuilder builder = super.createDescriptorFromProjects( reactorProjects, workingDirectory ); + + mapScm( builder ); + + return builder; + } + + private void mapScm( ReleaseDescriptorBuilder builder ) + { + Scm scm = new Scm(); + scm.setConnection( "scm:svn:file://localhost/tmp/scm-repo/trunk" ); + scm.setDeveloperConnection( "scm:svn:file://localhost/tmp/scm-repo/trunk" ); + scm.setUrl( "file://localhost/tmp/scm-repo/trunk" ); + builder.addOriginalScmInfo( "groupId:artifactId", scm ); + } + + @Override + protected void mapAlternateNextVersion( ReleaseDescriptorBuilder config, String projectId ) + { + config.addReleaseVersion( projectId, ALTERNATIVE_RELEASE_VERSION ); + config.addDevelopmentVersion( projectId, ALTERNATIVE_NEXT_VERSION ); + } + + @Override + protected void mapNextVersion( ReleaseDescriptorBuilder config, String projectId ) + { + config.addReleaseVersion( projectId, RELEASE_VERSION ); + config.addDevelopmentVersion( projectId, NEXT_VERSION ); + } + + @Override + protected void unmapNextVersion( ReleaseDescriptorBuilder builder, String projectId ) + { + builder.addReleaseVersion( projectId, RELEASE_VERSION ); + } + + @Override + protected ReleaseDescriptorBuilder createConfigurationForPomWithParentAlternateNextVersion( List reactorProjects, String workingDirectory ) + throws Exception + { + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, workingDirectory ); + + builder.addReleaseVersion( "groupId:artifactId", RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", ALTERNATIVE_RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:subproject1", ALTERNATIVE_NEXT_VERSION ); + mapScm( builder ); + + return builder; + } + + @Override + protected ReleaseDescriptorBuilder createConfigurationForWithParentNextVersion( List reactorProjects, String workingDirectory ) + throws Exception + { + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, workingDirectory ); + + builder.addReleaseVersion( "groupId:artifactId", RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:subproject1", NEXT_VERSION ); + mapScm( builder ); + + return builder; + } + + @Test + public void testRewriteBasicPomWithCvs() + throws Exception + { + + List reactorProjects = createReactorProjects( "basic-pom-with-cvs" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-cvs" ); + mapNextVersion( builder, "groupId:artifactId" ); + + Scm scm = new Scm(); + scm.setConnection( "${scm.base}:pserver:anoncvs@localhost:/tmp/scm-repo:module" ); + scm.setDeveloperConnection( "${scm.base}:ext:${username}@localhost:/tmp/scm-repo:module" ); + scm.setUrl( "${baseUrl}/module" ); + builder.addOriginalScmInfo( "groupId:artifactId", scm ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomWithCvsFromTag() + throws Exception + { + + List reactorProjects = createReactorProjects( "basic-pom-with-cvs-from-tag" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-cvs-from-tag" ); + mapNextVersion( builder, "groupId:artifactId" ); + + Scm scm = new Scm(); + scm.setConnection( "scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module" ); + scm.setDeveloperConnection( "scm:cvs:ext:${username}@localhost:/tmp/scm-repo:module" ); + scm.setUrl( "http://localhost/viewcvs.cgi/module" ); + scm.setTag( "original-label" ); + builder.addOriginalScmInfo( "groupId:artifactId", scm ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomWithInheritedScm() + throws Exception + { + + List reactorProjects = createReactorProjects( "basic-pom-inherited-scm" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-inherited-scm" ); + + builder.addReleaseVersion( "groupId:artifactId", RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:subproject1", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subsubproject", RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:subsubproject", NEXT_VERSION ); + Scm scm = new Scm(); + scm.setConnection( "scm:svn:file://localhost/tmp/scm-repo/trunk/subproject1" ); + scm.setDeveloperConnection( "scm:svn:file://localhost/tmp/scm-repo/trunk/subproject1" ); + // MRELEASE-107 + scm.setUrl( "http://localhost/viewvc/mypath/trunk/subproject1" ); + builder.addOriginalScmInfo( "groupId:subproject1", scm ); + builder.addOriginalScmInfo( "groupId:subsubproject", null ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomWithParentAndProperties() + throws Exception + { + performTestRewritePomWithParentAndProperties( "pom-with-parent-and-properties" ); + } + + // MRELEASE-454 + @Test + public void testRewritePomWithParentAndPropertiesInDependencyManagement() + throws Exception + { + performTestRewritePomWithParentAndProperties( "pom-with-parent-and-properties-in-dependency-management" ); + } + + // MRELEASE-454 + @Test + public void testRewritePomWithParentAndPropertiesInDependencyManagementImport() + throws Exception + { + performTestRewritePomWithParentAndProperties( "pom-with-parent-and-properties-in-dependency-management-import" ); + } + + private void performTestRewritePomWithParentAndProperties( String path ) + throws Exception + { + List reactorProjects = createReactorProjects( path ); + + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, path ); + builder.addReleaseVersion( "groupId:artifactId", RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", ALTERNATIVE_RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:subproject1", ALTERNATIVE_NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject2", ALTERNATIVE_RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:subproject2", ALTERNATIVE_NEXT_VERSION ); + + mapScm( builder ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testSimulateRewritePomWithParentAndProperties() + throws Exception + { + // use the original ones since simulation didn't modify them + List reactorProjects = createReactorProjects( "pom-with-parent-and-properties-sim" ); + + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "pom-with-parent-and-properties-sim" ); + builder.addReleaseVersion( "groupId:artifactId", RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", ALTERNATIVE_RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:subproject1", ALTERNATIVE_NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject2", ALTERNATIVE_RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:subproject2", ALTERNATIVE_NEXT_VERSION ); + + mapScm( builder ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + for ( MavenProject project : reactorProjects ) + { + File pomFile = project.getFile(); + File actualFile = new File( pomFile.getParentFile(), pomFile.getName() + ".next" ); + File expectedFile = new File( actualFile.getParentFile(), "expected-pom.xml" ); + + comparePomFiles( expectedFile, actualFile, true, false ); + } + } + + // MRELEASE-311 + @Test + public void testRewritePomWithDependencyPropertyCoordinate() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-with-property-dependency-coordinate" ); + + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "pom-with-property-dependency-coordinate" ); + builder.addReleaseVersion( "groupId:artifactId", RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1-3.4", ALTERNATIVE_RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:subproject1-3.4", ALTERNATIVE_NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject2", ALTERNATIVE_RELEASE_VERSION ); + builder.addDevelopmentVersion( "groupId:subproject2", ALTERNATIVE_NEXT_VERSION ); + + mapScm( builder ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomDependenciesWithoutDependenciesVersionUpdate() + throws Exception + { + List reactorProjects = + createReactorProjects( "internal-snapshot-dependencies-without-dependencies-version-update" ); + ReleaseDescriptorBuilder builder = createDefaultConfiguration( reactorProjects, "internal-snapshot-dependencies-without-dependencies-version-update" ); + builder.setUpdateDependencies( false ); + mapNextVersion( builder, "groupId:subsubproject" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhaseTest.java new file mode 100644 index 000000000..e25678e77 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhaseTest.java @@ -0,0 +1,493 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.util.Iterator; +import java.util.List; +import java.util.Objects; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.junit.Test; + +/** + * Test the SCM modification check phase. + * + * @author Brett Porter + */ +public class RewritePomsForReleasePhaseTest + extends AbstractEditModeRewritingReleasePhaseTestCase +{ + private static final String NEXT_VERSION = "1.0"; + + private static final String ALTERNATIVE_NEXT_VERSION = "2.0"; + + public RewritePomsForReleasePhaseTest( String modelETL ) + { + super( modelETL ); + } + + @Override + protected String getRoleHint() + { + return "rewrite-poms-for-release"; + } + + @Override + protected Path getWorkingDirectory( String workingDir ) + { + return super.getWorkingDirectory( "rewrite-for-release/" + workingDir ); + } + + + @Override + protected List prepareReactorProjects( String path ) + throws Exception + { + String dir = "rewrite-for-release/" + Objects.toString( path, "" ); + return createReactorProjects( dir, path, null ); + } + + @Override + protected String readTestProjectFile( String fileName ) + throws IOException + { + return ReleaseUtil.readXmlFile( getTestFile( "target/test-classes/projects/rewrite-for-release/" + fileName ) ); + } + + @Test + public void testSimulateRewrite() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom" ); + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + + String expected = readTestProjectFile( "basic-pom/pom.xml" ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + String actual = readTestProjectFile( "basic-pom/pom.xml" ); + assertEquals( "Check the original POM untouched", expected, actual ); + + expected = readTestProjectFile( "basic-pom/expected-pom.xml" ); + actual = readTestProjectFile( "basic-pom/pom.xml.tag" ); + assertEquals( "Check the transformed POM", expected, actual ); + } + + @Test + public void testRewriteWithDashedComments() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom-with-dashes-in-comment" ); + ReleaseDescriptorBuilder builder = createDescriptorFromBasicPom( reactorProjects, "basic-pom-with-dashes-in-comment" ); + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + + String expected = readTestProjectFile( "basic-pom-with-dashes-in-comment/pom.xml" ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + String actual = readTestProjectFile( "basic-pom-with-dashes-in-comment/pom.xml" ); + assertEquals( "Check the original POM is untouched", expected, actual ); + + expected = readTestProjectFile( "basic-pom-with-dashes-in-comment/expected-pom.xml" ); + actual = readTestProjectFile( "basic-pom-with-dashes-in-comment/pom.xml.tag" ); + assertEquals( "Check the transformed POM", expected, actual ); + } + + @Test + public void testClean() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom" ); + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + + File testFile = getTestFile( "target/test-classes/projects/rewrite-for-release/basic-pom/pom.xml.tag" ); + testFile.delete(); + assertFalse( testFile.exists() ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( testFile.exists() ); + + ( (ResourceGenerator) phase ).clean( reactorProjects ); + + assertFalse( testFile.exists() ); + } + + @Test + public void testCleanNotExists() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom" ); + + File testFile = getTestFile( "target/test-classes/projects/rewrite-for-release/basic-pom/pom.xml.tag" ); + testFile.delete(); + assertFalse( testFile.exists() ); + + ( (ResourceGenerator) phase ).clean( reactorProjects ); + + assertFalse( testFile.exists() ); + } + + // MRELEASE-116 + @Test + public void testScmOverridden() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-with-overridden-scm" ); + ReleaseDescriptorBuilder builder = createConfigurationForWithParentNextVersion( reactorProjects, "pom-with-overridden-scm" ); + builder.addReleaseVersion( "groupId:subsubproject", NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Override + protected void mapAlternateNextVersion( ReleaseDescriptorBuilder config, String projectId ) + { + config.addReleaseVersion( projectId, ALTERNATIVE_NEXT_VERSION ); + } + + @Override + protected void mapNextVersion( ReleaseDescriptorBuilder config, String projectId ) + { + config.addReleaseVersion( projectId, NEXT_VERSION ); + } + + @Override + protected ReleaseDescriptorBuilder createConfigurationForPomWithParentAlternateNextVersion( List reactorProjects, String workingDirectory ) + throws Exception + { + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, workingDirectory ); + + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", ALTERNATIVE_NEXT_VERSION ); + return builder; + } + + @Override + protected ReleaseDescriptorBuilder createConfigurationForWithParentNextVersion( List reactorProjects, String workingDirectory ) + throws Exception + { + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, workingDirectory ); + + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", NEXT_VERSION ); + return builder; + } + + @Override + protected void unmapNextVersion( ReleaseDescriptorBuilder config, String projectId ) + { + // nothing to do + } + + @Test + public void testRewriteBasicPomWithCvs() + throws Exception + { + + List reactorProjects = createReactorProjects( "basic-pom-with-cvs" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-cvs" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomWithScmExpression() + throws Exception + { + + List reactorProjects = createReactorProjects( "basic-pom-with-scm-expression" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-scm-expression" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomWithTagBase() + throws Exception + { + + List reactorProjects = createReactorProjects( "basic-pom-with-tag-base" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-tag-base" ); + builder.setScmTagBase( "file://localhost/tmp/scm-repo/releases" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomWithTagBaseAndVaryingScmUrls() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom-with-tag-base-and-varying-scm-urls" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-tag-base-and-varying-scm-urls" ); + builder.setScmTagBase( "file://localhost/tmp/scm-repo/allprojects/releases" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomWithCvsFromTag() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom-with-cvs-from-tag" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-cvs-from-tag" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteBasicPomWithEmptyScm() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom-with-empty-scm" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "basic-pom-with-empty-scm" ); + mapNextVersion( builder, "groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteInterpolatedVersions() + throws Exception + { + List reactorProjects = createReactorProjects( "interpolated-versions" ); + ReleaseDescriptorBuilder builder = createMappedConfiguration( reactorProjects, "interpolated-versions" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewriteInterpolatedVersionsDifferentVersion() + throws Exception + { + List reactorProjects = createReactorProjects( "interpolated-versions" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "interpolated-versions" ); + + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", ALTERNATIVE_NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject2", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject3", NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + for ( Iterator i = reactorProjects.iterator(); i.hasNext(); ) + { + MavenProject project = i.next(); + + // skip subproject1 - we don't need to worry about its version mapping change, it has no deps of any kind + if ( !"groupId".equals( project.getGroupId() ) || !"subproject1".equals( project.getArtifactId() ) ) + { + comparePomFiles( project, "-different-version", true ); + } + } + } + + @Test + public void testRewriteBasicPomWithInheritedScm() + throws Exception + { + List reactorProjects = createReactorProjects( "basic-pom-inherited-scm" ); + ReleaseDescriptorBuilder builder = createConfigurationForWithParentNextVersion( reactorProjects, "basic-pom-inherited-scm" ); + builder.addReleaseVersion( "groupId:subsubproject", NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomWithParentAndProperties() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-with-parent-and-properties" ); + + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "pom-with-parent-and-properties" ); + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", ALTERNATIVE_NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject2", ALTERNATIVE_NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + // MRELEASE-311 + @Test + public void testRewritePomWithDependencyPropertyCoordinate() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-with-property-dependency-coordinate" ); + + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "pom-with-property-dependency-coordinate" ); + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1-3.4", ALTERNATIVE_NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject2", ALTERNATIVE_NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + // MRELEASE-305 + @Test + public void testRewritePomWithScmOfParentEndingWithASlash() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-with-scm-of-parent-ending-with-a-slash" ); + + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "pom-with-scm-of-parent-ending-with-a-slash" ); + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", ALTERNATIVE_NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomWithDeepSubprojects() + throws Exception + { + List reactorProjects = createReactorProjects( "multimodule-with-deep-subprojects" ); + + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "multimodule-with-deep-subprojects" ); + builder.addReleaseVersion( "groupId:artifactId", NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject1", ALTERNATIVE_NEXT_VERSION ); + builder.addReleaseVersion( "groupId:subproject2", ALTERNATIVE_NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomForFlatMultiModule() + throws Exception + { + List reactorProjects = + createReactorProjects( "rewrite-for-release/pom-with-parent-flat", "pom-with-parent-flat", "root-project" ); + ReleaseDescriptorBuilder builder = createConfigurationForPomWithParentAlternateNextVersion( reactorProjects, "pom-with-parent-flat" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + // MRELEASE-383 + @Test + public void testRewritePomWithCDATASectionOnWindows() + throws Exception + { + List reactorProjects = createReactorProjects( "cdata-section" ); + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "cdata-section" ); + mapNextVersion( builder, "groupId:artifactId" ); + + RewritePomsForReleasePhase phase = (RewritePomsForReleasePhase) this.phase; + phase.setLs( "\r\n" ); + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // compare POMS without line ending normalization + assertTrue( comparePomFiles( reactorProjects, false ) ); + } + + protected ReleaseDescriptorBuilder createDescriptorFromProjects( List reactorProjects, String workingDirectory ) + { + ReleaseDescriptorBuilder builder = super.createDescriptorFromProjects( reactorProjects, workingDirectory ); + builder.setScmReleaseLabel( "release-label" ); + return builder; + } + + @Test + public void testRewritePomWithExternallyReleasedParent() + throws Exception + { + List reactorProjects = createReactorProjects( "pom-with-externally-released-parent" ); + + ReleaseDescriptorBuilder builder = createDescriptorFromProjects( reactorProjects, "pom-with-externally-released-parent" ); + builder.addDependencyReleaseVersion( "external:parent-artifactId", "1" ); + builder.addDependencyDevelopmentVersion( "external:parent-artifactId", "2-SNAPSHOT" ); + builder.addReleaseVersion( "groupId:subproject1", ALTERNATIVE_NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + // MRELEASE-454 + @Test + public void testRewritePomWithImportedDependencyManagementInReactor() + throws Exception + { + List reactorProjects = createReactorProjects( "imported-dependency-management-in-reactor" ); + ReleaseDescriptorBuilder builder = createMappedConfiguration( reactorProjects, "imported-dependency-management-in-reactor" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + + @Test + public void testRewritePomWithDifferentVersionsAcrossModules() + throws Exception + { + List reactorProjects = createReactorProjects( "modules-with-different-versions" ); + ReleaseDescriptorBuilder builder = createMappedConfiguration( reactorProjects, "modules-with-different-versions" ); + builder.addReleaseVersion( "groupId:subproject2", ALTERNATIVE_NEXT_VERSION ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + assertTrue( comparePomFiles( reactorProjects ) ); + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RunCompleteGoalsPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RunCompleteGoalsPhaseTest.java new file mode 100644 index 000000000..ee520f37d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RunCompleteGoalsPhaseTest.java @@ -0,0 +1,233 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Matchers.isNull; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; + +import java.io.File; +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.PlexusJUnit4TestCase; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.exec.MavenExecutor; +import org.apache.maven.shared.release.exec.MavenExecutorException; +import org.apache.maven.shared.release.stubs.MavenExecutorWrapper; +import org.junit.Test; + +/** + * Test the simple test running phase. + * + * @author Brett Porter + */ +public class RunCompleteGoalsPhaseTest + extends PlexusJUnit4TestCase +{ + private RunCompleteGoalsPhase phase; + + private MavenExecutorWrapper mavenExecutorWrapper; + + private DefaultReleaseEnvironment releaseEnvironment; + + @Override + public void setUp() + throws Exception + { + super.setUp(); + + phase = (RunCompleteGoalsPhase) lookup( ReleasePhase.class, "run-completion-goals" ); + + mavenExecutorWrapper = (MavenExecutorWrapper) lookup( "org.apache.maven.shared.release.exec.MavenExecutor", "wrapper" ); + + releaseEnvironment = new DefaultReleaseEnvironment(); + releaseEnvironment.setMavenExecutorId( "wrapper" ); + } + + @Test + public void testExecute() + throws ReleaseExecutionException, ReleaseFailureException, MavenExecutorException + { + // prepare + File testFile = getTestFile( "target/working-directory" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setCompletionGoals( "clean integration-test" ); + builder.setWorkingDirectory( testFile.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + + mavenExecutorWrapper.setMavenExecutor( mock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, (List) null ); + + // verify + verify( mock ).executeGoals( eq( testFile ), eq( "clean integration-test" ), isA( ReleaseEnvironment.class ), + eq( true ), isNull( String.class ), isNull( String.class ), + isA( ReleaseResult.class ) ); + verifyNoMoreInteractions( mock ); + } + + @Test + public void testSimulate() + throws ReleaseExecutionException, MavenExecutorException + { + // prepare + File testFile = getTestFile( "target/working-directory" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setCompletionGoals( "clean integration-test" ); + builder.setWorkingDirectory( testFile.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + + mavenExecutorWrapper.setMavenExecutor( mock ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, null ); + + // verify + verify( mock ).executeGoals( eq( testFile ), eq( "clean integration-test" ), isA( ReleaseEnvironment.class ), + eq( true ), isNull( String.class ), isNull( String.class ), + isA( ReleaseResult.class ) ); + verifyNoMoreInteractions( mock ); + } + + @Test + public void testExecuteException() + throws ReleaseFailureException, MavenExecutorException + { + // prepare + File testFile = getTestFile( "target/working-directory" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setCompletionGoals( "clean integration-test" ); + builder.setWorkingDirectory( testFile.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + doThrow( new MavenExecutorException( "...", + new Exception() ) ).when( mock ).executeGoals( eq( testFile ), + eq( "clean integration-test" ), + isA( ReleaseEnvironment.class ), + eq( true ), + isNull( String.class ), + isNull( String.class ), + isA( ReleaseResult.class ) ); + + mavenExecutorWrapper.setMavenExecutor( mock ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, (List) null ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "Check cause", MavenExecutorException.class, e.getCause().getClass() ); + } + + // verify + verify( mock ).executeGoals( eq( testFile ), eq( "clean integration-test" ), isA( ReleaseEnvironment.class ), + eq( true ), isNull( String.class ), isNull( String.class ), + isA( ReleaseResult.class ) ); + verifyNoMoreInteractions( mock ); + } + + @Test + public void testSimulateException() + throws MavenExecutorException + { + // prepare + File testFile = getTestFile( "target/working-directory" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setCompletionGoals( "clean integration-test" ); + builder.setWorkingDirectory( testFile.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + doThrow( new MavenExecutorException( "...", + new Exception() ) ).when( mock ).executeGoals( eq( testFile ), + eq( "clean integration-test" ), + isA( ReleaseEnvironment.class ), + eq( true ), + isNull( String.class ), + isNull( String.class ), + isA( ReleaseResult.class ) ); + + mavenExecutorWrapper.setMavenExecutor( mock ); + + // execute + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, null ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "Check cause", MavenExecutorException.class, e.getCause().getClass() ); + } + + // verify + verify( mock ).executeGoals( eq( testFile ), eq( "clean integration-test" ), isA( ReleaseEnvironment.class ), + eq( true ), isNull( String.class ), isNull( String.class ), + isA( ReleaseResult.class ) ); + verifyNoMoreInteractions( mock ); + } + + @Test + public void testEmptyGoals() + throws Exception + { + // prepare + File testFile = getTestFile( "target/working-directory" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setCompletionGoals( "" ); + builder.setWorkingDirectory( testFile.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + + mavenExecutorWrapper.setMavenExecutor( mock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, (List) null ); + + // verify + // never invoke mock + verifyNoMoreInteractions( mock ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RunPerformGoalsPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RunPerformGoalsPhaseTest.java new file mode 100644 index 000000000..4b7ca8aa9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RunPerformGoalsPhaseTest.java @@ -0,0 +1,381 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.argThat; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Matchers.isNull; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.util.Collections; +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.CommandParameters; +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmTag; +import org.apache.maven.scm.command.checkout.CheckOutScmResult; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.manager.ScmManagerStub; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.shared.release.PlexusJUnit4TestCase; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.exec.MavenExecutor; +import org.apache.maven.shared.release.exec.MavenExecutorException; +import org.apache.maven.shared.release.stubs.MavenExecutorWrapper; +import org.junit.Test; + +/** + * @author Emmanuel Venisse + * @version $Id$ + */ +public class RunPerformGoalsPhaseTest + extends PlexusJUnit4TestCase +{ + private RunPerformGoalsPhase phase; + + private MavenExecutorWrapper mavenExecutorWrapper; + + private DefaultReleaseEnvironment releaseEnvironment; + + @Override + public void setUp() + throws Exception + { + super.setUp(); + + phase = (RunPerformGoalsPhase) lookup( ReleasePhase.class, "run-perform-goals" ); + + mavenExecutorWrapper = (MavenExecutorWrapper) lookup( "org.apache.maven.shared.release.exec.MavenExecutor", "wrapper" ); + + releaseEnvironment = new DefaultReleaseEnvironment(); + releaseEnvironment.setMavenExecutorId( "wrapper" ); + } + + @Test + public void testExecuteException() + throws Exception + { + // prepare + File testFile = getTestFile( "target/checkout-directory" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setPerformGoals( "goal1 goal2" ); + builder.setCheckoutDirectory( testFile.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + + mavenExecutorWrapper.setMavenExecutor( mock ); + + doThrow( new MavenExecutorException( "...", new Exception() ) ).when( mock ).executeGoals( eq( testFile ), + eq( "goal1 goal2" ), + isA( ReleaseEnvironment.class ), + eq( true ), + eq( "-DperformRelease=true -f pom.xml" ), + isNull( String.class ), + isA( ReleaseResult.class ) ); + + mavenExecutorWrapper.setMavenExecutor( mock ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, (List) null ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "Check cause", MavenExecutorException.class, e.getCause().getClass() ); + } + + //verify + verify( mock ).executeGoals( eq( testFile ), + eq( "goal1 goal2" ), + isA( ReleaseEnvironment.class ), + eq( true ), + eq( "-DperformRelease=true -f pom.xml" ), + isNull( String.class ), + isA( ReleaseResult.class ) ); + verifyNoMoreInteractions( mock ); + } + + @Test + public void testCustomPomFile() throws Exception + { + //prepare + File testFile = getTestFile( "target/checkout-directory" ); + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setPerformGoals( "goal1 goal2" ); + builder.setPomFileName( "pom1.xml" ); + builder.setCheckoutDirectory( testFile.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + + mavenExecutorWrapper.setMavenExecutor( mock ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, (List) null ); + + verify( mock ).executeGoals( eq( testFile ), + eq( "goal1 goal2" ), + isA( ReleaseEnvironment.class ), + eq( true ), + eq( "-DperformRelease=true -f pom1.xml" ), + eq( "pom1.xml" ), + isA( ReleaseResult.class ) ); + + verifyNoMoreInteractions( mock ); + } + + public void testReleasePerformWithArgumentsNoReleaseProfile() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setAdditionalArguments( "-Dmaven.test.skip=true" ); + builder.setPerformGoals( "goal1 goal2" ); + File checkoutDirectory = getTestFile( "target/checkout-directory" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + mavenExecutorWrapper.setMavenExecutor( mock ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkOut( isA( ScmRepository.class ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + isA( ScmTag.class ), + isA( CommandParameters.class ))) + .thenReturn( new CheckOutScmResult( "...", Collections.emptyList() ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + builder.setUseReleaseProfile( false ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, createReactorProjects() ); + + // verify + verify( mock ).executeGoals( eq( checkoutDirectory ), + eq( "goal1 goal2" ), + isA( ReleaseEnvironment.class ), + eq( true ), + eq( "-Dmaven.test.skip=true -f pom.xml" ), + isNull( String.class ), + isA( ReleaseResult.class ) ); + verify( scmProviderMock ).checkOut( isA( ScmRepository.class ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + isA( ScmTag.class ), + isA( CommandParameters.class )); + verifyNoMoreInteractions( mock, scmProviderMock ); + } + + public void testReleasePerform() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setPerformGoals( "goal1 goal2" ); + File checkoutDirectory = getTestFile( "target/checkout-directory" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + mavenExecutorWrapper.setMavenExecutor( mock ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkOut( isA( ScmRepository.class ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + isA( ScmTag.class ), + isA( CommandParameters.class )) ) + .thenReturn( new CheckOutScmResult( "...", Collections.emptyList() ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, createReactorProjects() ); + + // verify + verify( mock ).executeGoals( eq( checkoutDirectory ), + eq( "goal1 goal2" ), + isA( ReleaseEnvironment.class ), + eq( true ), + eq( "-DperformRelease=true -f pom.xml" ), + isNull( String.class ), + isA( ReleaseResult.class ) ); + verify( scmProviderMock ).checkOut( isA( ScmRepository.class ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + isA( ScmTag.class ), + isA( CommandParameters.class )); + verifyNoMoreInteractions( mock, scmProviderMock ); + } + + public void testReleasePerformNoReleaseProfile() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setPerformGoals( "goal1 goal2" ); + File checkoutDirectory = getTestFile( "target/checkout-directory" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + mavenExecutorWrapper.setMavenExecutor( mock ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkOut( isA( ScmRepository.class ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + isA( ScmTag.class ), + isA( CommandParameters.class )) ) + .thenReturn( new CheckOutScmResult( "...", Collections.emptyList() ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + builder.setUseReleaseProfile( false ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, createReactorProjects() ); + + // verify + verify( mock ).executeGoals( eq( checkoutDirectory ), + eq( "goal1 goal2" ), + isA( ReleaseEnvironment.class ), + eq( true ), + eq( "-f pom.xml" ), + isNull( String.class ), + isA( ReleaseResult.class ) ); + verify( scmProviderMock ).checkOut( isA( ScmRepository.class ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + isA( ScmTag.class ), + isA( CommandParameters.class )); + verifyNoMoreInteractions( mock, scmProviderMock ); + } + + public void testReleasePerformWithArguments() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setAdditionalArguments( "-Dmaven.test.skip=true" ); + builder.setPerformGoals( "goal1 goal2" ); + File checkoutDirectory = getTestFile( "target/checkout-directory" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + mavenExecutorWrapper.setMavenExecutor( mock ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkOut( isA( ScmRepository.class ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + isA( ScmTag.class ), + isA( CommandParameters.class )) ) + .thenReturn( new CheckOutScmResult( "...", Collections.emptyList() ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, createReactorProjects() ); + + // verify + verify( mock ).executeGoals( eq( checkoutDirectory ), + eq( "goal1 goal2" ), + isA( ReleaseEnvironment.class), + eq( true), + eq( "-Dmaven.test.skip=true -DperformRelease=true -f pom.xml" ), + isNull( String.class ), + isA( ReleaseResult.class ) ); + verify( scmProviderMock ).checkOut( isA( ScmRepository.class ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + isA( ScmTag.class ), + isA( CommandParameters.class )); + verifyNoMoreInteractions( mock, scmProviderMock ); + } + + public void testReleasePerformWithReleasePropertiesCompleted() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setPerformGoals( "goal1 goal2" ); + File checkoutDirectory = getTestFile( "target/checkout-directory" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + mavenExecutorWrapper.setMavenExecutor( mock ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkOut( isA( ScmRepository.class ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + isA( ScmTag.class ), + isA( CommandParameters.class )) ) + .thenReturn( new CheckOutScmResult( "...", Collections.emptyList() ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + builder.setCompletedPhase( "end-release" ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, createReactorProjects() ); + + // verify + verify( mock ).executeGoals( eq( checkoutDirectory ), + eq( "goal1 goal2" ), + isA( ReleaseEnvironment.class ), + eq( true ), + eq( "-DperformRelease=true -f pom.xml" ), + isNull( String.class ), + isA( ReleaseResult.class ) ); + verify( scmProviderMock ).checkOut( isA( ScmRepository.class ), + argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ), + isA( ScmTag.class ), + isA( CommandParameters.class )); + verifyNoMoreInteractions( mock, scmProviderMock ); + } + + private static List createReactorProjects() + { + MavenProject project = new MavenProject(); + project.setFile( getTestFile( "target/dummy-project/pom.xml" ) ); + return Collections.singletonList( project ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RunPrepareGoalsPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RunPrepareGoalsPhaseTest.java new file mode 100644 index 000000000..4222580cc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/RunPrepareGoalsPhaseTest.java @@ -0,0 +1,234 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Matchers.isNull; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; + +import java.io.File; +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.PlexusJUnit4TestCase; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.exec.MavenExecutor; +import org.apache.maven.shared.release.exec.MavenExecutorException; +import org.apache.maven.shared.release.stubs.MavenExecutorWrapper; +import org.junit.Test; + +/** + * Test the simple test running phase. + * + * @author Brett Porter + */ +public class RunPrepareGoalsPhaseTest + extends PlexusJUnit4TestCase +{ + private RunPrepareGoalsPhase phase; + + private MavenExecutorWrapper mavenExecutorWrapper; + + private DefaultReleaseEnvironment releaseEnvironment; + + @Override + public void setUp() + throws Exception + { + super.setUp(); + + phase = (RunPrepareGoalsPhase) lookup( ReleasePhase.class, "run-preparation-goals" ); + + mavenExecutorWrapper = (MavenExecutorWrapper) lookup( "org.apache.maven.shared.release.exec.MavenExecutor", "wrapper" ); + + releaseEnvironment = new DefaultReleaseEnvironment(); + releaseEnvironment.setMavenExecutorId( "wrapper" ); + } + + @Test + public void testExecute() + throws ReleaseExecutionException, ReleaseFailureException, MavenExecutorException + { + // prepare + File testFile = getTestFile( "target/working-directory" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setPreparationGoals( "clean integration-test" ); + builder.setWorkingDirectory( testFile.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + + mavenExecutorWrapper.setMavenExecutor( mock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, (List) null ); + + // verify + verify( mock ).executeGoals( eq( testFile ), eq( "clean integration-test" ), isA( ReleaseEnvironment.class ), + eq( true ), isNull( String.class ), isNull( String.class ), + isA( ReleaseResult.class ) ); + verifyNoMoreInteractions( mock ); + } + + @Test + public void testSimulate() + throws ReleaseExecutionException, MavenExecutorException + { + // prepare + File testFile = getTestFile( "target/working-directory" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setPreparationGoals( "clean integration-test" ); + builder.setWorkingDirectory( testFile.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + + mavenExecutorWrapper.setMavenExecutor( mock ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, null ); + + // verify + verify( mock ).executeGoals( eq( testFile ), eq( "clean integration-test" ), isA( ReleaseEnvironment.class ), + eq( true ), isNull( String.class ), isNull( String.class ), + isA( ReleaseResult.class ) ); + verifyNoMoreInteractions( mock ); + } + + @Test + public void testExecuteException() + throws ReleaseFailureException, MavenExecutorException + { + // prepare + File testFile = getTestFile( "target/working-directory" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setPreparationGoals( "clean integration-test" ); + builder.setWorkingDirectory( testFile.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + doThrow( new MavenExecutorException( "...", + new Exception() ) ).when( mock ).executeGoals( eq( testFile ), + eq( "clean integration-test" ), + isA( ReleaseEnvironment.class ), + eq( true ), + isNull( String.class ), + isNull( String.class ), + isA( ReleaseResult.class ) ); + + mavenExecutorWrapper.setMavenExecutor( mock ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, (List) null ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "Check cause", MavenExecutorException.class, e.getCause().getClass() ); + } + + // verify + verify( mock ).executeGoals( eq( testFile ), eq( "clean integration-test" ), isA( ReleaseEnvironment.class ), + eq( true ), isNull( String.class ), isNull( String.class ), + isA( ReleaseResult.class ) ); + verifyNoMoreInteractions( mock ); + } + + @Test + public void testSimulateException() + throws MavenExecutorException + { + // prepare + File testFile = getTestFile( "target/working-directory" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setPreparationGoals( "clean integration-test" ); + builder.setWorkingDirectory( testFile.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + doThrow( new MavenExecutorException( "...", + new Exception() ) ).when( mock ).executeGoals( eq( testFile ), + eq( "clean integration-test" ), + isA( ReleaseEnvironment.class ), + eq( true ), + isNull( String.class ), + isNull( String.class ), + isA( ReleaseResult.class ) ); + + mavenExecutorWrapper.setMavenExecutor( mock ); + + // execute + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, null ); + + fail( "Should have thrown an exception" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "Check cause", MavenExecutorException.class, e.getCause().getClass() ); + } + + // verify + verify( mock ).executeGoals( eq( testFile ), eq( "clean integration-test" ), isA( ReleaseEnvironment.class ), + eq( true ), isNull( String.class ), isNull( String.class ), + isA( ReleaseResult.class ) ); + verifyNoMoreInteractions( mock ); + + } + + @Test + public void testEmptyGoals() + throws Exception + { + // prepare + File testFile = getTestFile( "target/working-directory" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setPreparationGoals( "" ); + builder.setWorkingDirectory( testFile.getAbsolutePath() ); + + MavenExecutor mock = mock( MavenExecutor.class ); + + mavenExecutorWrapper.setMavenExecutor( mock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), releaseEnvironment, (List) null ); + + // verify + // no invocations of mock + verifyNoMoreInteractions( mock ); + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmBranchPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmBranchPhaseTest.java new file mode 100644 index 000000000..9cf71bf7c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmBranchPhaseTest.java @@ -0,0 +1,442 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.argThat; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.io.IOException; +import java.nio.file.LinkOption; +import java.util.Collections; +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.ScmBranchParameters; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmFileStatus; +import org.apache.maven.scm.command.branch.BranchScmResult; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.provider.ScmProviderStub; +import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.stubs.ScmManagerStub; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.junit.Test; + +/** + * Test the SCM branch phase. + * + * @author Brett Porter + */ +public class ScmBranchPhaseTest + extends AbstractReleaseTestCase +{ + @Override + public void setUp() + throws Exception + { + super.setUp(); + + phase = lookup( ReleasePhase.class, "scm-branch" ); + } + + public static String getPath( File file ) + throws IOException + { + return file.toPath().toRealPath( LinkOption.NOFOLLOW_LINKS ).toString(); + } + + @Test + public void testBranch() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + List reactorProjects = createReactorProjects(); + builder.setScmSourceUrl( "scm-url" ); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( getPath( rootProject.getFile().getParentFile() ) ); + builder.setPomFileName( "pom.xml" ); + builder.setScmReleaseLabel( "release-label" ); + builder.setScmCommentPrefix( "[my prefix] " ); + + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile() ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.branch( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmBranchParametersEquals( new ScmBranchParameters( "[my prefix] copy for branch release-label" ) ) ) ) ).thenReturn( new BranchScmResult( "...", + Collections.singletonList( new ScmFile( getPath( rootProject.getFile() ), + ScmFileStatus.TAGGED ) ) ) ); + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).branch( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmBranchParametersEquals( new ScmBranchParameters( "[my prefix] copy for branch release-label" ) ) ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testCommitMultiModuleDeepFolders() + throws Exception + { + // prepare + String dir = "scm-commit/multimodule-with-deep-subprojects"; + List reactorProjects = + createReactorProjects( dir, dir, null ); + String sourceUrl = "http://svn.example.com/repos/project/trunk/"; + String scmUrl = "scm:svn:" + sourceUrl; + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( scmUrl ); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( getPath( rootProject.getFile().getParentFile() ) ); + builder.setPomFileName( "pom.xml" ); + builder.setScmReleaseLabel( "release-label" ); + builder.setScmCommentPrefix( "[my prefix] " ); + builder.setScmBranchBase( "http://svn.example.com/repos/project/branches/" ); + + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile() ); + + SvnScmProviderRepository scmProviderRepository = new SvnScmProviderRepository( sourceUrl ); + scmProviderRepository.setBranchBase( "http://svn.example.com/repos/project/branches/" ); + ScmRepository repository = new ScmRepository( "svn", scmProviderRepository ); + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.branch( eq( repository ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmBranchParametersEquals( new ScmBranchParameters( "[my prefix] copy for branch release-label" ) ) ) ) ).thenReturn( new BranchScmResult( "...", + Collections.singletonList( new ScmFile( getPath( rootProject.getFile() ), + ScmFileStatus.TAGGED ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + stub.addScmRepositoryForUrl( scmUrl, repository ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).branch( eq( repository ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmBranchParametersEquals( new ScmBranchParameters( "[my prefix] copy for branch release-label" ) ) ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testCommitForFlatMultiModule() + throws Exception + { + // prepare + List reactorProjects = + createReactorProjects( "rewrite-for-release/pom-with-parent-flat", "root-project" ); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( rootProject.getScm().getConnection() ); + builder.setWorkingDirectory( getWorkingDirectory( "rewrite-for-release/pom-with-parent-flat" ).toRealPath( LinkOption.NOFOLLOW_LINKS ).toString() ); + builder.setPomFileName( "root-project/pom.xml" ); + builder.setScmReleaseLabel( "release-label" ); + builder.setScmCommentPrefix( "[my prefix] " ); + + // one directory up from root project + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile().getParentFile() ); + + String scmUrl = "file://localhost/tmp/scm-repo/trunk"; + SvnScmProviderRepository scmProviderRepository = new SvnScmProviderRepository( scmUrl ); + ScmRepository repository = new ScmRepository( "svn", scmProviderRepository ); + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.branch( eq( repository ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmBranchParametersEquals( new ScmBranchParameters( "[my prefix] copy for branch release-label" ) ) ) ) ).thenReturn( new BranchScmResult( "...", + Collections.singletonList( new ScmFile( getPath( rootProject.getFile() ), + ScmFileStatus.TAGGED ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + stub.addScmRepositoryForUrl( "scm:svn:" + scmUrl, repository ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).branch( eq( repository ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmBranchParametersEquals( new ScmBranchParameters( "[my prefix] copy for branch release-label" ) ) ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testCommitMultiModule() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + String dir = "scm-commit/multiple-poms"; + List reactorProjects = createReactorProjects( dir, dir, null ); + builder.setScmSourceUrl( "scm-url" ); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( getPath( rootProject.getFile().getParentFile() ) ); + builder.setPomFileName( "pom.xml" ); + builder.setScmReleaseLabel( "release-label" ); + builder.setScmCommentPrefix( "[my prefix] " ); + + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile() ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.branch( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmBranchParametersEquals( new ScmBranchParameters( "[my prefix] copy for branch release-label" ) ) ) ) ).thenReturn( new BranchScmResult( "...", + Collections.singletonList( new ScmFile( getPath( rootProject.getFile() ), + ScmFileStatus.TAGGED ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // exeucte + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).branch( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmBranchParametersEquals( new ScmBranchParameters( "[my prefix] copy for branch release-label" ) ) ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testBranchNoReleaseLabel() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + List reactorProjects = createReactorProjects(); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testSimulateBranch() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + List reactorProjects = createReactorProjects(); + builder.setScmSourceUrl( "scm-url" ); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( getPath( rootProject.getFile().getParentFile() ) ); + builder.setPomFileName( "pom.xml" ); + builder.setScmReleaseLabel( "release-label" ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + // no scmProvider invocation + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testSimulateBranchNoReleaseLabel() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + List reactorProjects = createReactorProjects(); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testNoSuchScmProviderExceptionThrown() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects(); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmManagerStub scmManagerStub = (ScmManagerStub) lookup( ScmManager.class ); + scmManagerStub.setException( new NoSuchScmProviderException( "..." ) ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseExecutionException e ) + { + // verify + assertEquals( "check cause", NoSuchScmProviderException.class, e.getCause().getClass() ); + } + } + + @Test + public void testScmRepositoryExceptionThrown() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects(); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmManagerStub scmManagerStub = (ScmManagerStub) lookup( ScmManager.class ); + scmManagerStub.setException( new ScmRepositoryException( "..." ) ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseScmRepositoryException e ) + { + // verify + assertNull( "Check no additional cause", e.getCause() ); + } + + } + + @Test + public void testScmExceptionThrown() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects(); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.branch( isA( ScmRepository.class ), isA( ScmFileSet.class ), isA( String.class ), + isA( ScmBranchParameters.class ) ) ).thenThrow( new ScmException( "..." ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "check cause", ScmException.class, e.getCause().getClass() ); + } + + // verify + verify( scmProviderMock ).branch( isA( ScmRepository.class ), isA( ScmFileSet.class ), isA( String.class ), + isA( ScmBranchParameters.class ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testScmResultFailure() + throws Exception + { + List reactorProjects = createReactorProjects(); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmManager scmManager = (ScmManager) lookup( ScmManager.class ); + ScmProviderStub providerStub = + (ScmProviderStub) scmManager.getProviderByUrl( "scm-url" ); + + providerStub.setBranchScmResult( new BranchScmResult( "", "", "", false ) ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Commit should have failed" ); + } + catch ( ReleaseScmCommandException e ) + { + assertNull( "check no other cause", e.getCause() ); + } + } + + private List createReactorProjects() + throws Exception + { + String dir = "scm-commit/single-pom"; + return createReactorProjects( dir, dir, null ); + } + + private static ReleaseDescriptorBuilder createReleaseDescriptorBuilder() + throws IOException + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setScmReleaseLabel( "release-label" ); + + File workingDir = getTestFile( "target/test/checkout" ); + if ( !workingDir.exists() ) + { + assertTrue( "Failed to create the directory, along with all necessary parent directories", + workingDir.mkdirs() ); + } + + builder.setWorkingDirectory( getPath( workingDir ) ); + builder.setPomFileName( "pom.xml" ); + return builder; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCheckModificationsPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCheckModificationsPhaseTest.java new file mode 100644 index 000000000..bff49da14 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCheckModificationsPhaseTest.java @@ -0,0 +1,442 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmFileStatus; +import org.apache.maven.scm.command.status.StatusScmResult; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.provider.ScmProviderStub; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.PlexusJUnit4TestCase; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseResult; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.stubs.ScmManagerStub; +import org.junit.Test; + +/** + * Test the SCM modification check phase. + * + * @author Brett Porter + */ +public class ScmCheckModificationsPhaseTest + extends PlexusJUnit4TestCase +{ + private ReleasePhase phase; + + @Override + public void setUp() + throws Exception + { + super.setUp(); + + phase = (ReleasePhase) lookup( ReleasePhase.class, "scm-check-modifications" ); + } + + @Test + public void testNoSuchScmProviderExceptionThrown() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setWorkingDirectory( getTestFile( "target/test/checkout" ).getAbsolutePath() ); + + ScmManagerStub scmManagerStub = (ScmManagerStub) lookup( ScmManager.class ); + scmManagerStub.setException( new NoSuchScmProviderException( "..." ) ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "check cause", NoSuchScmProviderException.class, e.getCause().getClass() ); + } + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseExecutionException e ) + { + // verify + assertEquals( "check cause", NoSuchScmProviderException.class, e.getCause().getClass() ); + } + } + + @Test + public void testScmRepositoryExceptionThrown() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setWorkingDirectory( getTestFile( "target/test/checkout" ).getAbsolutePath() ); + + ScmManagerStub scmManagerStub = (ScmManagerStub) lookup( ScmManager.class ); + scmManagerStub.setException( new ScmRepositoryException( "..." ) ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseScmRepositoryException e ) + { + assertNull( "Check no additional cause", e.getCause() ); + } + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseScmRepositoryException e ) + { + assertNull( "Check no additional cause", e.getCause() ); + } + } + + @Test + public void testScmExceptionThrown() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setWorkingDirectory( getTestFile( "target/test/checkout" ).getAbsolutePath() ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.status( isA( ScmRepository.class ), + isA( ScmFileSet.class ) ) ).thenThrow( new ScmException( "..." ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "check cause", ScmException.class, e.getCause().getClass() ); + } + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "check cause", ScmException.class, e.getCause().getClass() ); + } + + // verify + verify( scmProviderMock, times( 2 ) ).status( isA( ScmRepository.class ), isA( ScmFileSet.class ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testScmResultFailure() + throws Exception + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmManager scmManager = lookup( ScmManager.class ); + ScmProviderStub providerStub = + (ScmProviderStub) scmManager.getProviderByUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + providerStub.setStatusScmResult( new StatusScmResult( "", "", "", false ) ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseScmCommandException e ) + { + assertNull( "check no other cause", e.getCause() ); + } + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseScmCommandException e ) + { + assertNull( "check no other cause", e.getCause() ); + } + } + + @Test + public void testNoModifications() + throws Exception + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + setChangedFiles( builder, Collections.emptyList() ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + // successful execution is verification enough + assertTrue( true ); + } + + @Test + public void testModificationsToExcludedFilesOnly() + throws Exception + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + setChangedFiles( builder, + Arrays.asList( "release.properties", "pom.xml.backup", "pom.xml.tag", "pom.xml.next" ) ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + // successful execution is verification enough + assertTrue( true ); + } + + // MRELEASE-645: Allow File/Directory Patterns for the checkModificationExcludes Option + @Test + public void testModificationsToCustomExcludedFilesOnly() + throws Exception + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + builder.setCheckModificationExcludes( Collections.singletonList( "**/keep.me" ) ); + + setChangedFiles( builder, + Arrays.asList( "release.properties", "pom.xml.backup", "pom.xml.tag", "pom.xml.next", + "keep.me", "src/app/keep.me", "config\\keep.me" ) ); + + assertEquals( ReleaseResult.SUCCESS, + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ).getResultCode() ); + + assertEquals( ReleaseResult.SUCCESS, + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ).getResultCode() ); + } + + @Test + public void testModificationsToPoms() + throws Exception + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + setChangedFiles( builder, Arrays.asList( "pom.xml", "module/pom.xml" ) ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testModificationsToIncludedFilesOnly() + throws Exception + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + setChangedFiles( builder, Collections.singletonList( "something.txt" ) ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testModificationsToIncludedAndExcludedFiles() + throws Exception + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + setChangedFiles( builder, Arrays.asList( "release.properties", "pom.xml.backup", "pom.xml.tag", + "pom.xml.release", "something.txt" ) ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testModificationsToAdditionalExcludedFiles() + throws Exception + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + builder.setCheckModificationExcludes( Collections.singletonList( "something.*" ) ); + + setChangedFiles( builder, Collections.singletonList( "something.txt" ) ); + + assertEquals( ReleaseResult.SUCCESS, + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ).getResultCode() ); + + assertEquals( ReleaseResult.SUCCESS, + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ).getResultCode() ); + } + + // MRELEASE-775 + @Test + public void testMultipleExclusionPatternMatch() + throws Exception + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + builder.setCheckModificationExcludes( Collections.singletonList( "release.properties" ) ); + + setChangedFiles( builder, Arrays.asList( "release.properties" ) ); + + assertEquals( ReleaseResult.SUCCESS, + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ).getResultCode() ); + + assertEquals( ReleaseResult.SUCCESS, + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), null ).getResultCode() ); + } + + private void setChangedFiles( ReleaseDescriptorBuilder builder, List changedFiles ) + throws Exception + { + ScmManager scmManager = (ScmManager) lookup( ScmManager.class ); + ScmProviderStub providerStub = + (ScmProviderStub) scmManager.getProviderByUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + + providerStub.setStatusScmResult( new StatusScmResult( "", createScmFiles( changedFiles ) ) ); + } + + private static List createScmFiles( List changedFiles ) + { + List files = new ArrayList<>( changedFiles.size() ); + for ( Iterator i = changedFiles.iterator(); i.hasNext(); ) + { + String fileName = i.next(); + files.add( new ScmFile( fileName, ScmFileStatus.MODIFIED ) ); + } + return files; + } + + private static ReleaseDescriptorBuilder createReleaseDescriptorBuilder() + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm:svn:file://localhost/tmp/scm-repo" ); + builder.setWorkingDirectory( getTestFile( "target/test/checkout" ).getAbsolutePath() ); + return builder; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhaseTest.java new file mode 100644 index 000000000..837886929 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhaseTest.java @@ -0,0 +1,204 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.argThat; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Matchers.isNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.util.Collections; +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmFileStatus; +import org.apache.maven.scm.ScmVersion; +import org.apache.maven.scm.command.checkin.CheckInScmResult; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.manager.ScmManagerStub; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.junit.Test; + +/** + * Test the SCM development commit phase. + * + * @author Lars Corneliussen + */ +public class ScmCommitDevelopmentPhaseTest + extends AbstractReleaseTestCase +{ + private static final String COMMIT_MESSAGE = "[maven-release-manager] prepare for next development iteration"; + + private static final String ROLLBACK_PREFIX = + "[maven-release-manager] rollback changes from release preparation of "; + + private List reactorProjects; + + private MavenProject rootProject; + + private ReleaseDescriptorBuilder builder; + + private ScmProvider scmProviderMock; + + @Override + public void setUp() + throws Exception + { + super.setUp(); + + phase = (ReleasePhase) lookup( ReleasePhase.class, "scm-commit-development" ); + + reactorProjects = createReactorProjects(); + rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder = createReleaseDescriptorBuilder( rootProject ); + } + + @Test + public void testIsCorrectImplementation() + { + assertEquals( ScmCommitDevelopmentPhase.class, phase.getClass() ); + } + + @Test + public void testNoCommitOrRollbackRequired() + throws Exception + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( rootProject ); + List reactorProjects = createReactorProjects(); + + builder.setRemoteTagging( false ); + builder.setPinExternals( false ); + builder.setSuppressCommitBeforeTagOrBranch( true ); + builder.setUpdateWorkingCopyVersions( false ); + + prepareNoCheckin(); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + verifyNoCheckin(); + } + + @Test + public void testCommitsNextVersions() + throws Exception + { + builder.setUpdateWorkingCopyVersions( true ); + + prepareCheckin( COMMIT_MESSAGE ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + verifyCheckin( COMMIT_MESSAGE ); + } + + @Test + public void testCommitsNextVersionsAlternateMessage() + throws Exception + { + builder.setUpdateWorkingCopyVersions( true ); + builder.setScmCommentPrefix("[release]"); + builder.setScmDevelopmentCommitComment("@{prefix} Development of @{groupId}:@{artifactId}"); + + prepareCheckin( "[release] Development of groupId:artifactId" ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + verifyCheckin( "[release] Development of groupId:artifactId" ); + } + + @Test + public void testCommitsRollbackPrepare() + throws Exception + { + builder.setUpdateWorkingCopyVersions( false ); + + String message = ROLLBACK_PREFIX + "release-label"; + + prepareCheckin( message ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + verifyCheckin( message ); + } + + private void prepareCheckin( String message ) + throws Exception + { + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile(), rootProject.getFile() ); + scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), + eq( message ) ) ).thenReturn( new CheckInScmResult( "...", + Collections.singletonList( new ScmFile( rootProject.getFile().getPath(), + ScmFileStatus.CHECKED_IN ) ) ) ); + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + } + + private void verifyCheckin( String message ) + throws Exception + { + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile(), rootProject.getFile() ); + verify( scmProviderMock ).checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), eq( message ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + private void prepareNoCheckin() + throws Exception + { + scmProviderMock = mock( ScmProvider.class ); + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + } + + private void verifyNoCheckin() + { + verifyNoMoreInteractions( scmProviderMock ); + } + + private List createReactorProjects() + throws Exception + { + String dir = "scm-commit/single-pom"; + return createReactorProjects( dir, dir, null ); + } + + private static ReleaseDescriptorBuilder createReleaseDescriptorBuilder( MavenProject rootProject ) + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setScmReleaseLabel( "release-label" ); + builder.setWorkingDirectory( rootProject.getFile().getParentFile().getAbsolutePath() ); + return builder; + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhaseTest.java new file mode 100644 index 000000000..954086c75 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhaseTest.java @@ -0,0 +1,551 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.argThat; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Matchers.isNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmFileStatus; +import org.apache.maven.scm.ScmVersion; +import org.apache.maven.scm.command.checkin.CheckInScmResult; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.provider.ScmProviderStub; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.stubs.ScmManagerStub; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.junit.Test; + +/** + * Test the release or branch preparation SCM commit phase. + * + * @author Brett Porter + */ +public class ScmCommitPreparationPhaseTest + extends AbstractReleaseTestCase +{ + private static final String PREFIX = "[maven-release-manager] prepare release "; + + @Override + public void setUp() + throws Exception + { + super.setUp(); + + phase = (ReleasePhase) lookup( ReleasePhase.class, "scm-commit-release" ); + } + + @Test + public void testIsCorrectImplementation() + { + assertEquals( ScmCommitPreparationPhase.class, phase.getClass() ); + } + + @Test + public void testResolvesCorrectBranchImplementation() + throws Exception + { + assertTrue( lookup( ReleasePhase.class, "scm-commit-branch" ) instanceof ScmCommitPreparationPhase ); + } + + @Test + public void testCommit() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects(); + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( rootProject.getFile().getParentFile().getAbsolutePath() ); + builder.setScmReleaseLabel( "release-label" ); + + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile(), rootProject.getFile() ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), + eq( PREFIX + + "release-label" ) ) ).thenReturn( new CheckInScmResult( "...", + Collections.singletonList( new ScmFile( rootProject.getFile().getPath(), + ScmFileStatus.CHECKED_IN ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), eq( PREFIX + "release-label" ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testCommitAlternateMessage() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects(); + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setScmCommentPrefix("[release]"); + builder.setScmReleaseCommitComment("@{prefix} Release of @{groupId}:@{artifactId} @{releaseLabel}"); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( rootProject.getFile().getParentFile().getAbsolutePath() ); + builder.setScmReleaseLabel( "release-label" ); + + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile(), rootProject.getFile() ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), + eq( "[release] Release of groupId:artifactId release-label" ) ) ).thenReturn( new CheckInScmResult( "...", + Collections.singletonList( new ScmFile( rootProject.getFile().getPath(), + ScmFileStatus.CHECKED_IN ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), eq( "[release] Release of groupId:artifactId release-label" ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testCommitMultiModule() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + String dir = "scm-commit/multiple-poms"; + List reactorProjects = createReactorProjects( dir, dir, null ); + builder.setScmSourceUrl( "scm-url" ); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( rootProject.getFile().getParentFile().getAbsolutePath() ); + builder.setScmReleaseLabel( "release-label" ); + + List poms = new ArrayList<>(); + for ( Iterator i = reactorProjects.iterator(); i.hasNext(); ) + { + MavenProject project = i.next(); + poms.add( project.getFile() ); + } + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile(), poms ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), + eq( PREFIX + + "release-label" ) ) ).thenReturn( new CheckInScmResult( "...", + Collections.singletonList( new ScmFile( rootProject.getFile().getPath(), + ScmFileStatus.CHECKED_IN ) ) ) ); + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), eq( PREFIX + "release-label" ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testCommitDevelopment() + throws Exception + { + // prepare + phase = (ReleasePhase) lookup( ReleasePhase.class, "scm-commit-development" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + List reactorProjects = createReactorProjects(); + builder.setScmSourceUrl( "scm-url" ); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( rootProject.getFile().getParentFile().getAbsolutePath() ); + builder.setScmReleaseLabel( "release-label" ); + + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile(), rootProject.getFile() ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), + eq( "[maven-release-manager] prepare for next development iteration" ) ) ).thenReturn( new CheckInScmResult( "...", + Collections.singletonList( new ScmFile( rootProject.getFile().getPath(), + ScmFileStatus.CHECKED_IN ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), + eq( "[maven-release-manager] prepare for next development iteration" ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testCommitDevelopmentAlternateMessage() + throws Exception + { + // prepare + phase = (ReleasePhase) lookup( ReleasePhase.class, "scm-commit-development" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + List reactorProjects = createReactorProjects(); + builder.setScmSourceUrl( "scm-url" ); + builder.setScmCommentPrefix("[release]"); + builder.setScmDevelopmentCommitComment("@{prefix} Bump version of @{groupId}:@{artifactId} after @{releaseLabel}"); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( rootProject.getFile().getParentFile().getAbsolutePath() ); + builder.setScmReleaseLabel( "release-label" ); + + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile(), rootProject.getFile() ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), + eq( "[release] Bump version of groupId:artifactId after release-label" ) ) ).thenReturn( new CheckInScmResult( "...", + Collections.singletonList( new ScmFile( rootProject.getFile().getPath(), + ScmFileStatus.CHECKED_IN ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), + eq( "[release] Bump version of groupId:artifactId after release-label" ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testCommitNoReleaseLabel() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + List reactorProjects = createReactorProjects(); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testCommitGenerateReleasePoms() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects(); + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setGenerateReleasePoms( true ); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( rootProject.getFile().getParentFile().getAbsolutePath() ); + builder.setScmReleaseLabel( "release-label" ); + + List files = new ArrayList<>(); + files.add( rootProject.getFile() ); + files.add( ReleaseUtil.getReleasePom( rootProject ) ); + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile(), files ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), + eq( PREFIX + + "release-label" ) ) ).thenReturn( new CheckInScmResult( "...", + Collections.singletonList( new ScmFile( rootProject.getFile().getPath(), + ScmFileStatus.CHECKED_IN ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).checkIn( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + isNull( ScmVersion.class ), eq( PREFIX + "release-label" ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testSimulateCommit() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + List reactorProjects = createReactorProjects(); + builder.setScmSourceUrl( "scm-url" ); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( rootProject.getFile().getParentFile().getAbsolutePath() ); + builder.setScmReleaseLabel( "release-label" ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // never invoke scmProviderMock + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testSimulateCommitNoReleaseLabel() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + List reactorProjects = createReactorProjects(); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testNoSuchScmProviderExceptionThrown() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects(); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmManagerStub scmManagerStub = (ScmManagerStub) lookup( ScmManager.class ); + scmManagerStub.setException( new NoSuchScmProviderException( "..." ) ); + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseExecutionException e ) + { + // verify + assertEquals( "check cause", NoSuchScmProviderException.class, e.getCause().getClass() ); + } + } + + @Test + public void testScmRepositoryExceptionThrown() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects(); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmManagerStub scmManagerStub = (ScmManagerStub) lookup( ScmManager.class ); + scmManagerStub.setException( new ScmRepositoryException( "..." ) ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseScmRepositoryException e ) + { + // verify + assertNull( "Check no additional cause", e.getCause() ); + } + } + + @Test + public void testScmExceptionThrown() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects(); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.checkIn( isA( ScmRepository.class ), isA( ScmFileSet.class ), isNull( ScmVersion.class ), + isA( String.class ) ) ).thenThrow( new ScmException( "..." ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "check cause", ScmException.class, e.getCause().getClass() ); + } + + // verify + verify( scmProviderMock ).checkIn( isA( ScmRepository.class ), isA( ScmFileSet.class ), + isNull( ScmVersion.class ), isA( String.class ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testScmResultFailure() + throws Exception + { + List reactorProjects = createReactorProjects(); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmManager scmManager = (ScmManager) lookup( ScmManager.class ); + ScmProviderStub providerStub = + (ScmProviderStub) scmManager.getProviderByUrl( "scm-url" ); + + providerStub.setCheckInScmResult( new CheckInScmResult( "", "", "", false ) ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Commit should have failed" ); + } + catch ( ReleaseScmCommandException e ) + { + assertNull( "check no other cause", e.getCause() ); + } + } + + @Test + public void testSuppressCommitWithRemoteTaggingFails() + throws Exception + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + List reactorProjects = createReactorProjects(); + + builder.setRemoteTagging( true ); + builder.setPinExternals( false ); + builder.setSuppressCommitBeforeTagOrBranch( true ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Commit should have failed with ReleaseFailureException" ); + } + catch ( ReleaseFailureException e ) + { + assertNull( "check no other cause", e.getCause() ); + } + + // never invoke scmProviderMock + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testSuppressCommitAfterBranch() + throws Exception + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + List reactorProjects = createReactorProjects(); + + builder.setBranchCreation( true ); + builder.setRemoteTagging( false ); + builder.setSuppressCommitBeforeTagOrBranch( true ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // never invoke scmProviderMock + verifyNoMoreInteractions( scmProviderMock ); + } + + private List createReactorProjects() + throws Exception + { + String dir = "scm-commit/single-pom"; + return createReactorProjects( dir, dir, null ); + } + + private static ReleaseDescriptorBuilder createReleaseDescriptorBuilder() + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setScmReleaseLabel( "release-label" ); + builder.setWorkingDirectory( getTestFile( "target/test/checkout" ).getAbsolutePath() ); + return builder; + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmTagPhaseTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmTagPhaseTest.java new file mode 100644 index 000000000..10b897949 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmTagPhaseTest.java @@ -0,0 +1,445 @@ +package org.apache.maven.shared.release.phase; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.argThat; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.io.IOException; +import java.nio.file.LinkOption; +import java.nio.file.Paths; +import java.util.Collections; +import java.util.List; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmFileStatus; +import org.apache.maven.scm.ScmTagParameters; +import org.apache.maven.scm.command.tag.TagScmResult; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.provider.ScmProviderStub; +import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.scm.ReleaseScmCommandException; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.stubs.ScmManagerStub; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.junit.Test; + +/** + * Test the SCM tag phase. + * + * @author Brett Porter + */ +public class ScmTagPhaseTest + extends AbstractReleaseTestCase +{ + @Override + public void setUp() + throws Exception + { + super.setUp(); + + phase = (ReleasePhase) lookup( ReleasePhase.class, "scm-tag" ); + } + + public static String getPath( File file ) + throws IOException + { + return file.toPath().toRealPath( LinkOption.NOFOLLOW_LINKS ).toString(); + } + + public static String getPath( String file ) + throws IOException + { + return Paths.get( file ).toRealPath( LinkOption.NOFOLLOW_LINKS ).toString(); + } + + + @Test + public void testTag() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + List reactorProjects = createReactorProjects(); + builder.setScmSourceUrl( "scm-url" ); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( getPath( rootProject.getFile().getParentFile() ) ); + builder.setPomFileName( rootProject.getFile().getName() ); + builder.setScmReleaseLabel( "release-label" ); + builder.setScmCommentPrefix( "[my prefix] " ); + + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile() ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.tag( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmTagParametersEquals( new ScmTagParameters( "[my prefix] copy for tag release-label" ) ) ) ) ).thenReturn( new TagScmResult( "...", + Collections.singletonList( new ScmFile( getPath( rootProject.getFile() ), + ScmFileStatus.TAGGED ) ) ) ); + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).tag( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmTagParametersEquals( new ScmTagParameters( "[my prefix] copy for tag release-label" ) ) ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testCommitMultiModuleDeepFolders() + throws Exception + { + // prepare + List reactorProjects = + createReactorProjects( "scm-commit/multimodule-with-deep-subprojects", "" ); + String sourceUrl = "http://svn.example.com/repos/project/trunk/"; + String scmUrl = "scm:svn:" + sourceUrl; + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( scmUrl ); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( getPath( rootProject.getFile().getParentFile() ) ); + builder.setPomFileName( rootProject.getFile().getName() ); + builder.setScmReleaseLabel( "release-label" ); + builder.setScmCommentPrefix( "[my prefix] " ); + builder.setScmTagBase( "http://svn.example.com/repos/project/releases/" ); + + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile() ); + + SvnScmProviderRepository scmProviderRepository = new SvnScmProviderRepository( sourceUrl ); + scmProviderRepository.setTagBase( "http://svn.example.com/repos/project/releases/" ); + ScmRepository repository = new ScmRepository( "svn", scmProviderRepository ); + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.tag( eq( repository ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmTagParametersEquals( new ScmTagParameters( "[my prefix] copy for tag release-label" ) ) ) ) ).thenReturn( new TagScmResult( "...", + Collections.singletonList( new ScmFile( getPath( rootProject.getFile() ), + ScmFileStatus.TAGGED ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + stub.addScmRepositoryForUrl( scmUrl, repository ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).tag( eq( repository ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmTagParametersEquals( new ScmTagParameters( "[my prefix] copy for tag release-label" ) ) ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testCommitForFlatMultiModule() + throws Exception + { + // prepare + List reactorProjects = + createReactorProjects( "rewrite-for-release/pom-with-parent-flat", "root-project" ); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( rootProject.getScm().getConnection() ); + builder.setWorkingDirectory( getWorkingDirectory( "rewrite-for-release/pom-with-parent-flat" ).toRealPath( LinkOption.NOFOLLOW_LINKS ).toString() ); + builder.setPomFileName( "root-project/pom.xml" ); + builder.setScmReleaseLabel( "release-label" ); + builder.setScmCommentPrefix( "[my prefix] " ); + + // one directory up from root project + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile().getParentFile() ); + + String scmUrl = "file://localhost/tmp/scm-repo/trunk"; + SvnScmProviderRepository scmProviderRepository = new SvnScmProviderRepository( scmUrl ); + ScmRepository repository = new ScmRepository( "svn", scmProviderRepository ); + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.tag( eq( repository ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmTagParametersEquals( new ScmTagParameters( "[my prefix] copy for tag release-label" ) ) ) ) ).thenReturn( new TagScmResult( "...", + Collections.singletonList( new ScmFile( getPath( rootProject.getFile() ), + ScmFileStatus.TAGGED ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + stub.addScmRepositoryForUrl( "scm:svn:" + scmUrl, repository ); + + // execute + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).tag( eq( repository ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmTagParametersEquals( new ScmTagParameters( "[my prefix] copy for tag release-label" ) ) ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testCommitMultiModule() + throws Exception + { + // prepare + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + String dir = "scm-commit/multiple-poms"; + List reactorProjects = createReactorProjects( dir, dir, null ); + builder.setScmSourceUrl( "scm-url" ); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( getPath( rootProject.getFile().getParentFile() ) ); + builder.setPomFileName( rootProject.getFile().getName() ); + builder.setScmReleaseLabel( "release-label" ); + builder.setScmCommentPrefix( "[my prefix] " ); + + ScmFileSet fileSet = new ScmFileSet( rootProject.getFile().getParentFile() ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.tag( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmTagParametersEquals( new ScmTagParameters( "[my prefix] copy for tag release-label" ) ) ) ) ).thenReturn( new TagScmResult( "...", + Collections.singletonList( new ScmFile( getPath( rootProject.getFile() ), + ScmFileStatus.TAGGED ) ) ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // exeucte + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + verify( scmProviderMock ).tag( isA( ScmRepository.class ), argThat( new IsScmFileSetEquals( fileSet ) ), + eq( "release-label" ), + argThat( new IsScmTagParametersEquals( new ScmTagParameters( "[my prefix] copy for tag release-label" ) ) ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testTagNoReleaseLabel() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + List reactorProjects = createReactorProjects(); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testSimulateTag() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + List reactorProjects = createReactorProjects(); + builder.setScmSourceUrl( "scm-url" ); + MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects ); + builder.setWorkingDirectory( getPath( rootProject.getFile().getParentFile() ) ); + builder.setPomFileName( rootProject.getFile().getName() ); + builder.setScmReleaseLabel( "release-label" ); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + // verify + // no scmProvider invocation + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testSimulateTagNoReleaseLabel() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + List reactorProjects = createReactorProjects(); + + try + { + phase.simulate( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + fail( "Should have thrown an exception" ); + } + catch ( ReleaseFailureException e ) + { + assertTrue( true ); + } + } + + @Test + public void testNoSuchScmProviderExceptionThrown() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects(); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmManagerStub scmManagerStub = (ScmManagerStub) lookup( ScmManager.class ); + scmManagerStub.setException( new NoSuchScmProviderException( "..." ) ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseExecutionException e ) + { + // verify + assertEquals( "check cause", NoSuchScmProviderException.class, e.getCause().getClass() ); + } + } + + @Test + public void testScmRepositoryExceptionThrown() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects(); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmManagerStub scmManagerStub = (ScmManagerStub) lookup( ScmManager.class ); + scmManagerStub.setException( new ScmRepositoryException( "..." ) ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseScmRepositoryException e ) + { + // verify + assertNull( "Check no additional cause", e.getCause() ); + } + } + + @Test + public void testScmExceptionThrown() + throws Exception + { + // prepare + List reactorProjects = createReactorProjects(); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmProvider scmProviderMock = mock( ScmProvider.class ); + when( scmProviderMock.tag( isA( ScmRepository.class ), isA( ScmFileSet.class ), isA( String.class ), + isA( ScmTagParameters.class ) ) ).thenThrow( new ScmException( "..." ) ); + + ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.class ); + stub.setScmProvider( scmProviderMock ); + + // execute + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Status check should have failed" ); + } + catch ( ReleaseExecutionException e ) + { + assertEquals( "check cause", ScmException.class, e.getCause().getClass() ); + } + + // verify + verify( scmProviderMock ).tag( isA( ScmRepository.class ), isA( ScmFileSet.class ), isA( String.class ), + isA( ScmTagParameters.class ) ); + verifyNoMoreInteractions( scmProviderMock ); + } + + @Test + public void testScmResultFailure() + throws Exception + { + List reactorProjects = createReactorProjects(); + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmManager scmManager = lookup( ScmManager.class ); + ScmProviderStub providerStub = + (ScmProviderStub) scmManager.getProviderByUrl( "scm-url" ); + + providerStub.setTagScmResult( new TagScmResult( "", "", "", false ) ); + + try + { + phase.execute( ReleaseUtils.buildReleaseDescriptor( builder ), new DefaultReleaseEnvironment(), reactorProjects ); + + fail( "Commit should have failed" ); + } + catch ( ReleaseScmCommandException e ) + { + assertNull( "check no other cause", e.getCause() ); + } + } + + private List createReactorProjects() + throws Exception + { + return createReactorProjects( "scm-commit/single-pom", "" ); + } + + private static ReleaseDescriptorBuilder createReleaseDescriptorBuilder() + throws IOException + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + builder.setScmReleaseLabel( "release-label" ); + File workingDir = getTestFile( "target/test/checkout" ); + if ( !workingDir.exists() ) + { + assertTrue( "Failed to create the directory, along with all necessary parent directories", + workingDir.mkdirs() ); + } + builder.setWorkingDirectory( getPath( workingDir ) ); + builder.setPomFileName( "pom.xml" ); + return builder; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/policies/DefaultNamingPolicyTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/policies/DefaultNamingPolicyTest.java new file mode 100644 index 000000000..b0c2b69a6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/policies/DefaultNamingPolicyTest.java @@ -0,0 +1,44 @@ +package org.apache.maven.shared.release.policies; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; + +import org.apache.maven.shared.release.policy.naming.NamingPolicyRequest; +import org.junit.Test; + +public class DefaultNamingPolicyTest +{ + private DefaultNamingPolicy policy = new DefaultNamingPolicy(); + + @Test + public void testName() throws Exception + { + assertEquals( "ARTIFACTID-VERSION", + policy.getName( newNamingPolicyRequest( "ARTIFACTID", "VERSION" ) ).getName() ); + assertEquals( "ARTIFACTID-1.0-SNAPSHOT", + policy.getName( newNamingPolicyRequest( "ARTIFACTID", "1.0-SNAPSHOT" ) ).getName() ); + } + + private NamingPolicyRequest newNamingPolicyRequest( String artifactId, String version ) + { + return new NamingPolicyRequest().setArtifactId( artifactId ).setVersion( version ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/policies/DefaultVersionPolicyTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/policies/DefaultVersionPolicyTest.java new file mode 100644 index 000000000..9d923ea07 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/policies/DefaultVersionPolicyTest.java @@ -0,0 +1,73 @@ +package org.apache.maven.shared.release.policies; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; + +import org.apache.maven.shared.release.policy.version.VersionPolicy; +import org.apache.maven.shared.release.policy.version.VersionPolicyRequest; +import org.junit.Test; + +public class DefaultVersionPolicyTest +{ + private VersionPolicy policy = new DefaultVersionPolicy(); + + @Test + public void testOneDigitReleaseVersion() throws Exception + { + VersionPolicyRequest request = new VersionPolicyRequest().setVersion( "1-SNAPSHOT" ); + assertEquals( "1", policy.getReleaseVersion( request ).getVersion() ); + } + + @Test + public void testOneDigitDevelopmentVersion() throws Exception + { + VersionPolicyRequest request = new VersionPolicyRequest().setVersion( "1" ); + assertEquals( "2-SNAPSHOT", policy.getDevelopmentVersion( request ).getVersion() ); + } + + @Test + public void testTwoDigitsReleaseVersion() throws Exception + { + VersionPolicyRequest request = new VersionPolicyRequest().setVersion( "1.0-SNAPSHOT" ); + assertEquals( "1.0", policy.getReleaseVersion( request ).getVersion() ); + } + + @Test + public void testTwoDigitsDevelopmentVersion() throws Exception + { + VersionPolicyRequest request = new VersionPolicyRequest().setVersion( "1.0" ); + assertEquals( "1.1-SNAPSHOT", policy.getDevelopmentVersion( request ).getVersion() ); + } + + @Test + public void testThreeDigitsReleaseVersion() throws Exception + { + VersionPolicyRequest request = new VersionPolicyRequest().setVersion( "1.0.0-SNAPSHOT" ); + assertEquals( "1.0.0", policy.getReleaseVersion( request ).getVersion() ); + } + + @Test + public void testThreeDigitsDevelopmentVersion() throws Exception + { + VersionPolicyRequest request = new VersionPolicyRequest().setVersion( "1.0.0" ); + assertEquals( "1.0.1-SNAPSHOT", policy.getDevelopmentVersion( request ).getVersion() ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/ClearCaseScmTranslatorTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/ClearCaseScmTranslatorTest.java new file mode 100644 index 000000000..9fe1233b2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/ClearCaseScmTranslatorTest.java @@ -0,0 +1,55 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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 ClearCaseScmTranslatorTest + extends TestCase +{ + private ClearCaseScmTranslator scmTranslator = new ClearCaseScmTranslator(); + + /** + * @see org.apache.maven.model.Scm#getTag() + */ + public void testResolveTag() + { + // with current implementation you can't call your tag 'HEAD' (which is the default) + assertEquals( null, scmTranslator.resolveTag( "HEAD" ) ); + assertEquals( "project-1.0", scmTranslator.resolveTag( "project-1.0" ) ); + } + + public void testTranslateTagUrl() + { + assertEquals( "url", scmTranslator.translateTagUrl( "url", "tag", null ) ); + assertEquals( "url", scmTranslator.translateTagUrl( "url", "tag", "tagBase" ) ); + } + + public void testTranslateBranchUrl() + { + assertEquals( "url", scmTranslator.translateBranchUrl( "url", "branchName", null ) ); + assertEquals( "url", scmTranslator.translateBranchUrl( "url", "branchName", "tagBase" ) ); + } + + public void testGetRelativePath() + { + assertEquals( "a/b/c", "a/b/c" ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/CvsScmTranslatorTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/CvsScmTranslatorTest.java new file mode 100644 index 000000000..dd35b89d5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/CvsScmTranslatorTest.java @@ -0,0 +1,55 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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 CvsScmTranslatorTest + extends TestCase +{ + private CvsScmTranslator scmTranslator = new CvsScmTranslator(); + + /** + * @see org.apache.maven.model.Scm#getTag() + */ + public void testResolveTag() + { + // with current implementation you can't call your tag 'HEAD' (which is the default) + assertEquals( null, scmTranslator.resolveTag( "HEAD" ) ); + assertEquals( "project-1.0", scmTranslator.resolveTag( "project-1.0" ) ); + } + + public void testTranslateTagUrl() + { + assertEquals( "url", scmTranslator.translateTagUrl( "url", "tag", null ) ); + assertEquals( "url", scmTranslator.translateTagUrl( "url", "tag", "tagBase" ) ); + } + + public void testTranslateBranchUrl() + { + assertEquals( "url", scmTranslator.translateBranchUrl( "url", "branchName", null ) ); + assertEquals( "url", scmTranslator.translateBranchUrl( "url", "branchName", "tagBase" ) ); + } + + public void testGetRelativePath() + { + assertEquals( "a/b/c", "a/b/c" ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/DefaultScmRepositoryConfiguratorTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/DefaultScmRepositoryConfiguratorTest.java new file mode 100644 index 000000000..985e6cf29 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/DefaultScmRepositoryConfiguratorTest.java @@ -0,0 +1,221 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.provider.ScmProviderRepositoryWithHost; +import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.settings.Server; +import org.apache.maven.settings.Settings; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.config.ReleaseUtils; +import org.codehaus.plexus.PlexusTestCase; + +/** + * Test the default SCM repository configurator. + * + * @author Brett Porter + */ +public class DefaultScmRepositoryConfiguratorTest + extends PlexusTestCase +{ + private ScmRepositoryConfigurator scmRepositoryConfigurator; + + private static final int CVS_PORT = 2401; + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + + scmRepositoryConfigurator = (ScmRepositoryConfigurator) lookup( ScmRepositoryConfigurator.class ); + } + + public void testGetConfiguredRepository() + throws ScmRepositoryException, NoSuchScmProviderException + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmRepository repository = scmRepositoryConfigurator.getConfiguredRepository( ReleaseUtils.buildReleaseDescriptor( builder ), null ); + + assertEquals( "check provider", "cvs", repository.getProvider() ); + assertEquals( "check username", "anoncvs", repository.getProviderRepository().getUser() ); + assertNull( "check password", repository.getProviderRepository().getPassword() ); + } + + public void testGetConfiguredRepositoryWithUsernameAndPassword() + throws ScmRepositoryException, NoSuchScmProviderException + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( "username", "password" ); + + ScmRepository repository = scmRepositoryConfigurator.getConfiguredRepository( ReleaseUtils.buildReleaseDescriptor( builder ), null ); + + assertEquals( "check username", "username", repository.getProviderRepository().getUser() ); + assertEquals( "check password", "password", repository.getProviderRepository().getPassword() ); + } + + public void testGetConfiguredRepositoryWithTagBase() + throws ScmRepositoryException, NoSuchScmProviderException + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm:svn:http://localhost/home/svn/module/trunk" ); + builder.setScmTagBase( "http://localhost/home/svn/module/tags" ); + + ScmRepository repository = scmRepositoryConfigurator.getConfiguredRepository( ReleaseUtils.buildReleaseDescriptor( builder ), null ); + + SvnScmProviderRepository providerRepository = (SvnScmProviderRepository) repository.getProviderRepository(); + assertEquals( "check tag base", "http://localhost/home/svn/module/tags", providerRepository.getTagBase() ); + } + + public void testGetConfiguredRepositoryWithHost() + throws ScmRepositoryException, NoSuchScmProviderException + { + Settings settings = new Settings(); + Server server = new Server(); + server.setId( "localhost:" + CVS_PORT ); + server.setUsername( "settings-username" ); + server.setPassword( "settings-password" ); + server.setPrivateKey( "settings-private-key" ); + server.setPassphrase( "settings-passphrase" ); + settings.addServer( server ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm:cvs:pserver:anoncvs@localhost:/home/cvs:module" ); + + ScmRepository repository = scmRepositoryConfigurator.getConfiguredRepository( ReleaseUtils.buildReleaseDescriptor( builder ), settings ); + + ScmProviderRepositoryWithHost providerRepository = + (ScmProviderRepositoryWithHost) repository.getProviderRepository(); + assertEquals( "check host", "localhost", providerRepository.getHost() ); + assertEquals( "check port", CVS_PORT, providerRepository.getPort() ); + assertEquals( "check username", "settings-username", providerRepository.getUser() ); + assertEquals( "check password", "settings-password", providerRepository.getPassword() ); + assertEquals( "check private key", "settings-private-key", providerRepository.getPrivateKey() ); + assertEquals( "check passphrase", "settings-passphrase", providerRepository.getPassphrase() ); + } + + public void testGetConfiguredRepositoryWithEncryptedPasswords() + throws ScmRepositoryException, NoSuchScmProviderException + { + Settings settings = new Settings(); + Server server = new Server(); + server.setId( "localhost" ); + server.setUsername( "testuser" ); + server.setPassword( "{Ael0S2tnXv8H3X+gHKpZAvAA25D8+gmU2w2RrGaf5v8=}" ); + server.setPassphrase( "{7zK9P8hNVeUHbTsjiA/vnOs0zUXbND+9MBNPvdvl+x4=}" ); + settings.addServer( server ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm:svn:svn://localhost/repo" ); + + ScmRepository repository = scmRepositoryConfigurator.getConfiguredRepository( ReleaseUtils.buildReleaseDescriptor( builder ), settings ); + + ScmProviderRepositoryWithHost providerRepository = + (ScmProviderRepositoryWithHost) repository.getProviderRepository(); + assertEquals( "check host", "localhost", providerRepository.getHost() ); + assertEquals( "check username", "testuser", providerRepository.getUser() ); + assertEquals( "check password", "testpass", providerRepository.getPassword() ); + assertEquals( "check passphrase", "testphrase", providerRepository.getPassphrase() ); + } + + public void testGetConfiguredRepositoryInvalidScmUrl() + throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm-url" ); + + try + { + scmRepositoryConfigurator.getConfiguredRepository( ReleaseUtils.buildReleaseDescriptor( builder ), null ); + + fail( "Expected failure to get a repository with an invalid SCM URL" ); + } + catch ( IllegalArgumentException e ) + { + // expected + } + } + + public void testGetConfiguredRepositoryInvalidScmProvider() + throws ScmRepositoryException + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm:url:" ); + + try + { + scmRepositoryConfigurator.getConfiguredRepository( ReleaseUtils.buildReleaseDescriptor( builder ), null ); + + fail( "Expected failure to get a repository with an invalid SCM URL" ); + } + catch ( NoSuchScmProviderException e ) + { + // expected + } + } + + public void testGetConfiguredRepositoryInvalidScmUrlParameters() + throws NoSuchScmProviderException + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm:cvs:" ); + + try + { + scmRepositoryConfigurator.getConfiguredRepository( ReleaseUtils.buildReleaseDescriptor( builder ), null ); + + fail( "Expected failure to get a repository with an invalid SCM URL" ); + } + catch ( ScmRepositoryException e ) + { + // expected + } + } + + public void testGetRepositoryProvider() + throws ScmRepositoryException, NoSuchScmProviderException + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + + ScmRepository repository = scmRepositoryConfigurator.getConfiguredRepository( ReleaseUtils.buildReleaseDescriptor( builder ), null ); + + ScmProvider provider = scmRepositoryConfigurator.getRepositoryProvider( repository ); + assertEquals( "Check SCM provider", "cvs", provider.getScmType() ); + } + + private static ReleaseDescriptorBuilder createReleaseDescriptorBuilder() + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setScmSourceUrl( "scm:cvs:pserver:anoncvs@localhost:/home/cvs:module" ); + return builder; + } + + private static ReleaseDescriptorBuilder createReleaseDescriptorBuilder( String username, String password ) + { + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder(); + builder.setScmUsername( username ); + builder.setScmPassword( password ); + return builder; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/GitScmTranslatorTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/GitScmTranslatorTest.java new file mode 100644 index 000000000..3fddafa76 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/GitScmTranslatorTest.java @@ -0,0 +1,55 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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 GitScmTranslatorTest + extends TestCase +{ + + private GitScmTranslator scmTranslator = new GitScmTranslator(); + + /** + * @see org.apache.maven.model.Scm#getTag() + */ + public void testResolveTag() + { + assertEquals( "HEAD", scmTranslator.resolveTag( "HEAD" ) ); + assertEquals( "project-1.0", scmTranslator.resolveTag( "project-1.0" ) ); + } + + public void testTranslateTagUrl() + { + assertEquals( "url", scmTranslator.translateTagUrl( "url", "tag", null ) ); + assertEquals( "url", scmTranslator.translateTagUrl( "url", "tag", "tagBase" ) ); + } + + public void testTranslateBranchUrl() + { + assertEquals( "url", scmTranslator.translateBranchUrl( "url", "branchName", null ) ); + assertEquals( "url", scmTranslator.translateBranchUrl( "url", "branchName", "tagBase" ) ); + } + + public void testGetRelativePath() + { + assertEquals( "a/b/c", "a/b/c" ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/HgScmTranslatorTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/HgScmTranslatorTest.java new file mode 100644 index 000000000..8a8cd0ca3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/HgScmTranslatorTest.java @@ -0,0 +1,54 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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 HgScmTranslatorTest + extends TestCase +{ + private HgScmTranslator scmTranslator = new HgScmTranslator(); + + /** + * @see org.apache.maven.model.Scm#getTag() + */ + public void testResolveTag() + { + assertEquals( "HEAD", scmTranslator.resolveTag( "HEAD" ) ); + assertEquals( "project-1.0", scmTranslator.resolveTag( "project-1.0" ) ); + } + + public void testTranslateTagUrl() + { + assertEquals( "url", scmTranslator.translateTagUrl( "url", "tag", null ) ); + assertEquals( "url", scmTranslator.translateTagUrl( "url", "tag", "tagBase" ) ); + } + + public void testTranslateBranchUrl() + { + assertEquals( "url", scmTranslator.translateBranchUrl( "url", "branchName", null ) ); + assertEquals( "url", scmTranslator.translateBranchUrl( "url", "branchName", "tagBase" ) ); + } + + public void testGetRelativePath() + { + assertEquals( "a/b/c", "a/b/c" ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/JazzScmTranslatorTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/JazzScmTranslatorTest.java new file mode 100644 index 000000000..7c55b2c3a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/JazzScmTranslatorTest.java @@ -0,0 +1,60 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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; + +public class JazzScmTranslatorTest + extends TestCase +{ + + private JazzScmTranslator scmTranslator = new JazzScmTranslator(); + + /** + * @see org.apache.maven.model.Scm#getTag() + */ + public void testResolveTag() + { + assertNull( scmTranslator.resolveTag( "HEAD" ) ); + assertNull( scmTranslator.resolveTag( "project-1.0" ) ); + } + + public void testTranslateTagUrl() + { + assertEquals( "url:tag", scmTranslator.translateTagUrl( "url:module", "tag", null ) ); + assertEquals( "url:tag", scmTranslator.translateTagUrl( "url:module", "tag", "tagBase" ) ); + } + + public void testTranslateBranchUrl() + { + assertEquals( "url:branchName", scmTranslator.translateBranchUrl( "url:module", "branchName", null ) ); + assertEquals( "url:branchName", scmTranslator.translateBranchUrl( "url:module", "branchName", "tagBase" ) ); + } + + public void testGetRelativePath() + { + assertEquals( "BogusTest" + File.separator + "release.properties", scmTranslator.toRelativePath( "BogusTest/release.properties" ) ); + assertEquals( "BogusTest" + File.separator + "release.properties", scmTranslator.toRelativePath( "/BogusTest/release.properties" ) ); + assertEquals( "BogusTest" + File.separator + "release.properties", scmTranslator.toRelativePath( "BogusTest\\release.properties" ) ); + assertEquals( "BogusTest" + File.separator + "release.properties", scmTranslator.toRelativePath( "\\BogusTest\\release.properties" ) ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/SubversionScmTranslatorTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/SubversionScmTranslatorTest.java new file mode 100644 index 000000000..ca7ac377e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/scm/SubversionScmTranslatorTest.java @@ -0,0 +1,56 @@ +package org.apache.maven.shared.release.scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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 SubversionScmTranslatorTest + extends TestCase +{ + + private SubversionScmTranslator scmTranslator = new SubversionScmTranslator(); + + /** + * @see org.apache.maven.model.Scm#getTag() + */ + public void testResolveTag() + { + // "HEAD"is default + assertNull( scmTranslator.resolveTag( "HEAD" ) ); + assertNull( scmTranslator.resolveTag( "project-1.0" ) ); + } + + public void testTranslateTagUrl() + { + assertEquals( "url/tags/tag", scmTranslator.translateTagUrl( "url", "tag", null ) ); + assertEquals( "tagBase/tag", scmTranslator.translateTagUrl( "url", "tag", "tagBase" ) ); + } + + public void testTranslateBranchUrl() + { + assertEquals( "url/branches/branchName", scmTranslator.translateBranchUrl( "url", "branchName", null ) ); + assertEquals( "tagBase/branchName", scmTranslator.translateBranchUrl( "url", "branchName", "tagBase" ) ); + } + + public void testGetRelativePath() + { + assertEquals( "a/b/c", "a/b/c" ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/stubs/MavenExecutorWrapper.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/stubs/MavenExecutorWrapper.java new file mode 100644 index 000000000..af71c6115 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/stubs/MavenExecutorWrapper.java @@ -0,0 +1,47 @@ +package org.apache.maven.shared.release.stubs; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.shared.release.ReleaseResult; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.apache.maven.shared.release.exec.MavenExecutor; +import org.apache.maven.shared.release.exec.MavenExecutorException; + +public class MavenExecutorWrapper implements MavenExecutor +{ + private MavenExecutor executor; + + public void setMavenExecutor( MavenExecutor executor ) + { + this.executor = executor; + } + + @Override + public void executeGoals( File workingDirectory, String goals, ReleaseEnvironment releaseEnvironment, + boolean interactive, String additionalArguments, String pomFileName, + ReleaseResult result ) + throws MavenExecutorException + { + executor.executeGoals( workingDirectory, goals, releaseEnvironment, interactive, additionalArguments, + pomFileName, result ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/stubs/NamingPolicyStub.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/stubs/NamingPolicyStub.java new file mode 100644 index 000000000..477bdb506 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/stubs/NamingPolicyStub.java @@ -0,0 +1,40 @@ +package org.apache.maven.shared.release.stubs; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.policy.PolicyException; +import org.apache.maven.shared.release.policy.naming.NamingPolicy; +import org.apache.maven.shared.release.policy.naming.NamingPolicyRequest; +import org.apache.maven.shared.release.policy.naming.NamingPolicyResult; + +/** + * A NamingPolicy stub, always return STUB as name + * @author Robert Scholte + * + */ +public class NamingPolicyStub implements NamingPolicy +{ + @Override + public NamingPolicyResult getName( NamingPolicyRequest request ) + throws PolicyException + { + return new NamingPolicyResult().setName( "STUB" ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/stubs/ScmManagerStub.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/stubs/ScmManagerStub.java new file mode 100644 index 000000000..a901c9064 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/stubs/ScmManagerStub.java @@ -0,0 +1,82 @@ +package org.apache.maven.shared.release.stubs; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.HashMap; +import java.util.Map; + +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; + +/** + * Override the makeRepository methods to honour the URL passed in. + */ +public class ScmManagerStub + extends org.apache.maven.scm.manager.ScmManagerStub +{ + private Exception e; + + private Map scmRepositoriesForUrl = new HashMap<>(); + + @Override + public ScmRepository makeScmRepository( String scmUrl ) + throws ScmRepositoryException, NoSuchScmProviderException + { + if ( e != null ) + { + if ( e instanceof ScmRepositoryException ) + { + throw (ScmRepositoryException) e; + } + else if ( e instanceof NoSuchScmProviderException ) + { + throw (NoSuchScmProviderException) e; + } + else + { + throw new RuntimeException( e ); + } + } + + if ( scmRepositoriesForUrl.isEmpty() ) + { + // we didn't configure any for URLs, return the preset one + return getScmRepository(); + } + + ScmRepository repository = scmRepositoriesForUrl.get( scmUrl ); + if ( repository == null ) + { + throw new ScmRepositoryException( "Unexpected URL: " + scmUrl ); + } + return repository; + } + + public void addScmRepositoryForUrl( String url, ScmRepository repository ) + { + scmRepositoriesForUrl.put( url, repository ); + } + + public void setException( Exception e ) + { + this.e = e; + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomBuildTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomBuildTest.java new file mode 100644 index 000000000..1b5939207 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomBuildTest.java @@ -0,0 +1,306 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.io.StringReader; + +import org.jdom.Document; +import org.jdom.input.SAXBuilder; +import org.junit.Test; + +public class JDomBuildTest +{ + private SAXBuilder builder = new SAXBuilder(); + + @Test + public void testGetExtensions() throws Exception + { + String content = ""; + Document document = builder.build( new StringReader( content ) ); + assertNotNull( new JDomBuild( document.getRootElement() ).getExtensions() ); + assertEquals( 0, new JDomBuild( document.getRootElement() ).getExtensions().size() ); + + content = ""; + document = builder.build( new StringReader( content ) ); + assertEquals( 0, new JDomBuild( document.getRootElement() ).getExtensions().size() ); + + content = ""; + document = builder.build( new StringReader( content ) ); + assertEquals( 1, new JDomBuild( document.getRootElement() ).getExtensions().size() ); + + } + + @Test + public void testGetPluginManagement() throws Exception + { + String content = ""; + Document document = builder.build( new StringReader( content ) ); + assertNull( new JDomBuild( document.getRootElement() ).getPluginManagement() ); + + content = ""; + document = builder.build( new StringReader( content ) ); + assertNotNull( new JDomBuild( document.getRootElement() ).getPluginManagement() ); + } + + @Test + public void testGetPlugins() throws Exception + { + String content = ""; + Document document = builder.build( new StringReader( content ) ); + assertNotNull( new JDomBuild( document.getRootElement() ).getPlugins() ); + assertEquals( 0, new JDomBuild( document.getRootElement() ).getPlugins().size() ); + + content = ""; + document = builder.build( new StringReader( content ) ); + assertEquals( 0, new JDomBuild( document.getRootElement() ).getPlugins().size() ); + + content = ""; + document = builder.build( new StringReader( content ) ); + assertEquals( 1, new JDomBuild( document.getRootElement() ).getPlugins().size() ); + } + + // All other methods throw UnsupportedOperationException + + @Test( expected = UnsupportedOperationException.class ) + public void testFlushPluginMap() + { + new JDomBuild( null ).flushPluginMap(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testAddExtension() + { + new JDomBuild( null ).addExtension( null );; + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetOutputDirectory() + { + new JDomBuild( null ).getOutputDirectory(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetScriptSourceDirectory() + { + new JDomBuild( null ).getScriptSourceDirectory(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetSourceDirectory() + { + new JDomBuild( null ).getSourceDirectory(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetTestOutputDirectory() + { + new JDomBuild( null ).getTestOutputDirectory(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetTestSourceDirectory() + { + new JDomBuild( null ).getTestSourceDirectory(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testRemoveExtension() + { + new JDomBuild( null ).removeExtension( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetExtensions() + { + new JDomBuild( null ).setExtensions( null );; + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetOutputDirectory() + { + new JDomBuild( null ).setOutputDirectory( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetScriptSourceDirectory() + { + new JDomBuild( null ).setScriptSourceDirectory( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetSourceDirectory() + { + new JDomBuild( null ).setSourceDirectory( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetTestOutputDirectoryString() + { + new JDomBuild( null ).setTestOutputDirectory( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetTestSourceDirectory() + { + new JDomBuild( null ).setTestSourceDirectory( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testAddFilter() + { + new JDomBuild( null ).addFilter( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testAddResource() + { + new JDomBuild( null ).addResource( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testAddTestResource() + { + new JDomBuild( null ).addTestResource( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetDefaultGoal() + { + new JDomBuild( null ).getDefaultGoal(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetDirectory() + { + new JDomBuild( null ).getDirectory(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetFilters() + { + new JDomBuild( null ).getFilters(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetFinalName() + { + new JDomBuild( null ).getFinalName(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetResources() + { + new JDomBuild( null ).getResources(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetTestResources() + { + new JDomBuild( null ).getTestResources(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testRemoveFilter() + { + new JDomBuild( null ).removeFilter( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testRemoveResource() + { + new JDomBuild( null ).removeResource( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testRemoveTestResource() + { + new JDomBuild( null ).removeTestResource( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetDefaultGoal() + { + new JDomBuild( null ).setDefaultGoal( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetDirectory() + { + new JDomBuild( null ).setDirectory( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetFilters() + { + new JDomBuild( null ).setFilters( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetFinalName() + { + new JDomBuild( null ).setFinalName( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetResources() + { + new JDomBuild( null ).setResources( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetTestResources() + { + new JDomBuild( null ).setTestResources( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetPluginManagement() + { + new JDomBuild( null ).setPluginManagement( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testAddPlugin() + { + new JDomBuild( null ).addPlugin( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testRemovePlugin() + { + new JDomBuild( null ).removePlugin( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetPlugins() + { + new JDomBuild( null ).setPlugins( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetPluginsAsMap() + { + new JDomBuild( null ).getPluginsAsMap(); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomDependencyManagementTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomDependencyManagementTest.java new file mode 100644 index 000000000..82adbc08e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomDependencyManagementTest.java @@ -0,0 +1,71 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.StringReader; + +import org.jdom.Document; +import org.jdom.input.SAXBuilder; +import org.junit.Test; + +public class JDomDependencyManagementTest +{ + private SAXBuilder builder = new SAXBuilder(); + + @Test + public void testGetDependencies() throws Exception + { + String content = ""; + Document document = builder.build( new StringReader( content ) ); + assertNotNull( new JDomDependencyManagement( document.getRootElement() ).getDependencies() ); + assertEquals( 0, new JDomDependencyManagement( document.getRootElement() ).getDependencies().size() ); + + content = ""; + document = builder.build( new StringReader( content ) ); + assertEquals( 0, new JDomDependencyManagement( document.getRootElement() ).getDependencies().size() ); + + content = ""; + document = builder.build( new StringReader( content ) ); + assertEquals( 1, new JDomDependencyManagement( document.getRootElement() ).getDependencies().size() ); + } + + // All other methods throw UnsupportedOperationException + + @Test( expected = UnsupportedOperationException.class ) + public void testAddDependency() + { + new JDomDependencyManagement( null ).addDependency( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testRemoveDependency() + { + new JDomDependencyManagement( null ).addDependency( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetDependenciesListOfDependency() + { + new JDomDependencyManagement( null ).setDependencies( null ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomDependencyTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomDependencyTest.java new file mode 100644 index 000000000..1cb36a2a5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomDependencyTest.java @@ -0,0 +1,186 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.io.StringReader; + +import org.jdom.Element; +import org.jdom.input.SAXBuilder; +import org.junit.Test; + +public class JDomDependencyTest +{ + private SAXBuilder builder = new SAXBuilder(); + + @Test( expected = UnsupportedOperationException.class ) + public void testIsOptional() + { + new JDomDependency( null ).isOptional(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetOptional() + { + new JDomDependency( null ).setOptional( true ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testAddExclusion() + { + new JDomDependency( null ).addExclusion( null ); + } + + @Test + public void testGetArtifactId() throws Exception + { + String content = ""; + Element dependencyElm = builder.build( new StringReader( content ) ).getRootElement(); + assertNull( new JDomDependency( dependencyElm ).getArtifactId() ); + + content = "ARTIFACTID"; + dependencyElm = builder.build( new StringReader( content ) ).getRootElement(); + assertEquals( "ARTIFACTID", new JDomDependency( dependencyElm ).getArtifactId() ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetClassifier() + { + new JDomDependency( null ).getClassifier(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetExclusions() + { + new JDomDependency( null ).getExclusions(); + } + + @Test + public void testGetGroupId() throws Exception + { + String content = ""; + Element dependencyElm = builder.build( new StringReader( content ) ).getRootElement(); + assertNull( new JDomDependency( dependencyElm ).getGroupId() ); + + content = "GROUPID"; + dependencyElm = builder.build( new StringReader( content ) ).getRootElement(); + assertEquals( "GROUPID", new JDomDependency( dependencyElm ).getGroupId() ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetScope() + { + new JDomDependency( null ).getScope(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetSystemPath() + { + new JDomDependency( null ).getSystemPath(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetType() + { + new JDomDependency( null ).getType(); + } + + @Test + public void testGetVersion() throws Exception + { + String content = ""; + Element dependencyElm = builder.build( new StringReader( content ) ).getRootElement(); + assertNull( new JDomDependency( dependencyElm ).getVersion() ); + + content = "VERSION"; + dependencyElm = builder.build( new StringReader( content ) ).getRootElement(); + assertEquals( "VERSION", new JDomDependency( dependencyElm ).getVersion() ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testRemoveExclusion() + { + new JDomDependency( null ).removeExclusion( null );; + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetArtifactIdString() + { + new JDomDependency( null ).setArtifactId( null );; + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetClassifierString() + { + new JDomDependency( null ).setClassifier( null );; + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetExclusions() + { + new JDomDependency( null ).setExclusions( null );; + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetGroupIdString() + { + new JDomDependency( null ).setGroupId( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetScopeString() + { + new JDomDependency( null ).setScope( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetSystemPathString() + { + new JDomDependency( null ).setSystemPath( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetTypeString() + { + new JDomDependency( null ).setType( null ); + } + + @Test + public void testSetVersionString() throws Exception + { + String content = "OLD_VERSION"; + Element dependencyElm = builder.build( new StringReader( content ) ).getRootElement(); + new JDomDependency( dependencyElm ).setVersion( "NEW_VERSION" ); + assertEquals( "NEW_VERSION", getVersion( dependencyElm ) ); + } + + @Test + public void testGetName() + { + assertEquals( "dependency", new JDomDependency( null ).getName() ); + } + + private String getVersion( Element dependencyElm ) + { + return dependencyElm.getChildTextTrim( "version", dependencyElm.getNamespace() ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomExtensionTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomExtensionTest.java new file mode 100644 index 000000000..c42ffdb62 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomExtensionTest.java @@ -0,0 +1,102 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.io.StringReader; + +import org.jdom.Element; +import org.jdom.input.SAXBuilder; +import org.junit.Test; + +public class JDomExtensionTest +{ + private SAXBuilder builder = new SAXBuilder(); + + @Test + public void testGetArtifactId() throws Exception + { + String content = ""; + Element extensionElm = builder.build( new StringReader( content ) ).getRootElement(); + assertNull( new JDomExtension( extensionElm ).getArtifactId() ); + + content = "ARTIFACTID"; + extensionElm = builder.build( new StringReader( content ) ).getRootElement(); + assertEquals( "ARTIFACTID", new JDomExtension( extensionElm ).getArtifactId() ); + } + + @Test + public void testGetGroupId() throws Exception + { + String content = ""; + Element extensionElm = builder.build( new StringReader( content ) ).getRootElement(); + assertNull( new JDomExtension( extensionElm ).getGroupId() ); + + content = "GROUPID"; + extensionElm = builder.build( new StringReader( content ) ).getRootElement(); + assertEquals( "GROUPID", new JDomExtension( extensionElm ).getGroupId() ); + } + + @Test + public void testGetVersion() throws Exception + { + String content = ""; + Element extensionElm = builder.build( new StringReader( content ) ).getRootElement(); + assertNull( new JDomExtension( extensionElm ).getVersion() ); + + content = "VERSION"; + extensionElm = builder.build( new StringReader( content ) ).getRootElement(); + assertEquals( "VERSION", new JDomExtension( extensionElm ).getVersion() ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetArtifactId() + { + new JDomExtension( null ).setArtifactId( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetGroupId() + { + new JDomExtension( null ).setGroupId( null ); + } + + @Test + public void testSetVersion() throws Exception + { + String content = "OLD_VERSION"; + Element extensionElm = builder.build( new StringReader( content ) ).getRootElement(); + new JDomExtension( extensionElm ).setVersion( "NEW_VERSION" ); + assertEquals( "NEW_VERSION", getVersion( extensionElm ) ); + } + + @Test + public void testGetName() + { + assertEquals( "extension", new JDomExtension( null ).getName() ); + } + + private String getVersion( Element extensionElm ) + { + return extensionElm.getChildTextTrim( "version", extensionElm.getNamespace() ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomModelTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomModelTest.java new file mode 100644 index 000000000..e17f0711d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomModelTest.java @@ -0,0 +1,98 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.io.StringReader; + +import org.apache.maven.model.Model; +import org.apache.maven.model.Scm; +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.input.SAXBuilder; +import org.junit.Test; + +public class JDomModelTest +{ + private SAXBuilder builder = new SAXBuilder(); + + @Test + public void testGetScm() throws Exception + { + String content = ""; + Document document = builder.build( new StringReader( content ) ); + assertNull( new JDomModel( document ).getScm() ); + } + + @Test + public void testSetScm() throws Exception + { + String content = ""; + Document document = builder.build( new StringReader( content ) ); + Model model = new JDomModel( document ); + assertNull( model.getScm() ); + + model.setScm( new Scm() ); + assertNotNull( model.getScm() ); + + model.setScm( null ); + assertNull( model.getScm() ); + } + + @Test + public void testSetVersion() throws Exception + { + String content = ""; + Element projectElm = builder.build( new StringReader( content ) ).getRootElement(); + Model model = new JDomModel( projectElm ); + assertNull( model.getVersion() ); + + model.setVersion( "VERSION" ); + assertEquals( "VERSION", getVersion( projectElm ) ); + + model.setVersion( null ); + assertNull( model.getVersion() ); + + // inherit from parent + // this business logic might need to moved. + content = "PARENT_VERSION"; + projectElm = builder.build( new StringReader( content ) ).getRootElement(); + model = new JDomModel( projectElm ); + assertNull( model.getVersion() ); + + model.setVersion( "PARENT_VERSION" ); + assertNull( getVersion( projectElm ) ); + + model.setVersion( "VERSION" ); + assertEquals( "VERSION", getVersion( projectElm ) ); + + model.setVersion( null ); + assertNull( model.getVersion() ); + } + + private String getVersion( Element projectElm ) + { + return projectElm.getChildText( "version", projectElm.getNamespace() ); + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomParentTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomParentTest.java new file mode 100644 index 000000000..1cc0a59e8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomParentTest.java @@ -0,0 +1,101 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.*; + +import java.io.StringReader; + +import org.jdom.Element; +import org.jdom.input.SAXBuilder; +import org.junit.Test; + +public class JDomParentTest +{ + private SAXBuilder builder = new SAXBuilder(); + + @Test( expected = UnsupportedOperationException.class ) + public void testGetArtifactId() + { + new JDomParent( null ).getArtifactId(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetGroupId() + { + new JDomParent( null ).getGroupId(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetRelativePath() + { + new JDomParent( null ).getRelativePath(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetVersion() + { + new JDomParent( null ).getVersion(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetArtifactId() + { + new JDomParent( null ).setArtifactId( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetGroupId() + { + new JDomParent( null ).setGroupId( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSetRelativePath() + { + new JDomParent( null ).setRelativePath( null ); + } + + @Test + public void testSetVersionString() throws Exception + { + String content = ""; + Element parentElm = builder.build( new StringReader( content ) ).getRootElement(); + + assertNull( getVersion( parentElm ) ); + + new JDomParent( parentElm ).setVersion( "VERSION" ); + assertEquals( "VERSION", getVersion( parentElm ) ); + + new JDomParent( parentElm ).setVersion( null ); + assertNull( getVersion( parentElm ) ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetId() + { + new JDomParent( null ).getId(); + } + + private String getVersion( Element parentElm ) + { + return parentElm.getChildText( "version", parentElm.getNamespace() ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomPropertiesTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomPropertiesTest.java new file mode 100644 index 000000000..71b847ea3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomPropertiesTest.java @@ -0,0 +1,157 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.Reader; +import java.io.StringReader; +import java.io.Writer; + +import org.jdom.Element; +import org.jdom.input.SAXBuilder; +import org.junit.Test; + +public class JDomPropertiesTest +{ + private SAXBuilder builder = new SAXBuilder(); + + @Test + public void testSetProperty() throws Exception + { + String content = ""; + Element propertiesElm = builder.build( new StringReader( content ) ).getRootElement(); + assertNull( getProperty( propertiesElm, "KEY" ) ); + + // Adding not allowed, prepare properties + content = "OLD_VALUE"; + propertiesElm = builder.build( new StringReader( content ) ).getRootElement(); + assertEquals( "OLD_VALUE", getProperty( propertiesElm, "KEY" ) ); + new JDomProperties( propertiesElm ).setProperty( "KEY", "NEW_VALUE" ); + assertEquals( "NEW_VALUE", getProperty( propertiesElm, "KEY" ) ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testLoadReader() + throws Exception + { + new JDomProperties( null ).load( (Reader) null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testLoadInputStream() + throws Exception + { + new JDomProperties( null ).load( (InputStream) null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testSave() + { + new JDomProperties( null ).save( null, null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testStoreWriter() + throws Exception + { + new JDomProperties( null ).store( (Writer) null, null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testStoreOutputStream() + throws Exception + { + new JDomProperties( null ).store( (OutputStream) null, null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testLoadFromXML() + throws Exception + { + new JDomProperties( null ).loadFromXML( null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testStoreToXML() + throws Exception + { + new JDomProperties( null ).storeToXML( null, null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testStoreToXMLEncoded() + throws Exception + { + new JDomProperties( null ).storeToXML( (OutputStream) null, null, (String) null ); + } + + @Test + public void testGetProperty() throws Exception + { + String content = ""; + Element propertiesElm = builder.build( new StringReader( content ) ).getRootElement(); + assertNull( new JDomProperties( propertiesElm ).getProperty( "KEY" ) ); + + content = "VALUE"; + propertiesElm = builder.build( new StringReader( content ) ).getRootElement(); + assertEquals( "VALUE", new JDomProperties( propertiesElm ).getProperty( "KEY" ) ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetPropertyDefault() + { + new JDomProperties( null ).getProperty( null, null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testPropertyNames() + { + new JDomProperties( null ).propertyNames(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testStringPropertyNames() + { + new JDomProperties( null ).stringPropertyNames(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testListPrintStream() + { + new JDomProperties( null ).list( (PrintStream) null ); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testListPrintWriter() + { + new JDomProperties( null ).list( (PrintWriter) null ); + } + + private String getProperty( Element propertiesElm, String key ) + { + return propertiesElm.getChildText( key, propertiesElm.getNamespace() ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomScmTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomScmTest.java new file mode 100644 index 000000000..d9faa90d9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/transform/jdom/JDomScmTest.java @@ -0,0 +1,138 @@ +package org.apache.maven.shared.release.transform.jdom; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.io.StringReader; + +import org.jdom.Element; +import org.jdom.input.SAXBuilder; +import org.junit.Test; + +public class JDomScmTest +{ + private SAXBuilder builder = new SAXBuilder(); + + @Test( expected = UnsupportedOperationException.class ) + public void testGetConnection() + { + new JDomScm( null ).getConnection(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetDeveloperConnection() + { + new JDomScm( null ).getDeveloperConnection(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetTag() + { + new JDomScm( null ).getTag(); + } + + @Test( expected = UnsupportedOperationException.class ) + public void testGetUrl() + { + new JDomScm( null ).getUrl(); + } + + @Test + public void testSetConnectionString() throws Exception + { + String content = ""; + Element scmElm = builder.build( new StringReader( content ) ).getRootElement(); + + assertNull( getConnection( scmElm ) ); + + new JDomScm( scmElm ).setConnection( "CONNECTION" ); + assertEquals( "CONNECTION", getConnection( scmElm ) ); + + new JDomScm( scmElm ).setConnection( null ); + assertNull( getConnection( scmElm ) ); + } + + @Test + public void testSetDeveloperConnectionString() throws Exception + { + String content = ""; + Element scmElm = builder.build( new StringReader( content ) ).getRootElement(); + + assertNull( getDeveloperConnection( scmElm ) ); + + new JDomScm( scmElm ).setDeveloperConnection( "DEVELOPERCONNECTION" ); + assertEquals( "DEVELOPERCONNECTION", getDeveloperConnection( scmElm ) ); + + new JDomScm( scmElm ).setDeveloperConnection( null ); + assertNull( getDeveloperConnection( scmElm ) ); + } + + @Test + public void testSetTagString() throws Exception + { + String content = ""; + Element scmElm = builder.build( new StringReader( content ) ).getRootElement(); + + assertNull( getUrl( scmElm ) ); + + new JDomScm( scmElm ).setUrl( "URL" ); + assertEquals( "URL", getUrl( scmElm ) ); + + new JDomScm( scmElm ).setUrl( null ); + assertNull( getUrl( scmElm ) ); + } + + @Test + public void testSetUrlString() throws Exception + { + String content = ""; + Element scmElm = builder.build( new StringReader( content ) ).getRootElement(); + + assertNull( getTag( scmElm ) ); + + new JDomScm( scmElm ).setTag( "TAG" ); + assertEquals( "TAG", getTag( scmElm ) ); + + new JDomScm( scmElm ).setTag( null ); + assertNull( getTag( scmElm ) ); + } + + private String getConnection( Element scmElm ) + { + return scmElm.getChildText( "connection", scmElm.getNamespace() ); + } + + private String getDeveloperConnection( Element scmElm ) + { + return scmElm.getChildText( "developerConnection", scmElm.getNamespace() ); + } + + private String getTag( Element scmElm ) + { + return scmElm.getChildText( "tag", scmElm.getNamespace() ); + } + + private String getUrl( Element scmElm ) + { + return scmElm.getChildText( "url", scmElm.getNamespace() ); + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/util/PomFinderTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/util/PomFinderTest.java new file mode 100644 index 000000000..826379bf2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/util/PomFinderTest.java @@ -0,0 +1,75 @@ +package org.apache.maven.shared.release.util; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.PlexusTestCase; +import org.codehaus.plexus.logging.Logger; +import org.codehaus.plexus.logging.LoggerManager; + +import java.io.File; +import java.net.URL; + + +/** + * @author Mark Struberg + */ +public class PomFinderTest extends PlexusTestCase +{ + private Logger logger = null; + + @Override + protected void setUp() throws Exception + { + super.setUp(); + LoggerManager lm = (LoggerManager) lookup(LoggerManager.class); + logger = lm.getLoggerForComponent(LoggerManager.ROLE); //X TODO use a better class! + } + + public void testPomFinderParser() throws Exception + { + PomFinder pf = new PomFinder( logger ); + + boolean found = pf.parsePom( new File( "src/test/resources/pomfinder/pomNothere.xml" ) ); + assertFalse( found ); + + URL pomUrl = getClassLoader().getResource("pomfinder/pom1.xml"); + assertNotNull( pomUrl ); + + File pomFile = new File( pomUrl.getFile() ); + found = pf.parsePom( pomFile ); + assertTrue("pomFile not found pomUrl " + pomUrl + ", pomFile " + pomFile.getPath() , found ); + + { + File foundPom = pf.findMatchingPom( pomFile.getParentFile() ); + assertNotNull( foundPom ); + + assertEquals( pomFile.getAbsolutePath(), foundPom.getAbsolutePath() ); + } + + { + // try from 1 directory higher + File foundPom = pf.findMatchingPom( pomFile.getParentFile().getParentFile() ); + assertNotNull( foundPom ); + + assertEquals( pomFile.getAbsolutePath(), foundPom.getAbsolutePath() ); + } + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/util/ReleaseUtilTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/util/ReleaseUtilTest.java new file mode 100644 index 000000000..738898787 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/util/ReleaseUtilTest.java @@ -0,0 +1,225 @@ +package org.apache.maven.shared.release.util; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; + +import java.nio.file.Path; +import java.nio.file.Paths; + +import org.codehaus.plexus.util.Os; +import org.junit.Test; + +/** + * Tests for ReleaseUtil methods + */ +public class ReleaseUtilTest +{ + /** + * MRELEASE-273 : Tests if there no pom passed as parameter + */ + @Test + public void testProjectIsNull() + { + assertNull( ReleaseUtil.getReleasePom( null ) ); + assertNull( ReleaseUtil.getStandardPom( null ) ); + } + + @Test + public void testGetBaseScmUrlSingleLevel() + throws Exception + { + assertEquals( "scm:svn:http://svn.repo.com/flat-multi-module/trunk", + ReleaseUtil.realignScmUrl( 0, "scm:svn:http://svn.repo.com/flat-multi-module/trunk" ) ); + assertEquals( "scm:svn:http://svn.repo.com/flat-multi-module/trunk/", + ReleaseUtil.realignScmUrl( 0, "scm:svn:http://svn.repo.com/flat-multi-module/trunk/" ) ); + } + + @Test + public void testGetBaseScmUrlSingleLevelDotCharacter() + throws Exception + { + assertEquals( "scm:svn:http://svn.repo.com/flat-multi-module/trunk", + ReleaseUtil.realignScmUrl( 0, "scm:svn:http://svn.repo.com/flat-multi-module/trunk/." ) ); + assertEquals( "scm:svn:http://svn.repo.com/flat-multi-module/trunk/", + ReleaseUtil.realignScmUrl( 0, "scm:svn:http://svn.repo.com/flat-multi-module/trunk/./" ) ); + assertEquals( "scm:svn:http://svn.repo.com/flat-multi-module/trunk/project", + ReleaseUtil.realignScmUrl( 0, "scm:svn:http://svn.repo.com/flat-multi-module/trunk/./project" ) ); + assertEquals( "scm:svn:http://svn.repo.com/flat-multi-module", + ReleaseUtil.realignScmUrl( 0, "scm:svn:http://svn.repo.com/flat-multi-module/trunk/.." ) ); + assertEquals( "scm:svn:http://svn.repo.com/flat-multi-module/", + ReleaseUtil.realignScmUrl( 0, "scm:svn:http://svn.repo.com/flat-multi-module/trunk/../" ) ); + assertEquals( "scm:svn:http://svn.repo.com/flat-multi-module/branches", + ReleaseUtil.realignScmUrl( 0, "scm:svn:http://svn.repo.com/flat-multi-module/trunk/../branches" ) ); + } + + @Test + public void testGetBaseScmUrlReturnOriginal() + throws Exception + { + assertEquals( "no-path-elements", ReleaseUtil.realignScmUrl( 1, "no-path-elements" ) ); + assertEquals( "no-path-elements", ReleaseUtil.realignScmUrl( 15, "no-path-elements" ) ); + } + + @Test + public void testGetBaseScmUrlOfFlatMultiModule() + throws Exception + { + String actual = + ReleaseUtil.realignScmUrl( 1, "scm:svn:http://svn.repo.com/flat-multi-module/trunk/root-project" ); + assertEquals( "scm:svn:http://svn.repo.com/flat-multi-module/trunk", actual ); + + actual = ReleaseUtil.realignScmUrl( 1, "scm:svn:http://svn.repo.com/flat-multi-module/trunk/root-project/" ); + assertEquals( "scm:svn:http://svn.repo.com/flat-multi-module/trunk/", actual ); + } + + @Test + public void testGetBaseScmUrlOfFlatMultiModuleMultipleLevels() + throws Exception + { + String actual = + ReleaseUtil.realignScmUrl( 3, "scm:svn:http://svn.repo.com/flat-multi-module/trunk/root-project/1/2" ); + assertEquals( "scm:svn:http://svn.repo.com/flat-multi-module/trunk", actual ); + + actual = + ReleaseUtil.realignScmUrl( 3, "scm:svn:http://svn.repo.com/flat-multi-module/trunk/root-project/1/2/" ); + assertEquals( "scm:svn:http://svn.repo.com/flat-multi-module/trunk/", actual ); + } + + @Test + public void testGetBaseWorkingDirectoryParentCountSameDirectory() + { + Path workingDirectory = Paths.get( "/working/directory/maven/release" ); + Path basedir = Paths.get( "/working/directory/maven/release" ); + assertEquals( 0, ReleaseUtil.getBaseWorkingDirectoryParentCount( basedir, workingDirectory ) ); + } + + @Test + public void testGetBaseWorkingDirectoryParentCountSameDirectoryDotCharacter() + { + Path workingDirectory = Paths.get( "/working/directory/maven/release/." ).toAbsolutePath(); + assertTrue( workingDirectory.toString().contains( "." ) ); + Path basedir = Paths.get( "/working/directory/maven/release" ).toAbsolutePath(); + assertEquals( 0, ReleaseUtil.getBaseWorkingDirectoryParentCount( basedir, workingDirectory ) ); + + // finish with slash + workingDirectory = Paths.get( "/working/directory/maven/release/./" ).toAbsolutePath(); + assertTrue( workingDirectory.toString().contains( "." ) ); + basedir = Paths.get( "/working/directory/maven/release" ).toAbsolutePath(); + assertEquals( 0, ReleaseUtil.getBaseWorkingDirectoryParentCount( basedir, workingDirectory ) ); + } + + @Test + public void testGetBaseWorkingDirectoryParentCountSubdirectory() + { + Path workingDirectory = Paths.get( "/working/directory/maven/release" ).toAbsolutePath(); + Path basedir = Paths.get( "/working/directory/maven/release/maven-release-manager" ).toAbsolutePath(); + assertEquals( 0, ReleaseUtil.getBaseWorkingDirectoryParentCount( basedir, workingDirectory ) ); + } + + @Test + public void testGetBaseWorkingDirectoryParentCountParentDirectory() + { + Path workingDirectory = + Paths.get( "/working/directory/maven/release/maven-release-manager" ).toAbsolutePath(); + Path basedir = Paths.get( "/working/directory/maven/release" ).toAbsolutePath(); + assertEquals( 1, ReleaseUtil.getBaseWorkingDirectoryParentCount( basedir, workingDirectory ) ); + } + + @Test + public void testGetBaseWorkingDirectoryParentCountParentDirectoryDotCharacter() + { + Path workingDirectory = + Paths.get( "/working/directory/maven/release/maven-release-manager/." ).toAbsolutePath(); + assertTrue( workingDirectory.toString().contains( "." ) ); + Path basedir = Paths.get( "/working/directory/maven/release" ).toAbsolutePath(); + assertEquals( 1, ReleaseUtil.getBaseWorkingDirectoryParentCount( basedir, workingDirectory ) ); + + // finish with slash + workingDirectory = Paths.get( "/working/directory/maven/release/maven-release-manager/./" ).toAbsolutePath(); + assertTrue( workingDirectory.toString().contains( "." ) ); + basedir = Paths.get( "/working/directory/maven/release" ).toAbsolutePath(); + assertEquals( 1, ReleaseUtil.getBaseWorkingDirectoryParentCount( basedir, workingDirectory ) ); + } + + @Test + public void testGetBaseWorkingDirectoryParentCountParentDirectoryMultiple() + { + Path workingDirectory = + Paths.get( "/working/directory/maven/release/maven-release-manager" ).toAbsolutePath(); + Path basedir = Paths.get( "/working/directory" ).toAbsolutePath(); + assertEquals( 3, ReleaseUtil.getBaseWorkingDirectoryParentCount( basedir, workingDirectory ) ); + } + + @Test + public void testGetBaseWorkingDirectoryParentCountParentDirectoryMultipleDotCharacter() + { + Path workingDirectory = + Paths.get( "/working/directory/maven/release/maven-release-manager/./." ).toAbsolutePath(); + assertTrue( workingDirectory.toString().contains( "." ) ); + Path basedir = Paths.get( "/working/directory" ).toAbsolutePath(); + assertEquals( 3, ReleaseUtil.getBaseWorkingDirectoryParentCount( basedir, workingDirectory ) ); + + // finish with slash + workingDirectory = Paths.get( "/working/directory/maven/release/maven-release-manager/././" ).toAbsolutePath(); + assertTrue( workingDirectory.toString().contains( "." ) ); + basedir = Paths.get( "/working/directory" ).toAbsolutePath(); + assertEquals( 3, ReleaseUtil.getBaseWorkingDirectoryParentCount( basedir, workingDirectory ) ); + } + + @Test + public void testGetBaseWorkingDirectoryParentCountDifferentCase() + { + Path workingDirectory = + Paths.get( "/Working/Directory/maven/release/maven-release-manager" ).toAbsolutePath(); + Path basedir = Paths.get( "/working/directory" ).toAbsolutePath(); + assertEquals( 3, ReleaseUtil.getBaseWorkingDirectoryParentCount( basedir, workingDirectory ) ); + } + + /** + * MRELEASE-663 + */ + @Test + public void testGetWindowsRootBaseWorkingDirectoryParentCountDifferentCase() + { + assumeTrue( Os.isFamily( Os.FAMILY_WINDOWS ) ); + + assertEquals( 2, ReleaseUtil.getBaseWorkingDirectoryParentCount( Paths.get( "C:" ), + Paths.get( "C:\\working\\directory" ) ) ); + assertEquals( 2, ReleaseUtil.getBaseWorkingDirectoryParentCount( Paths.get( "C:" ), + Paths.get( "C:\\working\\directory\\" ) ) ); + assertEquals( 2, ReleaseUtil.getBaseWorkingDirectoryParentCount( Paths.get( "C:\\" ), + Paths.get( "C:\\working\\directory" ) ) ); + assertEquals( 2, ReleaseUtil.getBaseWorkingDirectoryParentCount( Paths.get( "C:\\" ), + Paths.get( "C:\\working\\directory\\" ) ) ); + + assertEquals( 2, ReleaseUtil.getBaseWorkingDirectoryParentCount( Paths.get( "c:" ), + Paths.get( "C:\\working\\directory" ) ) ); + assertEquals( 2, ReleaseUtil.getBaseWorkingDirectoryParentCount( Paths.get( "C:" ), + Paths.get( "c:\\working\\directory" ) ) ); + assertEquals( 2, ReleaseUtil.getBaseWorkingDirectoryParentCount( Paths.get( "c:" ), + Paths.get( "c:\\working\\directory" ) ) ); + + } + +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/versions/DefaultVersionInfoTest.java b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/versions/DefaultVersionInfoTest.java new file mode 100644 index 000000000..8603dc102 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/java/org/apache/maven/shared/release/versions/DefaultVersionInfoTest.java @@ -0,0 +1,373 @@ +package org.apache.maven.shared.release.versions; + +import java.util.Properties; + +import org.apache.maven.artifact.versioning.DefaultArtifactVersion; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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 DefaultVersionInfoTest + extends TestCase +{ + private String mavenVersion; + + @Override + protected void setUp() + throws Exception + { + Properties pomProperties = new Properties(); + pomProperties.load( DefaultArtifactVersion.class.getResourceAsStream( "/META-INF/maven/org.apache.maven/maven-artifact/pom.properties" ) ); + mavenVersion = pomProperties.getProperty( "version" ); + } + + public void testParse() + throws Exception + { + checkParsing( "1.0", "1.0", null, null, null ); + } + + public void testParseWithBadVersion() + throws Exception + { + try + { + checkParsing( "foo", null, null, null, "foo" ); + fail( "version is incorrect, must fail." ); + } + catch ( VersionParseException e ) + { + } + } + + public void testParseMultiDigit() + throws Exception + { + checkParsing( "99.99", "99.99", null, null, null ); + checkParsing( "990.990.990", "990.990.990", null, null, null ); + } + + public void testParseSnapshotVersion() + throws Exception + { + checkParsing( "SNAPSHOT", null, null, null, "SNAPSHOT" ); + checkParsing( "1.0-beta-4-SNAPSHOT", "1.0", "beta", "4", "SNAPSHOT" ); + checkParsing( "1.0-beta-4_SNAPSHOT", "1.0", "beta", "4", "SNAPSHOT" ); + } + + public void testParseAnnotationVersion() + throws Exception + { + checkParsing( "1.0-beta-4-SNAPSHOT", "1.0", "beta", "4", "SNAPSHOT" ); + checkParsing( "1.0-beta-4", "1.0", "beta", "4", null ); + checkParsing( "1.2.3-beta-99", "1.2.3", "beta", "99", null ); + checkParsing( "1.2.3-beta99", "1.2.3", "beta", "99", null ); + checkParsing( "1.2.3-beta99-SNAPSHOT", "1.2.3", "beta", "99", "SNAPSHOT" ); + checkParsing( "1.2.3-RC4", "1.2.3", "RC", "4", null ); + } + + public void testParseSeparators() + throws Exception + { + checkParsing( "1.2.9-beta-9-SNAPSHOT", "1.2.9", "beta", "9", "SNAPSHOT" ); + checkParsing( "1.2.9beta9SNAPSHOT", "1.2.9", "beta", "9", "SNAPSHOT" ); + checkParsing( "1.2.9beta-9SNAPSHOT", "1.2.9", "beta", "9", "SNAPSHOT" ); + checkParsing( "1.2.9_beta_9_SNAPSHOT", "1.2.9", "beta", "9", "SNAPSHOT" ); + } + + public void testParseAnnotationNoVersionButSnapshot() + throws Exception + { + checkParsing( "1.0-beta-SNAPSHOT", "1.0", "beta", null, "SNAPSHOT" ); + checkParsing( "1.2.3-beta99", "1.2.3", "beta", "99", null ); + checkParsing( "1.2.3-RC4-SNAPSHOT", "1.2.3", "RC", "4", "SNAPSHOT" ); + } + + public void testParseAnnotationVersionWithRevision() + throws Exception + { + checkParsing( "1.0-beta-4-SNAPSHOT", "1.0", "beta", "4", "SNAPSHOT" ); + checkParsing( "1.0-beta-4", "1.0", "beta", "4", null ); + checkParsing( "1.2.3-beta-99", "1.2.3", "beta", "99", null ); + checkParsing( "1.2.3-beta99", "1.2.3", "beta", "99", null ); + checkParsing( "1.2.3-RC4", "1.2.3", "RC", "4", null ); + + checkParsing( "1.2.9", "1.2.9", null, null, null ); + } + + public void testParseAnnotationVersionWithoutRevision() + throws Exception + { + checkParsing( "1.0-beta", "1.0", "beta", null, null ); + checkParsing( "1.0-beta-SNAPSHOT", "1.0", "beta", null, "SNAPSHOT" ); + } + + public void testParseAnnotationRevisionOnly() + throws Exception + { + checkParsing( "1.0-4", "1.0", null, "4", null ); + } + + public void testParseLeadingZeros() + throws Exception + { + checkParsing( "1.01-beta-04-SNAPSHOT", "1.01", "beta", "04", "SNAPSHOT" ); + checkParsing( "01.01.001-beta-04-SNAPSHOT", "01.01.001", "beta", "04", "SNAPSHOT" ); + } + + public void testParseBuildNumber() + throws Exception + { + checkParsing( "1.0-alpha-2-20051013.095555-2", "1.0", "alpha", "2", "20051013.095555-2" ); + } + + public void testNextVersion() + throws Exception + { + VersionInfo v = new DefaultVersionInfo( "SNAPSHOT" ); + assertNull( v.getNextVersion() ); + + checkNextVersion( "1", "2" ); + checkNextVersion( "1.01", "1.02" ); + checkNextVersion( "1.9", "1.10" ); + checkNextVersion( "1.09", "1.10" ); + checkNextVersion( "1.009", "1.010" ); + + checkNextVersion( "1.99", "1.100" ); + + //MRELEASE-623 SNAPSHOT is case-insensitive + checkNextVersion( "2.2-SNAPshot", "2.3-SNAPshot" ); + } + + public void testNextAnnotationRevision() + throws Exception + { + checkNextVersion( "1.01-beta-04", "1.01-beta-05" ); + checkNextVersion( "1.01-beta-04-SNAPSHOT", "1.01-beta-05-SNAPSHOT" ); + checkNextVersion( "9.99.999-beta-9-SNAPSHOT", "9.99.999-beta-10-SNAPSHOT" ); + checkNextVersion( "9.99.999-beta-09-SNAPSHOT", "9.99.999-beta-10-SNAPSHOT" ); + checkNextVersion( "9.99.999-beta-009-SNAPSHOT", "9.99.999-beta-010-SNAPSHOT" ); + checkNextVersion( "9.99.999-beta9-SNAPSHOT", "9.99.999-beta10-SNAPSHOT" ); + } + + public void testCompareToDigitsOnly() + throws Exception + { + checkVersionLessThanVersion( "1.01", "1.02" ); + + // M2.2.1 + // checkVersionLessThanVersion( "1.00009", "1.01" ); + // M3.0, because prefix 0's are ignored, hence 1 < 9 + checkVersionLessThanVersion( "1.01", "1.00009" ); + + checkVersionLessThanVersion( "1.01", "1.01.01" ); + + // M2.2.1 + // checkVersionLessThanVersion( "1.01", "1.1" ); + // M3.0, because prefix 0's are ignored, hence 1 == 1 + checkVersionEqualVersion( "1.01", "1.1" ); + + checkVersionEqualVersion( "1.01", "1.01" ); + + // M2.2.1 + // checkVersionLessThanVersion( "1.001", "1.01" ); + // M3.0, because prefix 0's are ignored, hence 1 == 1 + checkVersionEqualVersion( "1.001", "1.01" ); + } + + public void testCompareToAnnotation() + throws Exception + { + checkVersionLessThanVersion( "1.01-alpha", "1.01" ); + checkVersionLessThanVersion( "1.01-alpha", "1.01-beta" ); + checkVersionLessThanVersion( "1.01-beta", "1.01-RC1" ); + checkVersionLessThanVersion( "1.01-beta", "1.01-RC" ); + checkVersionLessThanVersion( "1.01-alpha-4", "1.01.1-beta-1" ); + checkVersionLessThanVersion( "1.01-alpha-4-SNAPSHOT", "1.01-beta" ); + checkVersionLessThanVersion( "1.01-alpha-4-SNAPSHOT", "1.01-alpha-4" ); + checkVersionLessThanVersion( "1.01-alpha-4", "1.01-alpha-5-SNAPSHOT" ); + + // M2.2.1 + // checkVersionLessThanVersion( "1.01-alpha-004-SNAPSHOT", "1.01-alpha-4-SNAPSHOT" ); + // M3.0, because prefix 0's are ignored, hence 4 == 4 + checkVersionEqualVersion( "1.01-alpha-004-SNAPSHOT", "1.01-alpha-4-SNAPSHOT" ); + } + + public void testCompareToAnnotationRevision() + throws Exception + { + checkVersionLessThanVersion( "1.01-beta-04-SNAPSHOT", "1.01-beta-05-SNAPSHOT" ); + checkVersionLessThanVersion( "1.01-beta-0004-SNAPSHOT", "1.01-beta-5-SNAPSHOT" ); + checkVersionLessThanVersion( "1.01-beta-4-SNAPSHOT", "1.01.1-beta-4-SNAPSHOT" ); + + // M2.2.1 + // checkVersionLessThanVersion( "1.01-beta-0004-SNAPSHOT", "1.01-beta-4-SNAPSHOT" ); + // M3.0, because prefix 0's are ignored, hence 4 == 4 + checkVersionEqualVersion( "1.01-beta-0004-SNAPSHOT", "1.01-beta-4-SNAPSHOT" ); + } + + public void testCompareToBuildSpecifier() + throws Exception + { + checkVersionLessThanVersion( "1.01-SNAPSHOT", "1.01" ); + checkVersionLessThanVersion( "1.01-beta-04-SNAPSHOT", "1.01-beta-04" ); + + checkVersionEqualVersion( "1.01-beta-04-SNAPSHOT", "1.01-beta-04-SNAPSHOT" ); + + if ( !"3.0".equals( mavenVersion ) ) + { + // bug?? + checkVersionLessThanVersion( "1.01-beta-04-20051112.134500-2", "1.01-beta-04-SNAPSHOT" ); + } + checkVersionLessThanVersion( "1.01-beta-04-20051112.134500-1", "1.01-beta-04-20051112.134500-2" ); + checkVersionLessThanVersion( "1.01-beta-04-20051112.134500-1", "1.01-beta-04-20051113.134500-1" ); + } + + public void testGetReleaseVersion() + throws Exception + { + checkGetReleaseVersion( "1-SNAPSHOT", "1" ); + checkGetReleaseVersion( "1", "1" ); + + checkGetReleaseVersion( "1.01", "1.01" ); + checkGetReleaseVersion( "1.01-beta", "1.01-beta" ); + checkGetReleaseVersion( "1.01-beta-04", "1.01-beta-04" ); + + checkGetReleaseVersion( "1.01-beta-04-SNAPSHOT", "1.01-beta-04" ); + checkGetReleaseVersion( "1.01-beta-04-20051112.134500-1", "1.01-beta-04" ); + } + + public void testGetSnapshotVersion() + throws Exception + { + checkGetSnapshotVersion( "1", "1-SNAPSHOT" ); + checkGetSnapshotVersion( "1.01", "1.01-SNAPSHOT" ); + checkGetSnapshotVersion( "1.01-beta", "1.01-beta-SNAPSHOT" ); + checkGetSnapshotVersion( "1.01-beta-04", "1.01-beta-04-SNAPSHOT" ); + + checkGetSnapshotVersion( "SNAPSHOT", "SNAPSHOT" ); + // TODO: bug in Artifact pattern +// checkGetSnapshotVersion( "20051112.134500-1", "SNAPSHOT" ); + checkGetSnapshotVersion( "1.01-beta-04-SNAPSHOT", "1.01-beta-04-SNAPSHOT" ); + checkGetSnapshotVersion( "1.01-beta-04-20051112.134500-1", "1.01-beta-04-SNAPSHOT" ); + checkGetSnapshotVersion( "1.01-beta-04_20051112.134500-1", "1.01-beta-04_20051112.134500-1-SNAPSHOT" ); + } + + public void testSnapshot() + throws VersionParseException + { + assertFalse( new DefaultVersionInfo( "1.01" ).isSnapshot() ); + assertFalse( new DefaultVersionInfo( "1.01-beta" ).isSnapshot() ); + assertFalse( new DefaultVersionInfo( "1.01-beta-04" ).isSnapshot() ); + + assertTrue( new DefaultVersionInfo( "1.01-beta-04-SNAPSHOT" ).isSnapshot() ); + assertTrue( new DefaultVersionInfo( "1.01-beta-04-20051112.134500-1" ).isSnapshot() ); + assertFalse( new DefaultVersionInfo( "1.01-beta-04_20051112.134500-1" ).isSnapshot() ); + + } + + //MRELEASE-623 SNAPSHOT is case-insensitive + public void testCaseInsensitiveSnapshot() throws VersionParseException + { + DefaultVersionInfo currentVersionInfo = new DefaultVersionInfo( "2.2-SNAPshot" ); + assertTrue( currentVersionInfo.isSnapshot() ); + assertEquals( "2.2", currentVersionInfo.getReleaseVersionString() ); + VersionInfo nextVersionInfo = currentVersionInfo.getNextVersion(); + assertEquals( "2.3-SNAPSHOT", nextVersionInfo.getSnapshotVersionString() ); + } + +// Ignore, new DefaultVersionInfo( "LATEST") throws VersionParseException +// public void testLatest() throws VersionParseException +// { +// assertTrue( new DefaultVersionInfo( "LATEST") .isSnapshot() ); +// } + + private static void checkGetReleaseVersion( String strVersion, String expected ) + throws Exception + { + VersionInfo v = new DefaultVersionInfo( strVersion ); + assertEquals( expected, v.getReleaseVersionString() ); + } + + private static void checkGetSnapshotVersion( String strVersion, String expected ) + throws Exception + { + VersionInfo v = new DefaultVersionInfo( strVersion ); + assertEquals( expected, v.getSnapshotVersionString() ); + } + + private static void checkParsing( String strVersion, String digits, String annotation, String annotationRevision, + String buildSpecifier ) + throws Exception + { + DefaultVersionInfo v = new DefaultVersionInfo( strVersion ); + + assertEquals( strVersion, v.toString() ); + assertEquals( digits, DefaultVersionInfo.joinDigitString( v.getDigits() ) ); + assertEquals( annotation, v.getAnnotation() ); + assertEquals( annotationRevision, v.getAnnotationRevision() ); + assertEquals( buildSpecifier, v.getBuildSpecifier() ); + } + + private static void checkNextVersion( String strVersion, String nextVersion ) + throws Exception + { + VersionInfo v = new DefaultVersionInfo( strVersion ); + VersionInfo nextV = v.getNextVersion(); + + assertNotNull( nextV ); + assertEquals( nextVersion, nextV.toString() ); + } + + private static void checkVersionLessThanVersion( String lesserVersion, String greaterVersion ) + throws VersionParseException + { + checkCompareTo( lesserVersion, greaterVersion, -1 ); + checkCompareTo( greaterVersion, lesserVersion, +1 ); + } + + private static void checkVersionEqualVersion( String version1, String version2 ) + throws Exception + { + checkCompareTo( version1, version2, 0 ); + } + + private static void checkCompareTo( String lesserVersion, String greaterVersion, int comparison ) + throws VersionParseException + { + VersionInfo lesserV = new DefaultVersionInfo( lesserVersion ); + VersionInfo greaterV = new DefaultVersionInfo( greaterVersion ); + + if ( comparison == 0 ) + { + assertEquals( 0, lesserV.compareTo( greaterV ) ); + assertEquals( lesserV, greaterV ); + } + else if ( comparison < 0 ) + { + assertTrue( "Expected less but was " + lesserV.compareTo( greaterV ), lesserV.compareTo( greaterV ) < 0 ); + } + else if ( comparison > 0 ) + { + assertTrue( "Expected more but was " + lesserV.compareTo( greaterV ), lesserV.compareTo( greaterV ) > 0 ); + } + } +} diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0-SNAPSHOT/artifactId-release-range-1.0-20060424.060453-1.jar b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0-SNAPSHOT/artifactId-release-range-1.0-20060424.060453-1.jar new file mode 100644 index 000000000..421376db9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0-SNAPSHOT/artifactId-release-range-1.0-20060424.060453-1.jar @@ -0,0 +1 @@ +dummy diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0-SNAPSHOT/artifactId-release-range-1.0-20060424.060453-1.pom b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0-SNAPSHOT/artifactId-release-range-1.0-20060424.060453-1.pom new file mode 100644 index 000000000..1c8c96dc6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0-SNAPSHOT/artifactId-release-range-1.0-20060424.060453-1.pom @@ -0,0 +1,30 @@ + + + + + 4.0.0 + external + artifactId-release-range + 1.0-20060424.060453-1 + POM was created from deploy:deploy-file + + deployed + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0-SNAPSHOT/maven-metadata.xml b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0-SNAPSHOT/maven-metadata.xml new file mode 100644 index 000000000..552136f91 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,32 @@ + + + + + external + artifactId-release-range + 1.0-SNAPSHOT + + + 20060424.060453 + 1 + + 20060424060453 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0/artifactId-release-range-1.0.jar b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0/artifactId-release-range-1.0.jar new file mode 100644 index 000000000..421376db9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0/artifactId-release-range-1.0.jar @@ -0,0 +1 @@ +dummy diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0/artifactId-release-range-1.0.pom b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0/artifactId-release-range-1.0.pom new file mode 100644 index 000000000..462c1f12f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/1.0/artifactId-release-range-1.0.pom @@ -0,0 +1,30 @@ + + + + + 4.0.0 + external + artifactId-release-range + 1.0 + POM was created from deploy:deploy-file + + deployed + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/maven-metadata.xml b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/maven-metadata.xml new file mode 100644 index 000000000..5dd2dc934 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId-release-range/maven-metadata.xml @@ -0,0 +1,32 @@ + + + + + external + artifactId-release-range + 1.0-SNAPSHOT + + + 1.0-SNAPSHOT + 1.0 + + 20060424060506 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0-SNAPSHOT/artifactId-1.0-20060424.060453-1.jar b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0-SNAPSHOT/artifactId-1.0-20060424.060453-1.jar new file mode 100644 index 000000000..421376db9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0-SNAPSHOT/artifactId-1.0-20060424.060453-1.jar @@ -0,0 +1 @@ +dummy diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0-SNAPSHOT/artifactId-1.0-20060424.060453-1.pom b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0-SNAPSHOT/artifactId-1.0-20060424.060453-1.pom new file mode 100644 index 000000000..8147d09ea --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0-SNAPSHOT/artifactId-1.0-20060424.060453-1.pom @@ -0,0 +1,30 @@ + + + + + 4.0.0 + external + artifactId + 1.0-20060424.060453-1 + POM was created from deploy:deploy-file + + deployed + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0-SNAPSHOT/maven-metadata.xml b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0-SNAPSHOT/maven-metadata.xml new file mode 100644 index 000000000..46889cf08 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,32 @@ + + + + + external + artifactId + 1.0-SNAPSHOT + + + 20060424.060453 + 1 + + 20060424060453 + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0/artifactId-1.0.jar b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0/artifactId-1.0.jar new file mode 100644 index 000000000..421376db9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0/artifactId-1.0.jar @@ -0,0 +1 @@ +dummy diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0/artifactId-1.0.pom b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0/artifactId-1.0.pom new file mode 100644 index 000000000..d62e5f95c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.0/artifactId-1.0.pom @@ -0,0 +1,30 @@ + + + + + 4.0.0 + external + artifactId + 1.0 + POM was created from deploy:deploy-file + + deployed + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.1-SNAPSHOT/artifactId-1.1-20080128.141330-1.jar b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.1-SNAPSHOT/artifactId-1.1-20080128.141330-1.jar new file mode 100644 index 000000000..421376db9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.1-SNAPSHOT/artifactId-1.1-20080128.141330-1.jar @@ -0,0 +1 @@ +dummy diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.1-SNAPSHOT/artifactId-1.1-20080128.141330-1.pom b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.1-SNAPSHOT/artifactId-1.1-20080128.141330-1.pom new file mode 100644 index 000000000..63a4b3ee0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.1-SNAPSHOT/artifactId-1.1-20080128.141330-1.pom @@ -0,0 +1,30 @@ + + + + + 4.0.0 + external + artifactId + 1.1-20080128.141330-1 + POM was created from deploy:deploy-file + + deployed + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.1-SNAPSHOT/maven-metadata.xml b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.1-SNAPSHOT/maven-metadata.xml new file mode 100644 index 000000000..09f5fbd16 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/1.1-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,32 @@ + + + + + external + artifactId + 1.1-SNAPSHOT + + + 20080128.141330 + 1 + + 20080128141330 + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/maven-metadata.xml b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/maven-metadata.xml new file mode 100644 index 000000000..ff6a708f4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/artifactId/maven-metadata.xml @@ -0,0 +1,33 @@ + + + + + external + artifactId + 1.0-SNAPSHOT + + + 1.0-SNAPSHOT + 1.0 + 1.1-SNAPSHOT + + 20080128141330 + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/extension-artifactId/1.3-SNAPSHOT/extension-artifactId-1.3-SNAPSHOT.jar b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/extension-artifactId/1.3-SNAPSHOT/extension-artifactId-1.3-SNAPSHOT.jar new file mode 100644 index 000000000..421376db9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/extension-artifactId/1.3-SNAPSHOT/extension-artifactId-1.3-SNAPSHOT.jar @@ -0,0 +1 @@ +dummy diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/extension-artifactId/1.3-SNAPSHOT/extension-artifactId-1.3-SNAPSHOT.pom b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/extension-artifactId/1.3-SNAPSHOT/extension-artifactId-1.3-SNAPSHOT.pom new file mode 100644 index 000000000..f6ad12f54 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/extension-artifactId/1.3-SNAPSHOT/extension-artifactId-1.3-SNAPSHOT.pom @@ -0,0 +1,32 @@ + + + + + 4.0.0 + external + extension-artifactId + 1.3-SNAPSHOT + POM was created from deploy:deploy-file + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/parent-artifactId/1-SNAPSHOT/parent-artifactId-1-SNAPSHOT.pom b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/parent-artifactId/1-SNAPSHOT/parent-artifactId-1-SNAPSHOT.pom new file mode 100644 index 000000000..e3a25ad45 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/parent-artifactId/1-SNAPSHOT/parent-artifactId-1-SNAPSHOT.pom @@ -0,0 +1,33 @@ + + + + + 4.0.0 + external + parent-artifactId + 1-SNAPSHOT + pom + POM was created from deploy:deploy-file + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/parent-artifactId/1/parent-artifactId-1.pom b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/parent-artifactId/1/parent-artifactId-1.pom new file mode 100644 index 000000000..2f3ee63e5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/parent-artifactId/1/parent-artifactId-1.pom @@ -0,0 +1,33 @@ + + + + + 4.0.0 + external + parent-artifactId + 1 + pom + POM was created from deploy:deploy-file + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/parent-artifactId/maven-metadata.xml b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/parent-artifactId/maven-metadata.xml new file mode 100644 index 000000000..12b9d58b7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/parent-artifactId/maven-metadata.xml @@ -0,0 +1,32 @@ + + + + + external + parent-artifactId + 1 + + + 1 + 1-SNAPSHOT + + 20060424060506 + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.0/plugin-artifactId-1.0.jar b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.0/plugin-artifactId-1.0.jar new file mode 100644 index 000000000..421376db9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.0/plugin-artifactId-1.0.jar @@ -0,0 +1 @@ +dummy diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.0/plugin-artifactId-1.0.pom b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.0/plugin-artifactId-1.0.pom new file mode 100644 index 000000000..534fd4b6e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.0/plugin-artifactId-1.0.pom @@ -0,0 +1,31 @@ + + + + + 4.0.0 + external + plugin-artifactId + maven-plugin + 1.0 + POM was created from deploy:deploy-file + + deployed + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.1-SNAPSHOT/maven-metadata.xml b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.1-SNAPSHOT/maven-metadata.xml new file mode 100644 index 000000000..1cd409067 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.1-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,32 @@ + + + + + external + plugin-artifactId + 1.1-SNAPSHOT + + + 20060424.131158 + 1 + + 20060424131158 + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.1-SNAPSHOT/plugin-artifactId-1.1-20060424.131158-1.jar b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.1-SNAPSHOT/plugin-artifactId-1.1-20060424.131158-1.jar new file mode 100644 index 000000000..421376db9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.1-SNAPSHOT/plugin-artifactId-1.1-20060424.131158-1.jar @@ -0,0 +1 @@ +dummy diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.1-SNAPSHOT/plugin-artifactId-1.1-20060424.131158-1.pom b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.1-SNAPSHOT/plugin-artifactId-1.1-20060424.131158-1.pom new file mode 100644 index 000000000..fd21fede4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/1.1-SNAPSHOT/plugin-artifactId-1.1-20060424.131158-1.pom @@ -0,0 +1,30 @@ + + + + + 4.0.0 + external + plugin-artifactId + 1.1-20060424.131158-1 + POM was created from deploy:deploy-file + + deployed + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/maven-metadata.xml b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/maven-metadata.xml new file mode 100644 index 000000000..b14d60c11 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/external/plugin-artifactId/maven-metadata.xml @@ -0,0 +1,32 @@ + + + + + external + plugin-artifactId + 1.0 + + + 1.0 + 1.1-SNAPSHOT + + 20060424131158 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/artifactId2/1.0-SNAPSHOT/artifactId2-1.0-20100813.112234-1.pom b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/artifactId2/1.0-SNAPSHOT/artifactId2-1.0-20100813.112234-1.pom new file mode 100644 index 000000000..3d8595099 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/artifactId2/1.0-SNAPSHOT/artifactId2-1.0-20100813.112234-1.pom @@ -0,0 +1,27 @@ + + + + 4.0.0 + groupId + artifactId2 + 1.0-SNAPSHOT + pom + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/artifactId2/1.0-SNAPSHOT/maven-metadata.xml b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/artifactId2/1.0-SNAPSHOT/maven-metadata.xml new file mode 100644 index 000000000..9c1cd6f5c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/artifactId2/1.0-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,33 @@ + + + + + + groupId + artifactId2 + 1.0-SNAPSHOT + + + 20100813.112234 + 1 + + 20100813112234 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/artifactId2/maven-metadata.xml b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/artifactId2/maven-metadata.xml new file mode 100644 index 000000000..e5aa66ffa --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/artifactId2/maven-metadata.xml @@ -0,0 +1,32 @@ + + + + + + groupId + artifactId2 + 1.0-SNAPSHOT + + + 1.0-SNAPSHOT + + 20100813112234 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/1.0-SNAPSHOT/subproject1-1.0-SNAPSHOT.jar b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/1.0-SNAPSHOT/subproject1-1.0-SNAPSHOT.jar new file mode 100644 index 000000000..421376db9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/1.0-SNAPSHOT/subproject1-1.0-SNAPSHOT.jar @@ -0,0 +1 @@ +dummy diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/1.0-SNAPSHOT/subproject1-1.0-SNAPSHOT.pom b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/1.0-SNAPSHOT/subproject1-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..5ccc4fae9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/1.0-SNAPSHOT/subproject1-1.0-SNAPSHOT.pom @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + external + artifactId + 1.0-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/2.0/subproject1-2.0.jar b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/2.0/subproject1-2.0.jar new file mode 100644 index 000000000..421376db9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/2.0/subproject1-2.0.jar @@ -0,0 +1 @@ +dummy diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/2.0/subproject1-2.0.pom b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/2.0/subproject1-2.0.pom new file mode 100644 index 000000000..379ad7043 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/groupId/subproject1/2.0/subproject1-2.0.pom @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + groupId + subproject1 + 2.0 + + + + + external + artifactId + 1.0 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar new file mode 100644 index 000000000..421376db9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar @@ -0,0 +1 @@ +dummy diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.pom b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.pom new file mode 100644 index 000000000..b0e58f9ea --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/remote-repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.pom @@ -0,0 +1,30 @@ + + + + + 4.0.0 + org.codehaus.plexus + plexus-utils + 1.1 + Required by by org.apache.maven.plugin.internal.PlexusUtilsInjector + + deployed + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/empty-release.properties b/Java-base/maven-release/src/maven-release-manager/src/test/resources/empty-release.properties new file mode 100644 index 000000000..d8a500d9d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/empty-release.properties @@ -0,0 +1,19 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/DefaultReleaseManagerTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/DefaultReleaseManagerTest.xml new file mode 100644 index 000000000..01fbb8a9c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/DefaultReleaseManagerTest.xml @@ -0,0 +1,152 @@ + + + + + + org.apache.maven.shared.release.ReleaseManager + test + org.apache.maven.shared.release.DefaultReleaseManager + + + org.apache.maven.shared.release.phase.ReleasePhase + releasePhases + + + org.apache.maven.shared.release.config.ReleaseDescriptorStore + stub + configStore + + + org.apache.maven.shared.release.strategy.Strategy + strategies + + + + + org.apache.maven.shared.release.strategy.Strategy + default + org.apache.maven.shared.release.strategies.DefaultStrategy + + + step1 + step2 + step3 + + + verify-completed-prepare-phases + checkout-project-from-scm + run-perform-goals + + + branch1 + + + rollbackPhase1 + + + updateVersionsPhase1 + + + + + org.apache.maven.shared.release.ReleaseManager + bad-phase-configured + org.apache.maven.shared.release.DefaultReleaseManager + + + org.apache.maven.shared.release.phase.ReleasePhase + releasePhases + + + org.apache.maven.shared.release.config.ReleaseDescriptorStore + stub + configStore + + + org.apache.maven.shared.release.strategy.Strategy + strategies + + + + + foo + + + + + org.apache.maven.shared.release.strategy.Strategy + foo + org.apache.maven.shared.release.strategies.DefaultStrategy + + + foo + + + + + org.apache.maven.shared.release.config.ReleaseDescriptorStore + stub + org.apache.maven.shared.release.config.ReleaseDescriptorStoreStub + + + org.apache.maven.shared.release.phase.ReleasePhase + step1 + org.apache.maven.shared.release.phase.ReleasePhaseStub + + + org.apache.maven.shared.release.phase.ReleasePhase + step2 + org.apache.maven.shared.release.phase.ReleasePhaseStub + + + org.apache.maven.shared.release.phase.ReleasePhase + step3 + org.apache.maven.shared.release.phase.ReleasePhaseStub + + + org.apache.maven.shared.release.phase.ReleasePhase + branch1 + org.apache.maven.shared.release.phase.ReleasePhaseStub + + + org.apache.maven.shared.release.phase.ReleasePhase + rollbackPhase1 + org.apache.maven.shared.release.phase.ReleasePhaseStub + + + org.apache.maven.shared.release.phase.ReleasePhase + updateVersionsPhase1 + org.apache.maven.shared.release.phase.ReleasePhaseStub + + + org.apache.maven.scm.manager.ScmManager + org.apache.maven.scm.manager.ScmManagerStub + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/exec/ForkedMavenExecutorTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/exec/ForkedMavenExecutorTest.xml new file mode 100644 index 000000000..343cd9b21 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/exec/ForkedMavenExecutorTest.xml @@ -0,0 +1,32 @@ + + + + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/BranchInputVariablesPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/BranchInputVariablesPhaseTest.xml new file mode 100644 index 000000000..090aabb00 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/BranchInputVariablesPhaseTest.xml @@ -0,0 +1,41 @@ + + + + + + org.apache.maven.scm.manager.ScmManager + org.apache.maven.shared.release.stubs.ScmManagerStub + + + org.apache.maven.shared.release.policy.naming.NamingPolicy + stub + org.apache.maven.shared.release.stubs.NamingPolicyStub + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhaseTest.xml new file mode 100644 index 000000000..343cd9b21 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhaseTest.xml @@ -0,0 +1,32 @@ + + + + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/CheckoutProjectFromScmTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/CheckoutProjectFromScmTest.xml new file mode 100644 index 000000000..7bdc4c96b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/CheckoutProjectFromScmTest.xml @@ -0,0 +1,36 @@ + + + + + + org.apache.maven.scm.manager.ScmManager + org.apache.maven.shared.release.stubs.ScmManagerStub + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + FATAL + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/EndReleasePhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/EndReleasePhaseTest.xml new file mode 100644 index 000000000..343cd9b21 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/EndReleasePhaseTest.xml @@ -0,0 +1,32 @@ + + + + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/GenerateReleasePomsPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/GenerateReleasePomsPhaseTest.xml new file mode 100644 index 000000000..cf932e565 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/GenerateReleasePomsPhaseTest.xml @@ -0,0 +1,41 @@ + + + + + + org.apache.maven.scm.manager.ScmManager + org.apache.maven.shared.release.stubs.ScmManagerStub + + + org.apache.maven.shared.release.scm.ScmTranslator + stub-provider + org.apache.maven.shared.release.scm.SubversionScmTranslator + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/MapVersionsPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/MapVersionsPhaseTest.xml new file mode 100644 index 000000000..845cd87a4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/MapVersionsPhaseTest.xml @@ -0,0 +1,82 @@ + + + + + + org.apache.maven.shared.release.phase.ReleasePhase + test-map-development-versions + org.apache.maven.shared.release.phase.MapVersionsPhase + + true + + + + org.apache.maven.shared.release.policy.version.VersionPolicy + versionPolicies + + + + + org.apache.maven.shared.release.phase.ReleasePhase + test-map-release-versions + org.apache.maven.shared.release.phase.MapVersionsPhase + + false + + + + org.apache.maven.shared.release.policy.version.VersionPolicy + versionPolicies + + + + + org.apache.maven.shared.release.phase.ReleasePhase + test-map-branch-versions + org.apache.maven.shared.release.phase.MapVersionsPhase + + true + true + + + + org.apache.maven.shared.release.policy.version.VersionPolicy + versionPolicies + + + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + + org.apache.maven.shared.release.policy.version.VersionPolicy + default + org.apache.maven.shared.release.policies.DefaultVersionPolicy + false + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RemoveReleasePomsPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RemoveReleasePomsPhaseTest.xml new file mode 100644 index 000000000..31abe174c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RemoveReleasePomsPhaseTest.xml @@ -0,0 +1,36 @@ + + + + + + org.apache.maven.scm.manager.ScmManager + org.apache.maven.scm.manager.ScmManagerStub + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RemoveScmTagPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RemoveScmTagPhaseTest.xml new file mode 100644 index 000000000..1c4370408 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RemoveScmTagPhaseTest.xml @@ -0,0 +1,36 @@ + + + + + + org.apache.maven.scm.manager.ScmManager + org.apache.maven.shared.release.stubs.ScmManagerStub + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RewritePomsForBranchPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RewritePomsForBranchPhaseTest.xml new file mode 100644 index 000000000..343cd9b21 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RewritePomsForBranchPhaseTest.xml @@ -0,0 +1,32 @@ + + + + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhaseTest.xml new file mode 100644 index 000000000..343cd9b21 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhaseTest.xml @@ -0,0 +1,32 @@ + + + + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RewritePomsForReleasePhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RewritePomsForReleasePhaseTest.xml new file mode 100644 index 000000000..343cd9b21 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RewritePomsForReleasePhaseTest.xml @@ -0,0 +1,32 @@ + + + + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RunCompleteGoalsPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RunCompleteGoalsPhaseTest.xml new file mode 100644 index 000000000..82a83f745 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RunCompleteGoalsPhaseTest.xml @@ -0,0 +1,37 @@ + + + + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + org.apache.maven.shared.release.exec.MavenExecutor + wrapper + org.apache.maven.shared.release.stubs.MavenExecutorWrapper + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RunPerformGoalsPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RunPerformGoalsPhaseTest.xml new file mode 100644 index 000000000..9820d21a8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RunPerformGoalsPhaseTest.xml @@ -0,0 +1,37 @@ + + + + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + org.apache.maven.shared.release.exec.MavenExecutor + wrapper + org.apache.maven.shared.release.stubs.MavenExecutorWrapper + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RunPrepareGoalsPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RunPrepareGoalsPhaseTest.xml new file mode 100644 index 000000000..9820d21a8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/RunPrepareGoalsPhaseTest.xml @@ -0,0 +1,37 @@ + + + + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + org.apache.maven.shared.release.exec.MavenExecutor + wrapper + org.apache.maven.shared.release.stubs.MavenExecutorWrapper + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmBranchPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmBranchPhaseTest.xml new file mode 100644 index 000000000..1c4370408 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmBranchPhaseTest.xml @@ -0,0 +1,36 @@ + + + + + + org.apache.maven.scm.manager.ScmManager + org.apache.maven.shared.release.stubs.ScmManagerStub + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmCheckModificationsPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmCheckModificationsPhaseTest.xml new file mode 100644 index 000000000..1c4370408 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmCheckModificationsPhaseTest.xml @@ -0,0 +1,36 @@ + + + + + + org.apache.maven.scm.manager.ScmManager + org.apache.maven.shared.release.stubs.ScmManagerStub + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhaseTest.xml new file mode 100644 index 000000000..31abe174c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhaseTest.xml @@ -0,0 +1,36 @@ + + + + + + org.apache.maven.scm.manager.ScmManager + org.apache.maven.scm.manager.ScmManagerStub + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmCommitPreparationPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmCommitPreparationPhaseTest.xml new file mode 100644 index 000000000..1c4370408 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmCommitPreparationPhaseTest.xml @@ -0,0 +1,36 @@ + + + + + + org.apache.maven.scm.manager.ScmManager + org.apache.maven.shared.release.stubs.ScmManagerStub + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmTagPhaseTest.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmTagPhaseTest.xml new file mode 100644 index 000000000..1c4370408 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/org/apache/maven/shared/release/phase/ScmTagPhaseTest.xml @@ -0,0 +1,36 @@ + + + + + + org.apache.maven.scm.manager.ScmManager + org.apache.maven.shared.release.stubs.ScmManagerStub + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/pomfinder/pom1.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/pomfinder/pom1.xml new file mode 100644 index 000000000..3571257d2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/pomfinder/pom1.xml @@ -0,0 +1,223 @@ + + + + + 4.0.0 + + + org.apache.maven.release + maven-release-testartifact + 2.1-SNAPSHOT + + + maven-release-manager + + Maven Release Manager testartifact + + + + + org.apache.maven + maven-repository-metadata + ${mavenVersion} + + + + + + + org.codehaus.plexus + plexus-container-default + 1.0-alpha-9 + + + commons-lang + commons-lang + 2.4 + + + commons-cli + commons-cli + 1.0 + + + commons-lang + commons-lang + + + + + + + + org.apache.maven.scm + maven-scm-providers-standard + ${scmVersion} + pom + runtime + + + org.apache.maven.scm + maven-scm-manager-plexus + ${scmVersion} + runtime + + + org.apache.maven.scm + maven-scm-api + ${scmVersion} + + + org.apache.maven.scm + maven-scm-provider-svn-commons + ${scmVersion} + + + + org.jdom + jdom + + + jaxen + jaxen + 1.1-beta-8 + runtime + + + dom4j + dom4j + + + xerces + xmlParserAPIs + + + xerces + xercesImpl + + + xom + xom + + + + + + junit + junit + 3.8.2 + test + + + org.apache.maven.shared + maven-plugin-testing-harness + test + + + org.apache.maven.scm + maven-scm-test + ${scmVersion} + test + + + jmock + jmock + test + + + jmock + jmock-cglib + 1.0.1 + test + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + 1.4 + + + + maven-surefire-plugin + + -Xmx256m + + + **/ForkedMavenExecutorTest.java + + + + + org.codehaus.modello + modello-maven-plugin + 1.1 + + + + xpp3-reader + java + xpp3-writer + + + + + 2.0.0 + false + + src/main/mdo/release-descriptor.mdo + + + + + org.codehaus.plexus + plexus-maven-plugin + 1.3.8 + + + create-component-descriptor + generate-resources + + descriptor + + + + merge + + ${project.build.outputDirectory}/META-INF/plexus/components.xml + + ${project.build.outputDirectory}/META-INF/plexus/components.xml + src/main/components-fragment.xml + + + process-resources + + merge-descriptors + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-extension/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-extension/pom.xml new file mode 100644 index 000000000..f4d413f44 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-extension/pom.xml @@ -0,0 +1,32 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + + + external + artifactId + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-dependency/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-dependency/pom.xml new file mode 100644 index 000000000..7ba0ca5d2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-dependency/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + external + artifactId + 1.0-SNAPSHOT + + + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-dependency/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-dependency/subproject1/pom.xml new file mode 100644 index 000000000..b747fba3c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-dependency/subproject1/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + external + artifactId + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-plugin/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-plugin/pom.xml new file mode 100644 index 000000000..af8158177 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-plugin/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + + external + plugin-artifactId + 1.1-SNAPSHOT + + + + + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-plugin/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-plugin/subproject1/pom.xml new file mode 100644 index 000000000..4ce97a9b8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-managed-snapshot-plugin/subproject1/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + + external + plugin-artifactId + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-parent/child/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-parent/child/pom.xml new file mode 100644 index 000000000..22211cf03 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-parent/child/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + parent-external + 1.0 + + + + artifactId + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-parent/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-parent/pom.xml new file mode 100644 index 000000000..e32184572 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-parent/pom.xml @@ -0,0 +1,23 @@ + + + + 4.0.0 + groupId + parent-external + 1.0 + pom + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-range-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-range-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..766c945e2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-range-snapshot-dependencies/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + + external + artifactId + [1.0-SNAPSHOT] + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-all/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-all/pom.xml new file mode 100644 index 000000000..79a069a84 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-all/pom.xml @@ -0,0 +1,57 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + + + external + plugin-artifactId + 1.1-SNAPSHOT + + + + + external + extension-artifactId + 1.3-SNAPSHOT + + + + + + + + external + report-artifactId + 1.2-SNAPSHOT + + + + + + + external + artifactId + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..bc8126547 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-dependencies/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + + external + artifactId + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-extension/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-extension/pom.xml new file mode 100644 index 000000000..f470e5998 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-extension/pom.xml @@ -0,0 +1,32 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + + + external + artifactId + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-parent/child/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-parent/child/pom.xml new file mode 100644 index 000000000..7e2cb9182 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-parent/child/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + parent-external + 1.0-SNAPSHOT + + + artifactId + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-parent/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-parent/pom.xml new file mode 100644 index 000000000..b79bb845b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-parent/pom.xml @@ -0,0 +1,23 @@ + + + + 4.0.0 + groupId + parent-external + 1.0-SNAPSHOT + pom + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-plugins/pom.xml new file mode 100644 index 000000000..42ed2b281 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-plugins/pom.xml @@ -0,0 +1,32 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + + + external + plugin-artifactId + 1.1-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-report-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-report-plugins/pom.xml new file mode 100644 index 000000000..02eaa0011 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-snapshot-report-plugins/pom.xml @@ -0,0 +1,32 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + + + external + plugin-artifactId + 1.1-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-timestamped-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-timestamped-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..10617d5dc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/external-timestamped-snapshot-dependencies/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + + external + artifactId + 1.0-20060424.060453-1 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..f85aaf2ce --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-dependencies/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + external + artifactId + 1.0-SNAPSHOT + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-dependencies/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-dependencies/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-dependencies/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-dependencies/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-dependencies/subproject2/pom.xml new file mode 100644 index 000000000..0dd5cdafd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-dependencies/subproject2/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-plugins/pom.xml new file mode 100644 index 000000000..bfa9354bd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-plugins/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + external + plugin-artifactId + 1.1-SNAPSHOT + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-plugins/subproject1/pom.xml new file mode 100644 index 000000000..aba4947b8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-plugins/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + maven-plugin + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-plugins/subproject2/pom.xml new file mode 100644 index 000000000..c87c67b91 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-plugins/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-report-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-report-plugins/pom.xml new file mode 100644 index 000000000..e516bba79 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-report-plugins/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + external + plugin-artifactId + 1.1-SNAPSHOT + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-report-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-report-plugins/subproject1/pom.xml new file mode 100644 index 000000000..aba4947b8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-report-plugins/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + maven-plugin + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-report-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-report-plugins/subproject2/pom.xml new file mode 100644 index 000000000..50b5f44d2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-and-external-snapshot-report-plugins/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-differing-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-differing-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-differing-snapshot-dependencies/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-differing-snapshot-dependencies/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-differing-snapshot-dependencies/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-differing-snapshot-dependencies/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-differing-snapshot-dependencies/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-differing-snapshot-dependencies/subproject2/pom.xml new file mode 100644 index 000000000..f0c200c64 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-differing-snapshot-dependencies/subproject2/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-dependency/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-dependency/pom.xml new file mode 100644 index 000000000..605c618bf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-dependency/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-dependency/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-dependency/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-dependency/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-dependency/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-dependency/subproject2/pom.xml new file mode 100644 index 000000000..b6cc6c111 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-dependency/subproject2/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-plugin/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-plugin/pom.xml new file mode 100644 index 000000000..e4141fbb7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-plugin/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-plugin/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-plugin/subproject1/pom.xml new file mode 100644 index 000000000..aba4947b8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-plugin/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + maven-plugin + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-plugin/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-plugin/subproject2/pom.xml new file mode 100644 index 000000000..717e0eee5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-managed-snapshot-plugin/subproject2/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies-no-reactor/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies-no-reactor/pom.xml new file mode 100644 index 000000000..c62fbfabd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies-no-reactor/pom.xml @@ -0,0 +1,31 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + jar + + + + groupId + test + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies/subproject2/pom.xml new file mode 100644 index 000000000..0dd5cdafd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies/subproject2/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-extension/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-extension/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-extension/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-extension/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-extension/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-extension/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-extension/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-extension/subproject2/pom.xml new file mode 100644 index 000000000..abf9eb908 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-extension/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-plugins/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-plugins/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-plugins/subproject1/pom.xml new file mode 100644 index 000000000..aba4947b8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-plugins/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + maven-plugin + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-plugins/subproject2/pom.xml new file mode 100644 index 000000000..c87c67b91 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-plugins/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-report-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-report-plugins/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-report-plugins/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-report-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-report-plugins/subproject1/pom.xml new file mode 100644 index 000000000..aba4947b8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-report-plugins/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + maven-plugin + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-report-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-report-plugins/subproject2/pom.xml new file mode 100644 index 000000000..50b5f44d2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-report-plugins/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/multimodule-external-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/multimodule-external-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..6291f43bb --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/multimodule-external-snapshot-dependencies/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + external + parent-artifactId + 1 + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/multimodule-external-snapshot-dependencies/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/multimodule-external-snapshot-dependencies/subproject1/pom.xml new file mode 100644 index 000000000..4c81f7389 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/multimodule-external-snapshot-dependencies/subproject1/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + groupId + subproject1 + 1.0-SNAPSHOT + + + groupId + artifactId + 1.0-SNAPSHOT + + + + + external + artifactId + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/multimodule-external-snapshot-dependencies/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/multimodule-external-snapshot-dependencies/subproject2/pom.xml new file mode 100644 index 000000000..7e6dd2f05 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/multimodule-external-snapshot-dependencies/subproject2/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + groupId + subproject2 + 1.0-SNAPSHOT + + + groupId + artifactId + 1.0-SNAPSHOT + + + + + external + artifactId2 + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..4f7f8db67 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-dependencies/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + + external + artifactId + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-plugins/pom.xml new file mode 100644 index 000000000..8d11845fe --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-plugins/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + + + external + plugin-artifactId + 1.0 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-range-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-range-dependencies/pom.xml new file mode 100644 index 000000000..a55848f06 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-range-dependencies/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + + external + artifactId + [1.0,1.1) + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-report-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-report-plugins/pom.xml new file mode 100644 index 000000000..db844fd69 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/no-snapshot-report-plugins/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + + + external + plugin-artifactId + 1.0 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/snapshot-release-plugin/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/snapshot-release-plugin/pom.xml new file mode 100644 index 000000000..4d254ad40 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/snapshot-release-plugin/pom.xml @@ -0,0 +1,32 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + + + org.apache.maven.plugins + maven-release-plugin + 1.1-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-dependency/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-dependency/pom.xml new file mode 100644 index 000000000..ce5a21580 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-dependency/pom.xml @@ -0,0 +1,38 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + external + artifactId + 1.0-SNAPSHOT + + + + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-dependency/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-dependency/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-dependency/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-plugin/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-plugin/pom.xml new file mode 100644 index 000000000..af8158177 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-plugin/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + + external + plugin-artifactId + 1.1-SNAPSHOT + + + + + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-plugin/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-plugin/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-external-managed-snapshot-plugin/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-dependency/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-dependency/pom.xml new file mode 100644 index 000000000..8348e385a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-dependency/pom.xml @@ -0,0 +1,38 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + groupId + subproject3 + 1.0-SNAPSHOT + + + + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-dependency/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-dependency/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-dependency/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-plugin/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-plugin/pom.xml new file mode 100644 index 000000000..11347873a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-plugin/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + + groupId + subproject3 + 1.0-SNAPSHOT + + + + + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-plugin/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-plugin/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/check-dependencies/unused-internal-managed-snapshot-plugin/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/basic-pom/expected-backup.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/basic-pom/expected-backup.xml new file mode 100644 index 000000000..051497462 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/basic-pom/expected-backup.xml @@ -0,0 +1,26 @@ + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/basic-pom/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/basic-pom/pom.xml new file mode 100644 index 000000000..051497462 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/basic-pom/pom.xml @@ -0,0 +1,26 @@ + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/expected-backup.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/expected-backup.xml new file mode 100644 index 000000000..3fbe000e5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/expected-backup.xml @@ -0,0 +1,32 @@ + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/pom.xml new file mode 100644 index 000000000..3fbe000e5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/pom.xml @@ -0,0 +1,32 @@ + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject1/expected-backup.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject1/expected-backup.xml new file mode 100644 index 000000000..8a7716445 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject1/expected-backup.xml @@ -0,0 +1,30 @@ + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject1/pom.xml new file mode 100644 index 000000000..8a7716445 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject1/pom.xml @@ -0,0 +1,30 @@ + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject2/expected-backup.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject2/expected-backup.xml new file mode 100644 index 000000000..7b57f2d4d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject2/expected-backup.xml @@ -0,0 +1,38 @@ + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject2/pom.xml new file mode 100644 index 000000000..7b57f2d4d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/create-backup-poms/pom-with-modules/subproject2/pom.xml @@ -0,0 +1,38 @@ + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-entities/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-entities/expected-release-pom.xml new file mode 100644 index 000000000..c6f3e4b42 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-entities/expected-release-pom.xml @@ -0,0 +1,68 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + < & Non-ASCIIs: ß Ä° É™ σ ß Я × Ø° + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-entities/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-entities/pom.xml new file mode 100644 index 000000000..2e9672fe9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-entities/pom.xml @@ -0,0 +1,27 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + < & Non-ASCIIs: ß İ ə σ ß Я א ذ + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-namespace/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-namespace/expected-release-pom.xml new file mode 100644 index 000000000..715efab91 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-namespace/expected-release-pom.xml @@ -0,0 +1,69 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-namespace/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-namespace/pom.xml new file mode 100644 index 000000000..9f08584e6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-namespace/pom.xml @@ -0,0 +1,28 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-with-encoding/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-with-encoding/expected-release-pom.xml new file mode 100644 index 000000000..ef626c2f1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-with-encoding/expected-release-pom.xml @@ -0,0 +1,74 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-with-encoding/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-with-encoding/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..d42c4af9472a347c31398bf792e78311c4de6697 GIT binary patch literal 2148 zcmchY-ER^>6vgkef5pg?CWTg`eW*xNwT+EUF+y#80)Kz3X7#XnvBojVNMB{VTH zF&lP<`!#3IJv003w>9n1zT34;EZD7$Y+<=&HnXX{w3-EZY&+rW#dCq%C<(Q>i1~Rv;R?XQV?jyM+D?%<# zf<0PSs980uW{>T~8c$&7!W&?@$2@?1My}8ZS45IA59~9e6S9ryim=Z;Qk)0p{~F7L zs2&#i1H5F8q})*zP038KPa8;P)+e_|1=a7Z)=;kkkz?M8rD{#Z7V90BjH~1EQI`v_ z9@s9=(w_!dWoH|#us{#HzMryBIhHd!MK#BEZXMpzh&WH{q%qh9xW!lQ>`5KpU^R1{ zsNa3xiB^rQ4M5OeF+5?uBt|H-pDWLbIw`P*6)Q{ZVmRtvipZUtQjsMdosOJXW%NN( zfapHmZ891aa9;(TNTJlb#tG>#p7Pe&eC7Z3Z)eR>uuJ@1duwf2>JoKH)CZm;Snc9F z_8M(0I-zZ>Z#?7F=c?c4bn7&pqnlvw@G3?OjGPgjA8{wG&Yiv3hsbD#-XrVc;I0Zg zWF*~d++PgaGPMr~I&-{E0$WZTe3*C6%RO5=Acz;calP`GI0u*94-D)~z${pTe zYC?pfbQ02iqPT6hMHOq>mF~NA`-zE}eR0HvTXiCutf1R-1orBU(z0i+ZYjKp_V162 zI%~R8b)(Gb$dDDJ-15I_R4qalG3W->4#(_tz%1r(v#QEAds(acwP>xr6?If~j%MC7 zN_$=3(`IbMlThVgxn46Bk?LDB#ou{UU?SY;jfNx`+5;!M5NwnA6i9vT=;kGe`5Sw1b0#2fO7)3>C5u(Or?sc Ndx={qL#o-({~v<@W{Lm+ literal 0 HcmV?d00001 diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom/expected-release-pom-with-schema.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom/expected-release-pom-with-schema.xml new file mode 100644 index 000000000..ef626c2f1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom/expected-release-pom-with-schema.xml @@ -0,0 +1,74 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom/expected-release-pom.xml new file mode 100644 index 000000000..ef626c2f1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom/expected-release-pom.xml @@ -0,0 +1,74 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom/pom.xml new file mode 100644 index 000000000..853d36b1f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom/pom.xml @@ -0,0 +1,30 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/expected-release-pom.xml new file mode 100644 index 000000000..5b9d8956d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/expected-release-pom.xml @@ -0,0 +1,79 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + subproject2 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/pom.xml new file mode 100644 index 000000000..7a3b0a1bf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/pom.xml @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + + + -SNAPSHOT + pom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..f6847262f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject1/expected-release-pom.xml @@ -0,0 +1,74 @@ + + + + + + 4.0.0 + groupId + subproject1 + 2.0 + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-2.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject1/pom.xml new file mode 100644 index 000000000..bbcf3ef25 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject1/pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject2/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject2/expected-release-pom.xml new file mode 100644 index 000000000..05022220f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject2/expected-release-pom.xml @@ -0,0 +1,89 @@ + + + + + + 4.0.0 + groupId + subproject2 + 1.0 + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject2-1.0 + + + groupId + subproject1 + 2.0 + + + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + groupId + subproject1 + 2.0 + compile + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject2/pom.xml new file mode 100644 index 000000000..9db2067be --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/cdata-around-values/subproject2/pom.xml @@ -0,0 +1,46 @@ + + + + + + 4.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/expected-release-pom.xml new file mode 100644 index 000000000..98064ff64 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/expected-release-pom.xml @@ -0,0 +1,78 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/pom.xml new file mode 100644 index 000000000..e6388f8cf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/pom.xml @@ -0,0 +1,59 @@ + + + + 4.0.0 + groupId + artifactId + + + 1.0-SNAPSHOT + + + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + + + groupId + subproject1 + 2.0-SNAPSHOT + + + + + + + + + groupId + subproject1 + 2.0-SNAPSHOT + + + + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..f6847262f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/subproject1/expected-release-pom.xml @@ -0,0 +1,74 @@ + + + + + + 4.0.0 + groupId + subproject1 + 2.0 + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-2.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/subproject1/pom.xml new file mode 100644 index 000000000..1aca194a7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/comments-around-values/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/external-range-dependency/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/external-range-dependency/expected-release-pom.xml new file mode 100644 index 000000000..ca6bf2f66 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/external-range-dependency/expected-release-pom.xml @@ -0,0 +1,82 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + external + artifactId-release-range + 1.0 + compile + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/external-range-dependency/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/external-range-dependency/pom.xml new file mode 100644 index 000000000..749bf97bd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/external-range-dependency/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + + external + artifactId-release-range + [1.0,2.0) + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/expected-release-pom.xml new file mode 100644 index 000000000..e83bffbd2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/expected-release-pom.xml @@ -0,0 +1,74 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + subproject2 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..851ccc473 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject1/expected-release-pom.xml @@ -0,0 +1,69 @@ + + + + + + 4.0.0 + groupId + subproject1 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject2/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject2/expected-release-pom.xml new file mode 100644 index 000000000..fd9cc578b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject2/expected-release-pom.xml @@ -0,0 +1,77 @@ + + + + + + 4.0.0 + groupId + subproject2 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject2-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + compile + + + + target/site + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject2/pom.xml new file mode 100644 index 000000000..f0c200c64 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-dependencies/subproject2/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/expected-release-pom.xml new file mode 100644 index 000000000..e83bffbd2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/expected-release-pom.xml @@ -0,0 +1,74 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + subproject2 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..7787f6f87 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject1/expected-release-pom.xml @@ -0,0 +1,69 @@ + + + + + + 4.0.0 + groupId + subproject1 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject2/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject2/expected-release-pom.xml new file mode 100644 index 000000000..b807dcb28 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject2/expected-release-pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + groupId + subproject2 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject2-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject2/pom.xml new file mode 100644 index 000000000..201e9819f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-extension/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/expected-release-pom.xml new file mode 100644 index 000000000..e83bffbd2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/expected-release-pom.xml @@ -0,0 +1,74 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + subproject2 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..7787f6f87 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject1/expected-release-pom.xml @@ -0,0 +1,69 @@ + + + + + + 4.0.0 + groupId + subproject1 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject2/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject2/expected-release-pom.xml new file mode 100644 index 000000000..11c4714b7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject2/expected-release-pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + groupId + subproject2 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject2-1.0 + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject2/pom.xml new file mode 100644 index 000000000..6210b1ee1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-plugins/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/expected-release-pom.xml new file mode 100644 index 000000000..e83bffbd2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/expected-release-pom.xml @@ -0,0 +1,74 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + subproject2 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..7787f6f87 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject1/expected-release-pom.xml @@ -0,0 +1,69 @@ + + + + + + 4.0.0 + groupId + subproject1 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject2/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject2/expected-release-pom.xml new file mode 100644 index 000000000..a4b2c96b0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject2/expected-release-pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + groupId + subproject2 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject2-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject2/pom.xml new file mode 100644 index 000000000..27fc275d0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-differing-snapshot-report-plugins/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/expected-release-pom.xml new file mode 100644 index 000000000..358ef4674 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/expected-release-pom.xml @@ -0,0 +1,75 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + subproject2 + subproject3 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/pom.xml new file mode 100644 index 000000000..dc9e67208 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + groupId + subproject2 + 0.5 + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..7787f6f87 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject1/expected-release-pom.xml @@ -0,0 +1,69 @@ + + + + + + 4.0.0 + groupId + subproject1 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject2/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject2/expected-release-pom.xml new file mode 100644 index 000000000..788ac4263 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject2/expected-release-pom.xml @@ -0,0 +1,77 @@ + + + + + + 4.0.0 + groupId + subproject2 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject2-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + groupId + subproject1 + 1.0 + compile + + + + target/site + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject2/pom.xml new file mode 100644 index 000000000..b6cc6c111 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject2/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject3/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject3/expected-release-pom.xml new file mode 100644 index 000000000..f4030763d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject3/expected-release-pom.xml @@ -0,0 +1,83 @@ + + + + + + 4.0.0 + groupId + subproject3 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject3-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + groupId + subproject1 + 1.0 + compile + + + groupId + subproject2 + 0.5 + compile + + + + target/site + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject3/pom.xml new file mode 100644 index 000000000..fb6d85a5e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-dependency/subproject3/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + groupId + subproject1 + + + groupId + subproject2 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/expected-release-pom.xml new file mode 100644 index 000000000..358ef4674 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/expected-release-pom.xml @@ -0,0 +1,75 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + subproject2 + subproject3 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/pom.xml new file mode 100644 index 000000000..ec1741bf4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/pom.xml @@ -0,0 +1,46 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + groupId + subproject2 + 0.5 + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..7787f6f87 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject1/expected-release-pom.xml @@ -0,0 +1,69 @@ + + + + + + 4.0.0 + groupId + subproject1 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject2/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject2/expected-release-pom.xml new file mode 100644 index 000000000..6fa1c96f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject2/expected-release-pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + groupId + subproject2 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject2-1.0 + + + groupId + subproject1 + 1.0 + + + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject2/pom.xml new file mode 100644 index 000000000..7027c9ca0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject2/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject3/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject3/expected-release-pom.xml new file mode 100644 index 000000000..9f3ce7ca0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject3/expected-release-pom.xml @@ -0,0 +1,81 @@ + + + + + + 4.0.0 + groupId + subproject3 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject3-1.0 + + + groupId + subproject1 + 1.0 + + + groupId + subproject2 + 0.5 + + + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject3/pom.xml new file mode 100644 index 000000000..031fd957b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-managed-snapshot-plugin/subproject3/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + groupId + subproject1 + + + groupId + subproject2 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/expected-release-pom.xml new file mode 100644 index 000000000..2e2e5803f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/expected-release-pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + subproject2 + subproject3 + subproject4 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..876538172 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..b0ae51f85 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject1/expected-release-pom.xml @@ -0,0 +1,77 @@ + + + + + + 4.0.0 + groupId + subproject1 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + junit + junit + 3.8.1 + test + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject1/pom.xml new file mode 100644 index 000000000..8e2e0791d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject1/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject2/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject2/expected-release-pom.xml new file mode 100644 index 000000000..79bc99a43 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject2/expected-release-pom.xml @@ -0,0 +1,77 @@ + + + + + + 4.0.0 + groupId + subproject2 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject2-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + groupId + subproject1 + 1.0 + compile + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject2/pom.xml new file mode 100644 index 000000000..0dd5cdafd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject2/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject3/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject3/expected-release-pom.xml new file mode 100644 index 000000000..a62a916c2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject3/expected-release-pom.xml @@ -0,0 +1,83 @@ + + + + + + 4.0.0 + groupId + subproject3 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject3-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + groupId + subproject1 + 0.5 + compile + + + groupId + subproject2 + 1.0 + compile + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject3/pom.xml new file mode 100644 index 000000000..0264cb6a2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject3/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/expected-release-pom.xml new file mode 100644 index 000000000..a2e0af815 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/expected-release-pom.xml @@ -0,0 +1,87 @@ + + + + + + 4.0.0 + groupId + subproject4 + 1.0 + pom + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject4-1.0 + + + subsubproject + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + groupId + subproject1 + 1.0 + compile + + + groupId + subproject2 + 1.0 + compile + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/pom.xml new file mode 100644 index 000000000..46bdc11b2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject4 + pom + + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/subsubproject/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/subsubproject/expected-release-pom.xml new file mode 100644 index 000000000..3e836b821 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/subsubproject/expected-release-pom.xml @@ -0,0 +1,83 @@ + + + + + + 4.0.0 + groupId + subsubproject + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subsubproject-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + groupId + subproject1 + 1.0 + compile + + + groupId + subproject2 + 1.0 + compile + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml new file mode 100644 index 000000000..311ae9ab6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + subproject4 + 1.0-SNAPSHOT + + + subsubproject + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/expected-release-pom.xml new file mode 100644 index 000000000..358ef4674 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/expected-release-pom.xml @@ -0,0 +1,75 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + subproject2 + subproject3 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/pom.xml new file mode 100644 index 000000000..d8faf456c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..b0ae51f85 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject1/expected-release-pom.xml @@ -0,0 +1,77 @@ + + + + + + 4.0.0 + groupId + subproject1 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + junit + junit + 3.8.1 + test + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject1/pom.xml new file mode 100644 index 000000000..8e2e0791d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject1/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject2/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject2/expected-release-pom.xml new file mode 100644 index 000000000..459d4b71c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject2/expected-release-pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + groupId + subproject2 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + groupId + subproject1 + 1.0 + + + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject2-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject2/pom.xml new file mode 100644 index 000000000..3497d85f0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject2/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject3/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject3/expected-release-pom.xml new file mode 100644 index 000000000..b79e242e1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject3/expected-release-pom.xml @@ -0,0 +1,81 @@ + + + + + + 4.0.0 + groupId + subproject3 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject3-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject3/pom.xml new file mode 100644 index 000000000..a2f6c6808 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-extension/subproject3/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/expected-release-pom.xml new file mode 100644 index 000000000..2e2e5803f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/expected-release-pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + subproject2 + subproject3 + subproject4 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/pom.xml new file mode 100644 index 000000000..876538172 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..f4e4e616a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject1/expected-release-pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + groupId + subproject1 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-1.0 + + + external + plugin-artifactId + 1.0 + + + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject1/pom.xml new file mode 100644 index 000000000..58e6ac7ef --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject1/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject2/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject2/expected-release-pom.xml new file mode 100644 index 000000000..6fa1c96f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject2/expected-release-pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + groupId + subproject2 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject2-1.0 + + + groupId + subproject1 + 1.0 + + + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject2/pom.xml new file mode 100644 index 000000000..de0e63faf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject2/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject3/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject3/expected-release-pom.xml new file mode 100644 index 000000000..b4fae9d53 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject3/expected-release-pom.xml @@ -0,0 +1,81 @@ + + + + + + 4.0.0 + groupId + subproject3 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject3-1.0 + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject3/pom.xml new file mode 100644 index 000000000..ba380ab4e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject3/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject4/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject4/expected-release-pom.xml new file mode 100644 index 000000000..2d02ef77d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject4/expected-release-pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + groupId + subproject4 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject4-1.0 + + + groupId + subproject1 + 1.0 + + + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject4/pom.xml new file mode 100644 index 000000000..a71b019a4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-plugins/subproject4/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject4 + + + + + groupId + subproject1 + ${project.version} + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/expected-release-pom.xml new file mode 100644 index 000000000..952051d4b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/expected-release-pom.xml @@ -0,0 +1,71 @@ + + + + + 4.0.0 + groupId + artifactId + pom + 1.0 + + src/main/java + src/main/scripts + src/test/java + target/classes + target/test-classes + + + src/main/resources + + + + + src/test/resources + + + target + + + subproject1 + subproject2 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..b414727b9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject1/expected-release-pom.xml @@ -0,0 +1,66 @@ + + + + + 4.0.0 + groupId + subproject1 + 1.0 + + src/main/java + src/main/scripts + src/test/java + target/classes + target/test-classes + + + src/main/resources + + + + + src/test/resources + + + target + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject2/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject2/expected-release-pom.xml new file mode 100644 index 000000000..e6477973a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject2/expected-release-pom.xml @@ -0,0 +1,74 @@ + + + + + 4.0.0 + groupId + subproject2 + 1.0 + + src/main/java + src/main/scripts + src/test/java + target/classes + target/test-classes + + + src/main/resources + + + + + src/test/resources + + + target + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + groupId + subproject1 + 1.0 + compile + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject2/pom.xml new file mode 100644 index 000000000..80257d6bd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-range-dependency/subproject2/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + [1.0-SNAPSHOT,2.0-SNAPSHOT] + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/expected-release-pom.xml new file mode 100644 index 000000000..2e2e5803f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/expected-release-pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + subproject2 + subproject3 + subproject4 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/pom.xml new file mode 100644 index 000000000..876538172 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..425264850 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject1/expected-release-pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + groupId + subproject1 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + + external + plugin-artifactId + 1.0 + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject1/pom.xml new file mode 100644 index 000000000..f40f5e86b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject1/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject2/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject2/expected-release-pom.xml new file mode 100644 index 000000000..d95661aee --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject2/expected-release-pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + groupId + subproject2 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject2-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + + groupId + subproject1 + 1.0 + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject2/pom.xml new file mode 100644 index 000000000..9f3b24e3e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject2/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject3/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject3/expected-release-pom.xml new file mode 100644 index 000000000..2a1f03082 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject3/expected-release-pom.xml @@ -0,0 +1,81 @@ + + + + + + 4.0.0 + groupId + subproject3 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject3-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject3/pom.xml new file mode 100644 index 000000000..d9e3ceda6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject3/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject4/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject4/expected-release-pom.xml new file mode 100644 index 000000000..75325b637 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject4/expected-release-pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + groupId + subproject4 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject4-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + + groupId + subproject1 + RELEASE + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject4/pom.xml new file mode 100644 index 000000000..00dbfe1b0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-report-plugins/subproject4/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject4 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-finalname/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-finalname/expected-release-pom.xml new file mode 100644 index 000000000..4061e804b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-finalname/expected-release-pom.xml @@ -0,0 +1,74 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + groupId.artifactId-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-finalname/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-finalname/pom.xml new file mode 100644 index 000000000..52fc1e341 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-finalname/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + groupId + artifactId + 0.0.1-SNAPSHOT + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + ${project.groupId}.${project.artifactId}-${project.version} + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/expected-release-pom.xml new file mode 100644 index 000000000..6d0698fff --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/expected-release-pom.xml @@ -0,0 +1,73 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/pom.xml new file mode 100644 index 000000000..0991d5be2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/subproject1/expected-release-pom-version-changed.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/subproject1/expected-release-pom-version-changed.xml new file mode 100644 index 000000000..66f2faac2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/subproject1/expected-release-pom-version-changed.xml @@ -0,0 +1,69 @@ + + + + + + 4.0.0 + groupId + subproject1 + 2.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-2.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..7787f6f87 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/subproject1/expected-release-pom.xml @@ -0,0 +1,69 @@ + + + + + + 4.0.0 + groupId + subproject1 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/subproject1/pom.xml new file mode 100644 index 000000000..68c977b17 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-inherited-version/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/expected-release-pom.xml new file mode 100644 index 000000000..e83bffbd2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/expected-release-pom.xml @@ -0,0 +1,74 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + subproject2 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/pom.xml new file mode 100644 index 000000000..9cdabb007 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..b0ae51f85 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject1/expected-release-pom.xml @@ -0,0 +1,77 @@ + + + + + + 4.0.0 + groupId + subproject1 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + junit + junit + 3.8.1 + test + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject1/pom.xml new file mode 100644 index 000000000..fe46ed579 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject1/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject2/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject2/expected-release-pom.xml new file mode 100644 index 000000000..79bc99a43 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject2/expected-release-pom.xml @@ -0,0 +1,77 @@ + + + + + + 4.0.0 + groupId + subproject2 + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject2-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + groupId + subproject1 + 1.0 + compile + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject2/pom.xml new file mode 100644 index 000000000..6bb62f41a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-namespace/subproject2/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/expected-release-pom.xml new file mode 100644 index 000000000..98064ff64 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/expected-release-pom.xml @@ -0,0 +1,78 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/pom.xml new file mode 100644 index 000000000..2d60439af --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..f6847262f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/subproject1/expected-release-pom.xml @@ -0,0 +1,74 @@ + + + + + + 4.0.0 + groupId + subproject1 + 2.0 + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-2.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/subproject1/pom.xml new file mode 100644 index 000000000..cf375987a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-parent/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/expected-release-pom.xml new file mode 100644 index 000000000..bcd38db15 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/expected-release-pom.xml @@ -0,0 +1,73 @@ + + + + + + 4.0.0 + groupId + artifactId + 1 + pom + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1 + + + subproject1 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/pom.xml new file mode 100644 index 000000000..75f5a0d82 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + groupId + artifactId + 1 + pom + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..66f2faac2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/subproject1/expected-release-pom.xml @@ -0,0 +1,69 @@ + + + + + + 4.0.0 + groupId + subproject1 + 2.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-2.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/subproject1/pom.xml new file mode 100644 index 000000000..4badcdc2f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-with-released-parent/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1 + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-without-extension-version/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-without-extension-version/expected-release-pom.xml new file mode 100644 index 000000000..32629205a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-without-extension-version/expected-release-pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + groupId + something + RELEASE + + + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-without-extension-version/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-without-extension-version/pom.xml new file mode 100644 index 000000000..8d0ea1e3f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/pom-without-extension-version/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + + + groupId + something + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/expected-release-pom.xml new file mode 100644 index 000000000..5b9d8956d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/expected-release-pom.xml @@ -0,0 +1,79 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + artifactId-1.0 + + + subproject1 + subproject2 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/pom.xml new file mode 100644 index 000000000..0b403f0ed --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/pom.xml @@ -0,0 +1,80 @@ + + + + 4.0.0 + + groupId + + + artifactId + + + 1.0-SNAPSHOT + + pom + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + + + scm:svn:file://localhost/tmp/scm-repo/trunk + + + file://localhost/tmp/scm-repo/trunk + + + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject1/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject1/expected-release-pom.xml new file mode 100644 index 000000000..f6847262f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject1/expected-release-pom.xml @@ -0,0 +1,74 @@ + + + + + + 4.0.0 + groupId + subproject1 + 2.0 + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject1-2.0 + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject1/pom.xml new file mode 100644 index 000000000..ad42a164c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject1/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + + groupId + + + artifactId + + + 1.0-SNAPSHOT + + + + + subproject1 + + + 2.0-SNAPSHOT + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject2/expected-release-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject2/expected-release-pom.xml new file mode 100644 index 000000000..05022220f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject2/expected-release-pom.xml @@ -0,0 +1,89 @@ + + + + + + 4.0.0 + groupId + subproject2 + 1.0 + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + ${project.basedir}/src/main/java + src/main/scripts + ${project.basedir}/src/test/java + ${project.build.directory}/classes + ${project.build.directory}/test-classes + + + ${project.basedir}/src/main/resources + + + + + ${project.basedir}/src/test/resources + + + ${project.basedir}/target + subproject2-1.0 + + + groupId + subproject1 + 2.0 + + + + + + central + ${remoterepo} + + + + + + never + + + false + + central + Maven Plugin Repository + http://repo1.maven.org/maven2 + + + + + groupId + subproject1 + 2.0 + compile + + + + target/site + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject2/pom.xml new file mode 100644 index 000000000..066bedae4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/whitespace-around-values/subproject2/pom.xml @@ -0,0 +1,64 @@ + + + + 4.0.0 + + + groupId + + + artifactId + + + 1.0-SNAPSHOT + + + + + subproject2 + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/basic-pom/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/basic-pom/pom.xml new file mode 100644 index 000000000..051497462 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/basic-pom/pom.xml @@ -0,0 +1,26 @@ + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/pom-with-modules/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/pom-with-modules/pom.xml new file mode 100644 index 000000000..91b04f3e1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/pom-with-modules/pom.xml @@ -0,0 +1,32 @@ + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/pom-with-modules/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/pom-with-modules/subproject1/pom.xml new file mode 100644 index 000000000..dbfbce198 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/pom-with-modules/subproject1/pom.xml @@ -0,0 +1,30 @@ + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/pom-with-modules/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/pom-with-modules/subproject2/pom.xml new file mode 100644 index 000000000..29efa7193 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/remove-release-poms/pom-with-modules/subproject2/pom.xml @@ -0,0 +1,38 @@ + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + groupId + subproject1 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/basic-pom/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/basic-pom/expected-pom.xml new file mode 100644 index 000000000..051497462 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/basic-pom/expected-pom.xml @@ -0,0 +1,26 @@ + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/basic-pom/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/basic-pom/pom.xml new file mode 100644 index 000000000..8fb1e0b46 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/basic-pom/pom.xml @@ -0,0 +1,26 @@ + + + + + 4.0.0 + groupId + artifactId + 1.0 + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/basic-pom/pom.xml.releaseBackup b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/basic-pom/pom.xml.releaseBackup new file mode 100644 index 000000000..051497462 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/basic-pom/pom.xml.releaseBackup @@ -0,0 +1,26 @@ + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/expected-pom.xml new file mode 100644 index 000000000..3fbe000e5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/expected-pom.xml @@ -0,0 +1,32 @@ + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/pom.xml new file mode 100644 index 000000000..91b04f3e1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/pom.xml @@ -0,0 +1,32 @@ + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/pom.xml.releaseBackup b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/pom.xml.releaseBackup new file mode 100644 index 000000000..3fbe000e5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/pom.xml.releaseBackup @@ -0,0 +1,32 @@ + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject1/expected-pom.xml new file mode 100644 index 000000000..8a7716445 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject1/expected-pom.xml @@ -0,0 +1,30 @@ + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject1/pom.xml new file mode 100644 index 000000000..dbfbce198 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject1/pom.xml @@ -0,0 +1,30 @@ + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject1/pom.xml.releaseBackup b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject1/pom.xml.releaseBackup new file mode 100644 index 000000000..8a7716445 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject1/pom.xml.releaseBackup @@ -0,0 +1,30 @@ + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject2/expected-pom.xml new file mode 100644 index 000000000..7b57f2d4d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject2/expected-pom.xml @@ -0,0 +1,38 @@ + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject2/pom.xml new file mode 100644 index 000000000..29efa7193 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject2/pom.xml @@ -0,0 +1,38 @@ + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + groupId + subproject1 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject2/pom.xml.releaseBackup b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject2/pom.xml.releaseBackup new file mode 100644 index 000000000..7b57f2d4d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/restore-backup-poms/pom-with-modules/subproject2/pom.xml.releaseBackup @@ -0,0 +1,38 @@ + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-entities/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-entities/expected-pom.xml new file mode 100644 index 000000000..32085186d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-entities/expected-pom.xml @@ -0,0 +1,31 @@ + + + + + +]> + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + < & Non-ASCIIs: ß Ä° É™ σ ß Я × Ø° + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-entities/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-entities/pom.xml new file mode 100644 index 000000000..efce05fa0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-entities/pom.xml @@ -0,0 +1,31 @@ + + + + + +]> + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + < & Non-ASCIIs: ß İ ə σ ß Я א ذ + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/expected-pom.xml new file mode 100644 index 000000000..ac6c202b2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/expected-pom.xml @@ -0,0 +1,46 @@ + + + + + + 4.0.0 + + external + parent-artifactId + 1 + + + groupId + artifactId + 1.0-SNAPSHOT + pom + + + 2.0.4 + + + + subproject1 + + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + file://localhost/tmp/scm-repo/branches/release-label + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/pom.xml new file mode 100644 index 000000000..1ff58c11b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/pom.xml @@ -0,0 +1,40 @@ + + + + + + 4.0.0 + + external + parent-artifactId + 1 + + + groupId + artifactId + 1.0-SNAPSHOT + pom + + + 2.0.4 + + + + subproject1 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/expected-pom.xml new file mode 100644 index 000000000..e6b7926b0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/expected-pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + pom + + + subsubproject + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/pom.xml new file mode 100644 index 000000000..e6b7926b0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + pom + + + subsubproject + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/subsubproject/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/subsubproject/expected-pom.xml new file mode 100644 index 000000000..4a92ffdbc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/subsubproject/expected-pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + groupId + subproject1 + 1.0-SNAPSHOT + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/subsubproject/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/subsubproject/pom.xml new file mode 100644 index 000000000..4a92ffdbc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-inherited-scm/subproject1/subsubproject/pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + groupId + subproject1 + 1.0-SNAPSHOT + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-namespace/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-namespace/expected-pom.xml new file mode 100644 index 000000000..53c4eed8e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-namespace/expected-pom.xml @@ -0,0 +1,160 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + jar + + + test + test + http://www.foo.bar/ + + + The Apache Software Foundation + http://www.apache.org/ + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + apache.snapshots + Apache Snapshot Repository + https://people.apache.org/repo/m2-snapshot-repository + + false + + + + + + + + apache.releases + Apache Release Distribution Repository + scp://people.apache.org/www/people.apache.org/repo/m2-ibiblio-rsync-repository + + + apache.snapshots + Apache Development Snapshot Repository + scp://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository + + + + + + Apache Announce List + announce-subscribe@apache.org + announce-unsubscribe@apache.org + announce@apache.org + http://mail-archives.apache.org/mod_mbox/www-announce/ + + + + + http://www.apache.org/images/asf_logo_wide.gif + + + + + + + + run-its + + + + org.apache.maven.plugins + maven-invoker-plugin + 1.2 + + src/it + + **/pom.xml + + + MWAR-143/war-common/pom.xml + MWAR-143/war-filter-overlay/pom.xml + MWAR-131/mwar131-test/pom.xml + MWAR-131/mwar131-webapp/pom.xml + MWAR-131/mwar131-webapp2/pom.xml + **/META-INF/**/pom.xml + + verify.bsh + ${project.build.directory}/local-repo + + clean + package + + src/it/settings.xml + ${project.build.directory}/its + + + + integration-test + + install + run + + + + + + + org.apache.maven.plugins + maven-install-plugin + + + it-preparation + pre-integration-test + + install-file + + + ${project.build.directory}/${project.build.finalName}.jar + ${project.groupId} + ${project.artifactId} + ${project.version} + ${project.packaging} + ${basedir}/pom.xml + true + ${project.build.directory}/local-repo + + local + + + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-namespace/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-namespace/pom.xml new file mode 100644 index 000000000..b85fbbed9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-namespace/pom.xml @@ -0,0 +1,162 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + jar + + + test + test + http://www.foo.bar/ + + + The Apache Software Foundation + http://www.apache.org/ + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + apache.snapshots + Apache Snapshot Repository + https://people.apache.org/repo/m2-snapshot-repository + + false + + + + + + + + apache.releases + Apache Release Distribution Repository + scp://people.apache.org/www/people.apache.org/repo/m2-ibiblio-rsync-repository + + + apache.snapshots + Apache Development Snapshot Repository + scp://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository + + + + + + Apache Announce List + announce-subscribe@apache.org + announce-unsubscribe@apache.org + announce@apache.org + http://mail-archives.apache.org/mod_mbox/www-announce/ + + + + + http://www.apache.org/images/asf_logo_wide.gif + + + + + + + + run-its + + + + org.apache.maven.plugins + maven-invoker-plugin + 1.2 + + src/it + + **/pom.xml + + + MWAR-143/war-common/pom.xml + MWAR-143/war-filter-overlay/pom.xml + MWAR-131/mwar131-test/pom.xml + MWAR-131/mwar131-webapp/pom.xml + MWAR-131/mwar131-webapp2/pom.xml + **/META-INF/**/pom.xml + + verify.bsh + ${project.build.directory}/local-repo + + clean + package + + src/it/settings.xml + ${project.build.directory}/its + + + + integration-test + + install + run + + + + + + + org.apache.maven.plugins + maven-install-plugin + + + it-preparation + pre-integration-test + + install-file + + + ${project.build.directory}/${project.build.finalName}.jar + ${project.groupId} + ${project.artifactId} + ${project.version} + ${project.packaging} + ${basedir}/pom.xml + true + ${project.build.directory}/local-repo + + local + + + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs-from-tag/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs-from-tag/expected-pom.xml new file mode 100644 index 000000000..27435c207 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs-from-tag/expected-pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + ${scm.base}:pserver:anoncvs@localhost:/tmp/scm-repo:module + ${scm.base}:ext:${username}@localhost:/tmp/scm-repo:module + ${baseUrl}/module + release-label + + + scm:cvs + http://localhost/viewcvs.cgi + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs-from-tag/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs-from-tag/pom.xml new file mode 100644 index 000000000..923f88e8f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs-from-tag/pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + ${scm.base}:pserver:anoncvs@localhost:/tmp/scm-repo:module + ${scm.base}:ext:${username}@localhost:/tmp/scm-repo:module + ${baseUrl}/module + original-tag + + + scm:cvs + http://localhost/viewcvs.cgi + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs/expected-pom.xml new file mode 100644 index 000000000..60479d980 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs/expected-pom.xml @@ -0,0 +1,35 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module + scm:cvs:ext:${username}@localhost:/tmp/scm-repo:module + http://localhost/viewcvs.cgi/module + release-label + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs/pom.xml new file mode 100644 index 000000000..b4af394d3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-cvs/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module + scm:cvs:ext:${username}@localhost:/tmp/scm-repo:module + http://localhost/viewcvs.cgi/module + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-dashes-in-comment/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-dashes-in-comment/expected-pom.xml new file mode 100644 index 000000000..ca4081c03 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-dashes-in-comment/expected-pom.xml @@ -0,0 +1,37 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-dashes-in-comment/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-dashes-in-comment/pom.xml new file mode 100644 index 000000000..0b3f59721 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-dashes-in-comment/pom.xml @@ -0,0 +1,37 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-empty-scm/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-empty-scm/expected-pom.xml new file mode 100644 index 000000000..97b1e3b34 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-empty-scm/expected-pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-empty-scm/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-empty-scm/pom.xml new file mode 100644 index 000000000..5f5693643 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-empty-scm/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-encoding/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-encoding/expected-pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..340d1a5982cf1e01c9f29e637d61970f2443c284 GIT binary patch literal 2450 zcmd6pOK%fF5QO{8uNZOyDYgTG9D;EaAc%-4M%W?Z=x12u7v4<_7k)bMRgcGOTeidr zp;f%QJ>5Mu)z!WE_1o%pYTs>aBMWwK1DjiJnN4kCFYUmdSk;cW2UaH5!`^3gVz<6} zZEbsN6}*n|Ikkp8;Huk0Y!#jY*H8Xl6F0LTg<5j`Ykfo<;VZ?W8gqK~CmqOGp>EBC!*t>?&de*0vOQ95NHa@TH~F^BklBDQ2j z$i+#pN2?46wi$I`kL|?@PvGRj8(_J^a{&32SfLTFh$Q1VaL$ZM$TpxV!aj3PaUPui zF_sZt9V}W8@RB)_@>G^B68=ZRAh-q-I3#~ zh%QJ95be|5HltAi`!c8_g;Ku1;Ebq$#GSM{bM|5#BBL34kF1M> zbrrUVNV?a3n~CAFCP{lac?PIG^Zw`&q1tH*-Fe-Vzb5!;EqK%%6k;|_HFcR{ z`)f>%@Q{}}ABkJs+={W%V=0s`OGgr41UPt@; z{i4q5u2fBw85QZXgOppoE61iq$RY+!P@QndNqaoS_+3_I*<~+tZGJ5p%Wp*mRb8Q( z58S1_wx4O+SKo<~*}p6YOysRN*c1Rj#D0HMmjEeR-2#4h!S0 zo%EHPa7l4V4Gr+f^Mw07YbUEo9p~GK7|oUu-;^mn1?(00&$!3Pies6vT4OTI@zwlR z2Wj33r{-9Pw*gv`zPoPI33nrkXNc@bSK?SW)GKrU=Kf!&_*;zY=epx0BkGgBi~oY{ vv}e*ts$lHz$oKkxIQnXi>Bf<(MYYrX87vj9+KsvN|5N&6rfH$tZcU3nsy~+G literal 0 HcmV?d00001 diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-encoding/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-encoding/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..c2d9c6eda8c9f57b2abcf41b4f674afd1c4dff9d GIT binary patch literal 2348 zcmchZOK%fF5QO{8uNZs+DRu&a9D;EaAQ2H!jIcw*(a&J;3-2a@3qKwBs>kE?TDF9Q zgjU&E_jLEvR9DaB*Ke!av3<9RjV;)n4QyeVjcjI9dubJWVl_Kp49rZehrQ42)NXwC z%G!2jRlE-IIktv9;Hld~Y*oGj&rkkd6F0XXY@8$$MbW@rz%F*xJku7*Fu- zuv+}pB6>*7J+_6}SFC%%T+fkby!&L1QQBo7a@%UaG0hT*_2awN*6&m4+NJe}I_Bo;wvJI$;u+QC7oCoKB zf@O?X2aDzdyo?-4v7<7Yf|+2SHjvD$OKgV>%HLV8p;`qzhrAO@<(%@(S34{iSHa7>>G^A~NTuP-KBe-I3v| zh%QKS5be_4CZkaSyE3RFg;MVd9nxYv=dIp+<-hf7Z^cotYv$Yb)|#-?#_Jld4?HKZ z+Gg(5b2PE2Lz`INc*MDXD}R&jRySUvn_%ylm5&%0I3wyGaVM?LoxNCx$mj^YN7lu` zx(ZuFB;9M=WMa6iNzz_Mo&jnfd4KeXQ0;UI-Fn@WsV#f$uL-IPrOff^q)<-%TgapR~vo&2ao}S_W%F@ literal 0 HcmV?d00001 diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-scm-expression/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-scm-expression/expected-pom.xml new file mode 100644 index 000000000..1e5af206d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-scm-expression/expected-pom.xml @@ -0,0 +1,33 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:http://localhost/repo/branches/release-label + scm:svn:https://${user.name}@localhost/repo/branches/release-label + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-scm-expression/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-scm-expression/pom.xml new file mode 100644 index 000000000..e4ed45828 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-scm-expression/pom.xml @@ -0,0 +1,33 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:http://localhost/repo/trunk + scm:svn:https://${user.name}@localhost/repo/trunk + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base-and-varying-scm-urls/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base-and-varying-scm-urls/expected-pom.xml new file mode 100644 index 000000000..308b1d870 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base-and-varying-scm-urls/expected-pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/anon-scm-repo/allprojects/branches/release-label + scm:svn:file://localhost/tmp/scm-repo/allprojects/branches/release-label + file://localhost/tmp/viewvc/allprojects/branches/release-label + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base-and-varying-scm-urls/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base-and-varying-scm-urls/pom.xml new file mode 100644 index 000000000..a4eff49ac --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base-and-varying-scm-urls/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/anon-scm-repo/myproject/trunk + scm:svn:file://localhost/tmp/scm-repo/myproject/trunk + file://localhost/tmp/viewvc/myproject/trunk + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base/expected-pom.xml new file mode 100644 index 000000000..20b61ce1c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base/expected-pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + file://localhost/tmp/scm-repo/branches/release-label + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base/pom.xml new file mode 100644 index 000000000..8356b8df1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-tag-base/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/expected-pom-with-schema.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/expected-pom-with-schema.xml new file mode 100644 index 000000000..a983613cf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/expected-pom-with-schema.xml @@ -0,0 +1,41 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + file://localhost/tmp/scm-repo/branches/release-label + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/expected-pom.xml new file mode 100644 index 000000000..c33fa2ca9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/expected-pom.xml @@ -0,0 +1,41 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + file://localhost/tmp/scm-repo/branches/release-label + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/pom.xml new file mode 100644 index 000000000..db3aeabe4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/pom.xml @@ -0,0 +1,41 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/expected-pom.xml new file mode 100644 index 000000000..e93116387 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/expected-pom.xml @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + + + + pom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/pom.xml new file mode 100644 index 000000000..7a3b0a1bf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/pom.xml @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + + + -SNAPSHOT + pom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject1/expected-pom.xml new file mode 100644 index 000000000..bbcf3ef25 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject1/expected-pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject1/pom.xml new file mode 100644 index 000000000..bbcf3ef25 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject1/pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject2/expected-pom.xml new file mode 100644 index 000000000..9db2067be --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject2/expected-pom.xml @@ -0,0 +1,46 @@ + + + + + + 4.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject2/pom.xml new file mode 100644 index 000000000..9db2067be --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-around-values/subproject2/pom.xml @@ -0,0 +1,46 @@ + + + + + + 4.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-section/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-section/expected-pom.xml new file mode 100644 index 000000000..d5a1cded7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-section/expected-pom.xml @@ -0,0 +1,67 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + file://localhost/tmp/scm-repo/branches/release-label + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + + true + + com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder + + + com.atlassw.tools.eclipse.checkstyle.CheckstyleNature + + + + .checkstyle + + + + + + + +]]> + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-section/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-section/pom.xml new file mode 100644 index 000000000..03de6e3da --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/cdata-section/pom.xml @@ -0,0 +1,67 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + + true + + com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder + + + com.atlassw.tools.eclipse.checkstyle.CheckstyleNature + + + + .checkstyle + + + + + + + +]]> + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/expected-pom.xml new file mode 100644 index 000000000..192ba84fa --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/expected-pom.xml @@ -0,0 +1,59 @@ + + + + 4.0.0 + groupId + artifactId + + + 1.0-SNAPSHOT + + + pom + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + file://localhost/tmp/scm-repo/branches/release-label + + + + + + groupId + subproject1 + 2.0-SNAPSHOT + + + + + + + + + groupId + subproject1 + 2.0-SNAPSHOT + + + + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/pom.xml new file mode 100644 index 000000000..e6388f8cf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/pom.xml @@ -0,0 +1,59 @@ + + + + 4.0.0 + groupId + artifactId + + + 1.0-SNAPSHOT + + + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + + + groupId + subproject1 + 2.0-SNAPSHOT + + + + + + + + + groupId + subproject1 + 2.0-SNAPSHOT + + + + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/subproject1/expected-pom.xml new file mode 100644 index 000000000..1aca194a7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/subproject1/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/subproject1/pom.xml new file mode 100644 index 000000000..1aca194a7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/comments-around-values/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/expected-pom.xml new file mode 100644 index 000000000..669d1547d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/expected-pom.xml @@ -0,0 +1,30 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/pom.xml new file mode 100644 index 000000000..669d1547d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/pom.xml @@ -0,0 +1,30 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject1/expected-pom.xml new file mode 100644 index 000000000..ea5479441 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject1/expected-pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + + external + artifactId + 1.0 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject1/pom.xml new file mode 100644 index 000000000..ea5479441 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject1/pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + + external + artifactId + 1.0 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject2/expected-pom.xml new file mode 100644 index 000000000..c6698dc35 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject2/expected-pom.xml @@ -0,0 +1,48 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + pom + import + + + + + + + external + artifactId + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject2/pom.xml new file mode 100644 index 000000000..c6698dc35 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/imported-dependency-management-in-reactor/subproject2/pom.xml @@ -0,0 +1,48 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + pom + import + + + + + + + external + artifactId + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/expected-pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject1/expected-pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject2/expected-pom.xml new file mode 100644 index 000000000..f0c200c64 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject2/expected-pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject2/pom.xml new file mode 100644 index 000000000..f0c200c64 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-dependencies/subproject2/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/expected-pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject1/expected-pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject2/expected-pom.xml new file mode 100644 index 000000000..201e9819f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject2/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject2/pom.xml new file mode 100644 index 000000000..201e9819f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-extension/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/expected-pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject1/expected-pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject2/expected-pom.xml new file mode 100644 index 000000000..6210b1ee1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject2/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject2/pom.xml new file mode 100644 index 000000000..6210b1ee1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-plugins/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/expected-pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject1/expected-pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject2/expected-pom.xml new file mode 100644 index 000000000..27fc275d0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject2/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject2/pom.xml new file mode 100644 index 000000000..27fc275d0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-differing-snapshot-report-plugins/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/expected-pom.xml new file mode 100644 index 000000000..dc9e67208 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/expected-pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + groupId + subproject2 + 0.5 + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/pom.xml new file mode 100644 index 000000000..dc9e67208 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + groupId + subproject2 + 0.5 + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject1/expected-pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject2/expected-pom.xml new file mode 100644 index 000000000..b6cc6c111 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject2/expected-pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject2/pom.xml new file mode 100644 index 000000000..b6cc6c111 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject2/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject3/expected-pom.xml new file mode 100644 index 000000000..fb6d85a5e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject3/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + groupId + subproject1 + + + groupId + subproject2 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject3/pom.xml new file mode 100644 index 000000000..fb6d85a5e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-dependency/subproject3/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + groupId + subproject1 + + + groupId + subproject2 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/expected-pom.xml new file mode 100644 index 000000000..ec1741bf4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/expected-pom.xml @@ -0,0 +1,46 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + groupId + subproject2 + 0.5 + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/pom.xml new file mode 100644 index 000000000..ec1741bf4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/pom.xml @@ -0,0 +1,46 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + groupId + subproject2 + 0.5 + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject1/expected-pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject2/expected-pom.xml new file mode 100644 index 000000000..7027c9ca0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject2/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject2/pom.xml new file mode 100644 index 000000000..7027c9ca0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject2/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject3/expected-pom.xml new file mode 100644 index 000000000..031fd957b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject3/expected-pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + groupId + subproject1 + + + groupId + subproject2 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject3/pom.xml new file mode 100644 index 000000000..031fd957b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-managed-snapshot-plugin/subproject3/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + groupId + subproject1 + + + groupId + subproject2 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/expected-pom.xml new file mode 100644 index 000000000..876538172 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/expected-pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..876538172 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject1/expected-pom.xml new file mode 100644 index 000000000..8e2e0791d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject1/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject1/pom.xml new file mode 100644 index 000000000..8e2e0791d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject1/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject2/expected-pom.xml new file mode 100644 index 000000000..0dd5cdafd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject2/expected-pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject2/pom.xml new file mode 100644 index 000000000..0dd5cdafd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject2/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject3/expected-pom.xml new file mode 100644 index 000000000..0264cb6a2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject3/expected-pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject3/pom.xml new file mode 100644 index 000000000..0264cb6a2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject3/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/expected-pom.xml new file mode 100644 index 000000000..46bdc11b2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/expected-pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject4 + pom + + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/pom.xml new file mode 100644 index 000000000..46bdc11b2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject4 + pom + + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/subsubproject/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/subsubproject/expected-pom.xml new file mode 100644 index 000000000..311ae9ab6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/subsubproject/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + subproject4 + 1.0-SNAPSHOT + + + subsubproject + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml new file mode 100644 index 000000000..311ae9ab6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + subproject4 + 1.0-SNAPSHOT + + + subsubproject + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/expected-pom.xml new file mode 100644 index 000000000..d8faf456c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/expected-pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/pom.xml new file mode 100644 index 000000000..d8faf456c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject1/expected-pom.xml new file mode 100644 index 000000000..8e2e0791d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject1/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject1/pom.xml new file mode 100644 index 000000000..8e2e0791d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject1/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject2/expected-pom.xml new file mode 100644 index 000000000..3497d85f0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject2/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject2/pom.xml new file mode 100644 index 000000000..3497d85f0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject2/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject3/expected-pom.xml new file mode 100644 index 000000000..a2f6c6808 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject3/expected-pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject3/pom.xml new file mode 100644 index 000000000..a2f6c6808 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-extension/subproject3/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/expected-pom.xml new file mode 100644 index 000000000..d8faf456c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/expected-pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/pom.xml new file mode 100644 index 000000000..d8faf456c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject1/expected-pom.xml new file mode 100644 index 000000000..c5e8d740a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject1/expected-pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + external + artifactId + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject1/pom.xml new file mode 100644 index 000000000..c5e8d740a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject1/pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + external + artifactId + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject2/expected-pom.xml new file mode 100644 index 000000000..e01e97ce4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject2/expected-pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + external + plugin-artifactId + 1.0 + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject2/pom.xml new file mode 100644 index 000000000..e01e97ce4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject2/pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + external + plugin-artifactId + 1.0 + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject3/expected-pom.xml new file mode 100644 index 000000000..0f5656e46 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject3/expected-pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + external + plugin-artifactId + 1.0 + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject3/pom.xml new file mode 100644 index 000000000..0f5656e46 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugin-deps/subproject3/pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + external + plugin-artifactId + 1.0 + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/expected-pom.xml new file mode 100644 index 000000000..876538172 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/expected-pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/pom.xml new file mode 100644 index 000000000..876538172 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject1/expected-pom.xml new file mode 100644 index 000000000..58e6ac7ef --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject1/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject1/pom.xml new file mode 100644 index 000000000..58e6ac7ef --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject1/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject2/expected-pom.xml new file mode 100644 index 000000000..de0e63faf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject2/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject2/pom.xml new file mode 100644 index 000000000..de0e63faf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject2/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject3/expected-pom.xml new file mode 100644 index 000000000..ba380ab4e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject3/expected-pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject3/pom.xml new file mode 100644 index 000000000..ba380ab4e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject3/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject4/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject4/expected-pom.xml new file mode 100644 index 000000000..c9aac9dd6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject4/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject4 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject4/pom.xml new file mode 100644 index 000000000..c9aac9dd6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-plugins/subproject4/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject4 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/expected-pom.xml new file mode 100644 index 000000000..130599c6f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/expected-pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + + + + + it + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + groupId + subproject2 + 0.5 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/pom.xml new file mode 100644 index 000000000..130599c6f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + + + + + it + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + groupId + subproject2 + 0.5 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject1/expected-pom.xml new file mode 100644 index 000000000..bf86ed0dd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject1/expected-pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + it + + + external + artifactId + 1.0 + + + + + + external + plugin-artifactId + 1.0 + + + external + artifactId + 1.0 + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject1/pom.xml new file mode 100644 index 000000000..bf86ed0dd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject1/pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + it + + + external + artifactId + 1.0 + + + + + + external + plugin-artifactId + 1.0 + + + external + artifactId + 1.0 + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject2/expected-pom.xml new file mode 100644 index 000000000..4fa661c9b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject2/expected-pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + it + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject2/pom.xml new file mode 100644 index 000000000..4fa661c9b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject2/pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + it + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject3/expected-pom.xml new file mode 100644 index 000000000..5dd18d1ca --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject3/expected-pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + it + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject3/pom.xml new file mode 100644 index 000000000..5dd18d1ca --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-profile/subproject3/pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + it + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/expected-pom.xml new file mode 100644 index 000000000..876538172 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/expected-pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/pom.xml new file mode 100644 index 000000000..876538172 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject1/expected-pom.xml new file mode 100644 index 000000000..f40f5e86b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject1/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject1/pom.xml new file mode 100644 index 000000000..f40f5e86b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject1/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject2/expected-pom.xml new file mode 100644 index 000000000..9f3b24e3e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject2/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject2/pom.xml new file mode 100644 index 000000000..9f3b24e3e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject2/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject3/expected-pom.xml new file mode 100644 index 000000000..d9e3ceda6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject3/expected-pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject3/pom.xml new file mode 100644 index 000000000..d9e3ceda6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject3/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject4/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject4/expected-pom.xml new file mode 100644 index 000000000..00dbfe1b0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject4/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject4 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject4/pom.xml new file mode 100644 index 000000000..00dbfe1b0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/internal-snapshot-report-plugins/subproject4/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject4 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/expected-pom-different-version.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/expected-pom-different-version.xml new file mode 100644 index 000000000..b1022898c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/expected-pom-different-version.xml @@ -0,0 +1,51 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + groupId + subproject1 + 2.0-SNAPSHOT + + + + + + + + + groupId + subproject1 + 2.0-SNAPSHOT + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/expected-pom.xml new file mode 100644 index 000000000..0f3233e10 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/expected-pom.xml @@ -0,0 +1,51 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + groupId + subproject1 + ${project.version} + + + + + + + + + groupId + subproject1 + ${project.version} + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/pom.xml new file mode 100644 index 000000000..0f3233e10 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/pom.xml @@ -0,0 +1,51 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + groupId + subproject1 + ${project.version} + + + + + + + + + groupId + subproject1 + ${project.version} + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject1/expected-pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject2/expected-pom-different-version.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject2/expected-pom-different-version.xml new file mode 100644 index 000000000..163095a1a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject2/expected-pom-different-version.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + + + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject2/expected-pom.xml new file mode 100644 index 000000000..163095a1a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject2/expected-pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + + + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject2/pom.xml new file mode 100644 index 000000000..163095a1a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject2/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + + + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject3/expected-pom-different-version.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject3/expected-pom-different-version.xml new file mode 100644 index 000000000..7f2db1233 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject3/expected-pom-different-version.xml @@ -0,0 +1,61 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + groupId + subproject1 + 2.0-SNAPSHOT + + + + + + + groupId + subproject1 + 2.0-SNAPSHOT + + + + + groupId + subproject1 + 2.0-SNAPSHOT + + + + + + + + groupId + subproject1 + 2.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject3/expected-pom.xml new file mode 100644 index 000000000..82f1dc638 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject3/expected-pom.xml @@ -0,0 +1,61 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + groupId + subproject1 + ${project.version} + + + + + + + groupId + subproject1 + ${project.version} + + + + + groupId + subproject1 + ${project.version} + + + + + + + + groupId + subproject1 + ${project.version} + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject3/pom.xml new file mode 100644 index 000000000..82f1dc638 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/interpolated-versions/subproject3/pom.xml @@ -0,0 +1,61 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + groupId + subproject1 + ${project.version} + + + + + + + groupId + subproject1 + ${project.version} + + + + + groupId + subproject1 + ${project.version} + + + + + + + + groupId + subproject1 + ${project.version} + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/expected-pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject1/expected-pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject2/expected-pom.xml new file mode 100644 index 000000000..428685d08 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject2/expected-pom.xml @@ -0,0 +1,31 @@ + + + + 4.0.0 + + groupId + subproject2 + 2.0-SNAPSHOT + + + + groupId + subproject1 + 0.5 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject2/pom.xml new file mode 100644 index 000000000..428685d08 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/modules-with-different-versions/subproject2/pom.xml @@ -0,0 +1,31 @@ + + + + 4.0.0 + + groupId + subproject2 + 2.0-SNAPSHOT + + + + groupId + subproject1 + 0.5 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/expected-pom.xml new file mode 100644 index 000000000..7bca53b88 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + file://localhost/tmp/scm-repo/branches/release-label + + + + subproject1 + sub/subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/pom.xml new file mode 100644 index 000000000..2fe3a8fdf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1 + sub/subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/sub/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/sub/subproject2/expected-pom.xml new file mode 100644 index 000000000..8c1f2190f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/sub/subproject2/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + ../.. + + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label/sub/subproject2 + scm:svn:file://localhost/tmp/scm-repo/branches/release-label/sub/subproject2 + file://localhost/tmp/scm-repo/branches/release-label/sub/subproject2 + + + subproject2 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/sub/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/sub/subproject2/pom.xml new file mode 100644 index 000000000..ec9bbaf0d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/sub/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + ../.. + + + + scm:svn:file://localhost/tmp/scm-repo/trunk/sub/subproject2 + scm:svn:file://localhost/tmp/scm-repo/trunk/sub/subproject2 + file://localhost/tmp/scm-repo/trunk/sub/subproject2 + + + subproject2 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/subproject1/expected-pom.xml new file mode 100644 index 000000000..fd15e14f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/subproject1/expected-pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/subproject1/pom.xml new file mode 100644 index 000000000..fd15e14f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/multimodule-with-deep-subprojects/subproject1/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/expected-pom.xml new file mode 100644 index 000000000..0991d5be2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/pom.xml new file mode 100644 index 000000000..0991d5be2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/subproject1/expected-pom-version-changed.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/subproject1/expected-pom-version-changed.xml new file mode 100644 index 000000000..58353d106 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/subproject1/expected-pom-version-changed.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/subproject1/expected-pom.xml new file mode 100644 index 000000000..68c977b17 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/subproject1/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/subproject1/pom.xml new file mode 100644 index 000000000..68c977b17 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-inherited-version/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/expected-pom.xml new file mode 100644 index 000000000..9cdabb007 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/pom.xml new file mode 100644 index 000000000..9cdabb007 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject1/expected-pom.xml new file mode 100644 index 000000000..e7527c36f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject1/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject1/pom.xml new file mode 100644 index 000000000..fe46ed579 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject1/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject2/expected-pom.xml new file mode 100644 index 000000000..35defbdcd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject2/expected-pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject2/pom.xml new file mode 100644 index 000000000..6bb62f41a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-namespace/subproject2/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/expected-pom.xml new file mode 100644 index 000000000..8330a6160 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/expected-pom.xml @@ -0,0 +1,32 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + file://localhost/tmp/scm-repo/branches/release-label + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/pom.xml new file mode 100644 index 000000000..7e4bc93f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/pom.xml @@ -0,0 +1,32 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/expected-pom.xml new file mode 100644 index 000000000..c25d63d60 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + pom + + + subsubproject + + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label/subproject1 + scm:svn:file://localhost/tmp/scm-repo/branches/release-label/subproject1 + http://localhost/viewvc/mypath/branches/release-label/subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/pom.xml new file mode 100644 index 000000000..b7128194f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + pom + + + subsubproject + + + + scm:svn:file://localhost/tmp/scm-repo/trunk/subproject1 + scm:svn:file://localhost/tmp/scm-repo/trunk/subproject1 + http://localhost/viewvc/mypath/trunk/subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/subsubproject/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/subsubproject/expected-pom.xml new file mode 100644 index 000000000..4a92ffdbc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/subsubproject/expected-pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + groupId + subproject1 + 1.0-SNAPSHOT + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/subsubproject/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/subsubproject/pom.xml new file mode 100644 index 000000000..4a92ffdbc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-overridden-scm/subproject1/subsubproject/pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + groupId + subproject1 + 1.0-SNAPSHOT + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/expected-pom.xml new file mode 100644 index 000000000..16fa9ee10 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/expected-pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + file://localhost/tmp/scm-repo/branches/release-label + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/pom.xml new file mode 100644 index 000000000..d8b11dc1e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject1/expected-pom.xml new file mode 100644 index 000000000..14b84b1dc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject1/expected-pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + + + 2.0-SNAPSHOT + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject1/pom.xml new file mode 100644 index 000000000..14b84b1dc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject1/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + + + 2.0-SNAPSHOT + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject2/expected-pom.xml new file mode 100644 index 000000000..9f938676d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject2/expected-pom.xml @@ -0,0 +1,42 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + 2.0-SNAPSHOT + + + + groupId + subproject1 + ${module.version} + + + + + 2.0-SNAPSHOT + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject2/pom.xml new file mode 100644 index 000000000..9f938676d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-and-properties/subproject2/pom.xml @@ -0,0 +1,42 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + 2.0-SNAPSHOT + + + + groupId + subproject1 + ${module.version} + + + + + 2.0-SNAPSHOT + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/root-project/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/root-project/expected-pom.xml new file mode 100644 index 000000000..86d3006d5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/root-project/expected-pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label/root-project + scm:svn:file://localhost/tmp/scm-repo/branches/release-label/root-project + file://localhost/tmp/scm-repo/branches/release-label/root-project + + + + ../subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/root-project/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/root-project/pom.xml new file mode 100644 index 000000000..93fbc571a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/root-project/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk/root-project + scm:svn:file://localhost/tmp/scm-repo/trunk/root-project + file://localhost/tmp/scm-repo/trunk/root-project + + + + ../subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/subproject1/expected-pom.xml new file mode 100644 index 000000000..4a765e112 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/subproject1/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + ../root-project + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/subproject1/pom.xml new file mode 100644 index 000000000..4a765e112 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent-flat/subproject1/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + ../root-project + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/expected-pom.xml new file mode 100644 index 000000000..929d88fee --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/expected-pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + file://localhost/tmp/scm-repo/branches/release-label + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/pom.xml new file mode 100644 index 000000000..2d60439af --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/subproject1/expected-pom.xml new file mode 100644 index 000000000..cf375987a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/subproject1/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/subproject1/pom.xml new file mode 100644 index 000000000..cf375987a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-parent/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/expected-pom.xml new file mode 100644 index 000000000..914af7f7f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/expected-pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + file://localhost/tmp/scm-repo/branches/release-label + + + + subproject1-3.4 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/pom.xml new file mode 100644 index 000000000..efbdc07ea --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1-3.4 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject1-3.4/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject1-3.4/expected-pom.xml new file mode 100644 index 000000000..6f9fb5ed7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject1-3.4/expected-pom.xml @@ -0,0 +1,33 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1-3.4 + 2.0-SNAPSHOT + + + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject1-3.4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject1-3.4/pom.xml new file mode 100644 index 000000000..6f9fb5ed7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject1-3.4/pom.xml @@ -0,0 +1,33 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1-3.4 + 2.0-SNAPSHOT + + + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject2/expected-pom.xml new file mode 100644 index 000000000..8fff76fa7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject2/expected-pom.xml @@ -0,0 +1,42 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + 2.0-SNAPSHOT + + + + groupId + subproject1-${subproject.version} + ${project.version} + + + + + 3.4 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject2/pom.xml new file mode 100644 index 000000000..8fff76fa7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-property-dependency-coordinate/subproject2/pom.xml @@ -0,0 +1,42 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + 2.0-SNAPSHOT + + + + groupId + subproject1-${subproject.version} + ${project.version} + + + + + 3.4 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/expected-pom.xml new file mode 100644 index 000000000..75f5a0d82 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + groupId + artifactId + 1 + pom + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/pom.xml new file mode 100644 index 000000000..75f5a0d82 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + groupId + artifactId + 1 + pom + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/subproject1/expected-pom.xml new file mode 100644 index 000000000..4badcdc2f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/subproject1/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1 + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/subproject1/pom.xml new file mode 100644 index 000000000..4badcdc2f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-released-parent/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1 + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/expected-pom.xml new file mode 100644 index 000000000..929d88fee --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/expected-pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + file://localhost/tmp/scm-repo/branches/release-label + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/pom.xml new file mode 100644 index 000000000..fe4362086 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk/ + scm:svn:file://localhost/tmp/scm-repo/trunk/ + file://localhost/tmp/scm-repo/trunk/ + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/subproject1/expected-pom.xml new file mode 100644 index 000000000..e572ac811 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/subproject1/expected-pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label/subproject1 + scm:svn:file://localhost/tmp/scm-repo/branches/release-label/subproject1 + file://localhost/tmp/scm-repo/branches/release-label/subproject1 + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/subproject1/pom.xml new file mode 100644 index 000000000..202f6f8a3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-with-scm-of-parent-ending-with-a-slash/subproject1/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + + scm:svn:file://localhost/tmp/scm-repo/trunk/subproject1/ + scm:svn:file://localhost/tmp/scm-repo/trunk/subproject1/ + file://localhost/tmp/scm-repo/trunk/subproject1/ + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-without-extension-version/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-without-extension-version/expected-pom.xml new file mode 100644 index 000000000..a1f4d9553 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-without-extension-version/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + + + groupId + something + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-without-extension-version/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-without-extension-version/pom.xml new file mode 100644 index 000000000..a1f4d9553 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/pom-without-extension-version/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + + + groupId + something + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/expected-pom.xml new file mode 100644 index 000000000..6c4dae49a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/expected-pom.xml @@ -0,0 +1,80 @@ + + + + 4.0.0 + + groupId + + + artifactId + + + 1.0-SNAPSHOT + + pom + + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + + + scm:svn:file://localhost/tmp/scm-repo/branches/release-label + + + file://localhost/tmp/scm-repo/branches/release-label + + + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/pom.xml new file mode 100644 index 000000000..0b403f0ed --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/pom.xml @@ -0,0 +1,80 @@ + + + + 4.0.0 + + groupId + + + artifactId + + + 1.0-SNAPSHOT + + pom + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + + + scm:svn:file://localhost/tmp/scm-repo/trunk + + + file://localhost/tmp/scm-repo/trunk + + + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject1/expected-pom.xml new file mode 100644 index 000000000..ad42a164c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject1/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + + groupId + + + artifactId + + + 1.0-SNAPSHOT + + + + + subproject1 + + + 2.0-SNAPSHOT + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject1/pom.xml new file mode 100644 index 000000000..ad42a164c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject1/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + + groupId + + + artifactId + + + 1.0-SNAPSHOT + + + + + subproject1 + + + 2.0-SNAPSHOT + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject2/expected-pom.xml new file mode 100644 index 000000000..066bedae4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject2/expected-pom.xml @@ -0,0 +1,64 @@ + + + + 4.0.0 + + + groupId + + + artifactId + + + 1.0-SNAPSHOT + + + + + subproject2 + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject2/pom.xml new file mode 100644 index 000000000..066bedae4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/whitespace-around-values/subproject2/pom.xml @@ -0,0 +1,64 @@ + + + + 4.0.0 + + + groupId + + + artifactId + + + 1.0-SNAPSHOT + + + + + subproject2 + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/ejb/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/ejb/expected-pom.xml new file mode 100644 index 000000000..599eadb64 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/ejb/expected-pom.xml @@ -0,0 +1,25 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + ejb + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/ejb/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/ejb/pom.xml new file mode 100644 index 000000000..bba0c9e16 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/ejb/pom.xml @@ -0,0 +1,25 @@ + + + + + + 4.0.0 + groupId + artifactId1 + 1.0-SNAPSHOT + ejb + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/project/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/project/expected-pom.xml new file mode 100644 index 000000000..ef9bee712 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/project/expected-pom.xml @@ -0,0 +1,56 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + + + + groupId + artifactId1 + ejb + 1.1-SNAPSHOT + + + groupId + artifactId1 + ejb-client + 1.1-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/project/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/project/pom.xml new file mode 100644 index 000000000..a05fa3cfd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-ejb-client-dep/project/pom.xml @@ -0,0 +1,56 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + + + + groupId + artifactId1 + ejb + 1.0-SNAPSHOT + + + groupId + artifactId1 + ejb-client + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-entities/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-entities/expected-pom.xml new file mode 100644 index 000000000..9e7876dea --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-entities/expected-pom.xml @@ -0,0 +1,31 @@ + + + + + +]> + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + < & Non-ASCIIs: ß Ä° É™ σ ß Я × Ø° + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-entities/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-entities/pom.xml new file mode 100644 index 000000000..4d71fe327 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-entities/pom.xml @@ -0,0 +1,31 @@ + + + + + +]> + + + 4.0.0 + groupId + artifactId + 1.0 + < & Non-ASCIIs: ß İ ə σ ß Я א ذ + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/expected-pom.xml new file mode 100644 index 000000000..0623f3050 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/expected-pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + + external + parent-artifactId + 1 + + + groupId + artifactId + 1.1-SNAPSHOT + pom + + + 2.0.4 + + + + subproject1 + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/pom.xml new file mode 100644 index 000000000..ff026270b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/pom.xml @@ -0,0 +1,40 @@ + + + + + + 4.0.0 + + external + parent-artifactId + 1 + + + groupId + artifactId + 1.0 + pom + + + 2.0.4 + + + + subproject1 + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/expected-pom.xml new file mode 100644 index 000000000..99b5a68cd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/expected-pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + pom + + subproject1 + + + subsubproject + + + + scm:svn:file://localhost/tmp/scm-repo/trunk/subproject1 + scm:svn:file://localhost/tmp/scm-repo/trunk/subproject1 + http://localhost/viewvc/mypath/trunk/subproject1 + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/pom.xml new file mode 100644 index 000000000..33887cb2b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + pom + + subproject1 + + + subsubproject + + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label/subproject1 + scm:svn:file://localhost/tmp/scm-repo/tags/release-label/subproject1 + http://localhost/viewvc/mypath/tags/release-label/subproject1 + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/subsubproject/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/subsubproject/expected-pom.xml new file mode 100644 index 000000000..540dbb642 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/subsubproject/expected-pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + groupId + subproject1 + 1.1-SNAPSHOT + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/subsubproject/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/subsubproject/pom.xml new file mode 100644 index 000000000..f0b2f7058 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-inherited-scm/subproject1/subsubproject/pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + groupId + subproject1 + 1.0 + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-namespace/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-namespace/expected-pom.xml new file mode 100644 index 000000000..865a6e757 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-namespace/expected-pom.xml @@ -0,0 +1,26 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-namespace/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-namespace/pom.xml new file mode 100644 index 000000000..db14fa943 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-namespace/pom.xml @@ -0,0 +1,28 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs-from-tag/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs-from-tag/expected-pom.xml new file mode 100644 index 000000000..52c1aa37b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs-from-tag/expected-pom.xml @@ -0,0 +1,35 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + + + 2.0.4 + + + + scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module + scm:cvs:ext:${username}@localhost:/tmp/scm-repo:module + http://localhost/viewcvs.cgi/module + original-label + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs-from-tag/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs-from-tag/pom.xml new file mode 100644 index 000000000..2780f9c86 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs-from-tag/pom.xml @@ -0,0 +1,35 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + + 2.0.4 + + + + scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module + scm:cvs:ext:${username}@localhost:/tmp/scm-repo:module + http://localhost/viewcvs.cgi/module + release-label + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs/expected-pom.xml new file mode 100644 index 000000000..c68c10f90 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs/expected-pom.xml @@ -0,0 +1,38 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + + + 2.0.4 + + + + ${scm.base}:pserver:anoncvs@localhost:/tmp/scm-repo:module + ${scm.base}:ext:${username}@localhost:/tmp/scm-repo:module + ${baseUrl}/module + + + scm:cvs + http://localhost/viewcvs.cgi + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs/pom.xml new file mode 100644 index 000000000..63c09afb1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-cvs/pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + + 2.0.4 + + + + ${scm.base}:pserver:anoncvs@localhost:/tmp/scm-repo:module + ${scm.base}:ext:${username}@localhost:/tmp/scm-repo:module + ${baseUrl}/module + release-label + + + scm:cvs + http://localhost/viewcvs.cgi + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-encoding/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-encoding/expected-pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..dac6a6daffefe90590011886967bc8794bf92d5d GIT binary patch literal 2144 zcmchY-A@xi6vgkef5q4*O`w2L9P)a4wk z2e!kr^ruNy)!8O1EYQP_@2BchhUMH&QO&VkSeLgnBF>9-iZR$FxW!lI>`5KpU^Q`_ zsNVzMiB^rQ4M8wiF`P1A5+fAa&$VYoo#a@Y zLG+OB))|coc&LI-q)_VJ;DmG;PkHNXzV`q6w^ec!>JoXs&P$DyuYTz$rn6p0SYl&+-f>y${pQf zDkVZuItj&nqPR`BMICFgE8Ta+?I$K?_QetBZqTG1%)jO52{hx~1?I+J87M z>a68T)r~TzBO_Lja;yKUQMU+L#Go5gJDjl7A+wmj$*L-w>{YG$*P`v;iamJfqLL$f z&nWHnd{67K`c6bd88~iAmZDAHnJJHYUi70)2Nik1c!%$xyes1klaiy;opP(sh{?g9 z6F+B+ncJ?=IbL}d-rcW`Zu5E(VML_9X%AXOT3q-y?SEqYTLkw}--0uR+v2P8?@SdH Pi|!TNN)=Mfn)d$y$8=^( literal 0 HcmV?d00001 diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-encoding/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-encoding/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..a694775be636efb9f8db7c82e633eac08929d5a4 GIT binary patch literal 2204 zcmd6oOK;Oq5QS&Wuef9dQkxb8U6hcjKr1S$Mj|N{%RHQ76@0y7q{xV~>&T@)Wp!@_UQl!hR4t#q*05$et5--(F%DpAL`>&?VfDu^y5w zzV-2*;JHDk)Qs7_cju8PM?RW87K zXnR~MzuI`!m2Hz@Nk8oQdFndlNY3qyt~s#_>+`Q35$9!|@*eCG+~O;D_S7BUU^VqV zQN2fg5@n67jX^M4Go10f!bT``o@@7teNrF|YgSgs#c=F-6o^410IT?i4;oxx0sMV_cQ)An{WJGZ#xx7!LHB`?7j71X@J!gRv)>JVReA+ z#AEc3XhM5P-?_(`KP!HZ>DDw}&^N(8pp}gnNSqPPkGNB>E}XqshsbD3zem=^!Tm1m z<5Bj#?wd?Z*EK17FDFhyx2HZIV?0zlZJ}GQn_^t!6Zh8)JL!UZEkPk>%dMs8dlUdL*FExPM(h5R-(`YOcy zIazNiPNGa-l^K^RT(aM#Ua~yoeuwU`+Kh3ZWcX;7Gj{kKn}Vzb_6zRObJzQEfmRw# zxAuxQg!aXdw}hIhk47#N?(Ik-_J~#W)9I97J-PI6+y8<7Z?WA!&n+j&s7LwT`IqdL QxyoKBE2WMS`x|rf2f%r8)c^nh literal 0 HcmV?d00001 diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/expected-pom-with-schema.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/expected-pom-with-schema.xml new file mode 100644 index 000000000..495a718e3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/expected-pom-with-schema.xml @@ -0,0 +1,50 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + UTF-8 + UTF-8 + 1970-01-01T00:00:00Z + 7 + 1.${javaVersion} + 1.${javaVersion} + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/expected-pom.xml new file mode 100644 index 000000000..80b038699 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/expected-pom.xml @@ -0,0 +1,50 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + UTF-8 + UTF-8 + 1970-01-01T00:00:00Z + 7 + 1.${javaVersion} + 1.${javaVersion} + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/pom.xml new file mode 100644 index 000000000..a26743680 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/pom.xml @@ -0,0 +1,50 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + UTF-8 + UTF-8 + 1970-01-01T00:00:00Z + 7 + 1.${javaVersion} + 1.${javaVersion} + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/expected-pom.xml new file mode 100644 index 000000000..c81aa751e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/expected-pom.xml @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + + + + pom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/pom.xml new file mode 100644 index 000000000..bf2c8b86c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/pom.xml @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + + + + pom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject1/expected-pom.xml new file mode 100644 index 000000000..d6014ebc4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject1/expected-pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject1/pom.xml new file mode 100644 index 000000000..2243e6445 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject1/pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject2/expected-pom.xml new file mode 100644 index 000000000..005279c30 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject2/expected-pom.xml @@ -0,0 +1,46 @@ + + + + + + 4.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject2/pom.xml new file mode 100644 index 000000000..03f8345ad --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/cdata-around-values/subproject2/pom.xml @@ -0,0 +1,46 @@ + + + + + + 4.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/expected-pom.xml new file mode 100644 index 000000000..ad7963c10 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/expected-pom.xml @@ -0,0 +1,59 @@ + + + + 4.0.0 + groupId + artifactId + + + 1.1-SNAPSHOT + + + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + + + groupId + subproject1 + 2.1-SNAPSHOT + + + + + + + + + groupId + subproject1 + 2.1-SNAPSHOT + + + + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/pom.xml new file mode 100644 index 000000000..285c18c12 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/pom.xml @@ -0,0 +1,59 @@ + + + + 4.0.0 + groupId + artifactId + + + 1.0 + + + pom + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + + + groupId + subproject1 + 2.0 + + + + + + + + + groupId + subproject1 + 2.0 + + + + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/subproject1/expected-pom.xml new file mode 100644 index 000000000..ca3c5794e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/subproject1/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + 2.1-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/subproject1/pom.xml new file mode 100644 index 000000000..831369456 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/comments-around-values/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + 2.0 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/expected-pom.xml new file mode 100644 index 000000000..a7e8290a2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..7abe8ceda --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject1/expected-pom.xml new file mode 100644 index 000000000..2c155d22c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject1/pom.xml new file mode 100644 index 000000000..7356fc4d8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject2/expected-pom.xml new file mode 100644 index 000000000..fc8f4c62f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject2/expected-pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 0.5 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject2/pom.xml new file mode 100644 index 000000000..3b75eafda --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-dependencies/subproject2/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + groupId + subproject1 + 0.5 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/expected-pom.xml new file mode 100644 index 000000000..a7e8290a2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/pom.xml new file mode 100644 index 000000000..7abe8ceda --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject1/expected-pom.xml new file mode 100644 index 000000000..2c155d22c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject1/pom.xml new file mode 100644 index 000000000..7356fc4d8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject2/expected-pom.xml new file mode 100644 index 000000000..99cd0b61c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject2/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 0.5 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject2/pom.xml new file mode 100644 index 000000000..21a094fc9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-extension/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + groupId + subproject1 + 0.5 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/expected-pom.xml new file mode 100644 index 000000000..a7e8290a2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/pom.xml new file mode 100644 index 000000000..7abe8ceda --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject1/expected-pom.xml new file mode 100644 index 000000000..2c155d22c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject1/pom.xml new file mode 100644 index 000000000..7356fc4d8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject2/expected-pom.xml new file mode 100644 index 000000000..a74160cb3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject2/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 0.5 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject2/pom.xml new file mode 100644 index 000000000..472c8ac42 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-plugins/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + groupId + subproject1 + 0.5 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/expected-pom.xml new file mode 100644 index 000000000..a7e8290a2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/pom.xml new file mode 100644 index 000000000..7abe8ceda --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject1/expected-pom.xml new file mode 100644 index 000000000..2c155d22c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject1/pom.xml new file mode 100644 index 000000000..7356fc4d8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject2/expected-pom.xml new file mode 100644 index 000000000..0c5efdd2b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject2/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 0.5 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject2/pom.xml new file mode 100644 index 000000000..4995d8986 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-differing-snapshot-report-plugins/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + groupId + subproject1 + 0.5 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/expected-pom.xml new file mode 100644 index 000000000..3577f2841 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/expected-pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + + + groupId + subproject1 + 1.1-SNAPSHOT + + + groupId + subproject2 + 0.5 + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/pom.xml new file mode 100644 index 000000000..9e89d669d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + + + groupId + subproject1 + 1.0 + + + groupId + subproject2 + 0.5 + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject1/expected-pom.xml new file mode 100644 index 000000000..2c155d22c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject1/pom.xml new file mode 100644 index 000000000..7356fc4d8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject2/expected-pom.xml new file mode 100644 index 000000000..d79df9616 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject2/expected-pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject2/pom.xml new file mode 100644 index 000000000..5c75bb920 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject2/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + groupId + subproject1 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject3/expected-pom.xml new file mode 100644 index 000000000..3d7a1c6c1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject3/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject3 + + + + groupId + subproject1 + + + groupId + subproject2 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject3/pom.xml new file mode 100644 index 000000000..b7a89448d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-dependency/subproject3/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + groupId + subproject1 + + + groupId + subproject2 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/expected-pom.xml new file mode 100644 index 000000000..72461a2d2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/expected-pom.xml @@ -0,0 +1,46 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + + + + groupId + subproject1 + 1.1-SNAPSHOT + + + groupId + subproject2 + 0.5 + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/pom.xml new file mode 100644 index 000000000..829c30076 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/pom.xml @@ -0,0 +1,46 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + + + + groupId + subproject1 + 1.0 + + + groupId + subproject2 + 0.5 + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject1/expected-pom.xml new file mode 100644 index 000000000..2c155d22c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject1/pom.xml new file mode 100644 index 000000000..7356fc4d8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject2/expected-pom.xml new file mode 100644 index 000000000..7ed3d569c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject2/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject2/pom.xml new file mode 100644 index 000000000..daf34bd7f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject2/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject3/expected-pom.xml new file mode 100644 index 000000000..919297350 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject3/expected-pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject3 + + + + + groupId + subproject1 + + + groupId + subproject2 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject3/pom.xml new file mode 100644 index 000000000..8ec89dd80 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-managed-snapshot-plugin/subproject3/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + + groupId + subproject1 + + + groupId + subproject2 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/expected-pom.xml new file mode 100644 index 000000000..f6659423a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/expected-pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/pom.xml new file mode 100644 index 000000000..f1cb7c6ff --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject1/expected-pom.xml new file mode 100644 index 000000000..b2cc4e3ff --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject1/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject1/pom.xml new file mode 100644 index 000000000..ca188f0c5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject1/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject2/expected-pom.xml new file mode 100644 index 000000000..fc798ff6f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject2/expected-pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject2/pom.xml new file mode 100644 index 000000000..0e76953e8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject2/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + groupId + subproject1 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject3/expected-pom.xml new file mode 100644 index 000000000..c69fdbfe6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject3/expected-pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject3 + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject3/pom.xml new file mode 100644 index 000000000..24ba6ac4e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject3/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/expected-pom.xml new file mode 100644 index 000000000..22997796a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/expected-pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject4 + pom + + + + groupId + subproject2 + 1.0 + + + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/pom.xml new file mode 100644 index 000000000..453609e25 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject4 + pom + + + + groupId + subproject2 + 1.0 + + + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/subsubproject/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/subsubproject/expected-pom.xml new file mode 100644 index 000000000..69a0815da --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/subsubproject/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + subproject4 + 1.1-SNAPSHOT + + + subsubproject + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/subsubproject/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/subsubproject/pom.xml new file mode 100644 index 000000000..e55cd6c5f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies-without-dependencies-version-update/subproject4/subsubproject/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + subproject4 + 1.0 + + + subsubproject + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/expected-pom.xml new file mode 100644 index 000000000..f6659423a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/expected-pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..f1cb7c6ff --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject1/expected-pom.xml new file mode 100644 index 000000000..b2cc4e3ff --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject1/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject1/pom.xml new file mode 100644 index 000000000..ca188f0c5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject1/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject2/expected-pom.xml new file mode 100644 index 000000000..ffd1879cb --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject2/expected-pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.1-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject2/pom.xml new file mode 100644 index 000000000..0e76953e8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject2/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + groupId + subproject1 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject3/expected-pom.xml new file mode 100644 index 000000000..d2702ed4e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject3/expected-pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject3 + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.1-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject3/pom.xml new file mode 100644 index 000000000..24ba6ac4e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject3/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/expected-pom.xml new file mode 100644 index 000000000..2173b12a6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/expected-pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject4 + pom + + + + groupId + subproject2 + 1.1-SNAPSHOT + + + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/pom.xml new file mode 100644 index 000000000..453609e25 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject4 + pom + + + + groupId + subproject2 + 1.0 + + + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/subsubproject/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/subsubproject/expected-pom.xml new file mode 100644 index 000000000..69a0815da --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/subsubproject/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + subproject4 + 1.1-SNAPSHOT + + + subsubproject + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml new file mode 100644 index 000000000..e55cd6c5f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + subproject4 + 1.0 + + + subsubproject + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/expected-pom.xml new file mode 100644 index 000000000..f9aaf6607 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/expected-pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/pom.xml new file mode 100644 index 000000000..3ef8a6cf5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject1/expected-pom.xml new file mode 100644 index 000000000..b2cc4e3ff --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject1/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject1/pom.xml new file mode 100644 index 000000000..ca188f0c5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject1/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject2/expected-pom.xml new file mode 100644 index 000000000..b189cd215 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject2/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.1-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject2/pom.xml new file mode 100644 index 000000000..a5d0225f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject2/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + groupId + subproject1 + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject3/expected-pom.xml new file mode 100644 index 000000000..6300a3ee4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject3/expected-pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.1-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject3/pom.xml new file mode 100644 index 000000000..f9bd31913 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-extension/subproject3/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/expected-pom.xml new file mode 100644 index 000000000..f9aaf6607 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/expected-pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/pom.xml new file mode 100644 index 000000000..3ef8a6cf5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject1/expected-pom.xml new file mode 100644 index 000000000..a946e3d18 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject1/expected-pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + external + artifactId + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject1/pom.xml new file mode 100644 index 000000000..442f87942 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject1/pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + external + artifactId + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject2/expected-pom.xml new file mode 100644 index 000000000..9cecfcc16 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject2/expected-pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + + + + + external + plugin-artifactId + 1.0 + + + groupId + subproject1 + 1.1-SNAPSHOT + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject2/pom.xml new file mode 100644 index 000000000..90f8ea628 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject2/pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + external + plugin-artifactId + 1.0 + + + groupId + subproject1 + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject3/expected-pom.xml new file mode 100644 index 000000000..495f4eab2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject3/expected-pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject3 + + + + + external + plugin-artifactId + 1.0 + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.1-SNAPSHOT + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject3/pom.xml new file mode 100644 index 000000000..2bd4b8a8c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugin-deps/subproject3/pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + + external + plugin-artifactId + 1.0 + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/expected-pom.xml new file mode 100644 index 000000000..f6659423a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/expected-pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/pom.xml new file mode 100644 index 000000000..f1cb7c6ff --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject1/expected-pom.xml new file mode 100644 index 000000000..f3630c1c8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject1/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject1/pom.xml new file mode 100644 index 000000000..6026ff706 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject1/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject2/expected-pom.xml new file mode 100644 index 000000000..12ac52967 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject2/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.1-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject2/pom.xml new file mode 100644 index 000000000..1d13d61f2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject2/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + groupId + subproject1 + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject3/expected-pom.xml new file mode 100644 index 000000000..6f8d2c38d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject3/expected-pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.1-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject3/pom.xml new file mode 100644 index 000000000..ac5d38e64 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject3/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject4/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject4/expected-pom.xml new file mode 100644 index 000000000..e7f0b5743 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject4/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject4 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject4/pom.xml new file mode 100644 index 000000000..852de1139 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-plugins/subproject4/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject4 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/expected-pom.xml new file mode 100644 index 000000000..4a112674a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/expected-pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + + + + + it + + + + groupId + subproject1 + 1.1-SNAPSHOT + + + groupId + subproject2 + 0.5 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/pom.xml new file mode 100644 index 000000000..4dd8c6865 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + subproject3 + + + + + it + + + + groupId + subproject1 + 1.0 + + + groupId + subproject2 + 0.5 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject1/expected-pom.xml new file mode 100644 index 000000000..5e1c15076 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject1/expected-pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + + + + it + + + external + artifactId + 1.0 + + + + + + external + plugin-artifactId + 1.0 + + + external + artifactId + 1.0 + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject1/pom.xml new file mode 100644 index 000000000..6f3498d91 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject1/pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + it + + + external + artifactId + 1.0 + + + + + + external + plugin-artifactId + 1.0 + + + external + artifactId + 1.0 + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject2/expected-pom.xml new file mode 100644 index 000000000..b926b28d3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject2/expected-pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + + + + it + + + groupId + subproject1 + 1.1-SNAPSHOT + + + + + + groupId + subproject1 + 1.1-SNAPSHOT + + + groupId + subproject1 + 1.1-SNAPSHOT + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject2/pom.xml new file mode 100644 index 000000000..4a9d2749d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject2/pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + it + + + groupId + subproject1 + 1.0 + + + + + + groupId + subproject1 + 1.0 + + + groupId + subproject1 + 1.0 + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject3/expected-pom.xml new file mode 100644 index 000000000..6baec210a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject3/expected-pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject3 + + + + it + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.1-SNAPSHOT + + + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.1-SNAPSHOT + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.1-SNAPSHOT + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject3/pom.xml new file mode 100644 index 000000000..30e7c7020 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-profile/subproject3/pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + it + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/expected-pom.xml new file mode 100644 index 000000000..f6659423a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/expected-pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/pom.xml new file mode 100644 index 000000000..f1cb7c6ff --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject1/expected-pom.xml new file mode 100644 index 000000000..603908ba9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject1/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject1/pom.xml new file mode 100644 index 000000000..2d7c3c8f6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject1/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject2/expected-pom.xml new file mode 100644 index 000000000..19c33a3cc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject2/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.1-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject2/pom.xml new file mode 100644 index 000000000..59a8f176e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject2/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + groupId + subproject1 + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject3/expected-pom.xml new file mode 100644 index 000000000..da9f0a504 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject3/expected-pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.1-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject3/pom.xml new file mode 100644 index 000000000..4aa566f82 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject3/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject4/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject4/expected-pom.xml new file mode 100644 index 000000000..782eb97b1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject4/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject4 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject4/pom.xml new file mode 100644 index 000000000..f2dcab9b3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/internal-snapshot-report-plugins/subproject4/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject4 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/expected-pom.xml new file mode 100644 index 000000000..ced21647b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/pom.xml new file mode 100644 index 000000000..afc030ffe --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/subproject1/expected-pom-version-changed.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/subproject1/expected-pom-version-changed.xml new file mode 100644 index 000000000..8c771b907 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/subproject1/expected-pom-version-changed.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + 2.1-SNAPSHOT + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/subproject1/expected-pom.xml new file mode 100644 index 000000000..fe020475a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/subproject1/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/subproject1/pom.xml new file mode 100644 index 000000000..199578324 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-inherited-version/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/expected-pom.xml new file mode 100644 index 000000000..494bde521 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/expected-pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/pom.xml new file mode 100644 index 000000000..0a51bdfea --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/expected-pom.xml new file mode 100644 index 000000000..ce6629d01 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/pom.xml new file mode 100644 index 000000000..f847350fe --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/expected-pom.xml new file mode 100644 index 000000000..6f5d6b09d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/expected-pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.1-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/pom.xml new file mode 100644 index 000000000..cfe2a9663 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + groupId + subproject1 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/expected-pom.xml new file mode 100644 index 000000000..d4953cc93 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/expected-pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/pom.xml new file mode 100644 index 000000000..fe1d22844 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject1/expected-pom.xml new file mode 100644 index 000000000..5793ddf42 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject1/expected-pom.xml @@ -0,0 +1,44 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + 2.1-SNAPSHOT + + + + + external + artifactId + 1.0 + + + + + + 2.0 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject1/pom.xml new file mode 100644 index 000000000..488bf9af3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject1/pom.xml @@ -0,0 +1,44 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + 2.0 + + + + + external + artifactId + 1.0 + + + + + + 2.0 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject2/expected-pom.xml new file mode 100644 index 000000000..079be03e4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject2/expected-pom.xml @@ -0,0 +1,46 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + 2.1-SNAPSHOT + + + + + groupId + subproject1 + ${module.version} + pom + import + + + + + + 2.1-SNAPSHOT + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject2/pom.xml new file mode 100644 index 000000000..59a52f900 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management-import/subproject2/pom.xml @@ -0,0 +1,46 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + 2.0 + + + + + groupId + subproject1 + ${module.version} + pom + import + + + + + + 2.0 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/expected-pom.xml new file mode 100644 index 000000000..d4953cc93 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/expected-pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/pom.xml new file mode 100644 index 000000000..fe1d22844 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject1/expected-pom.xml new file mode 100644 index 000000000..734c0a756 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject1/expected-pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + 2.1-SNAPSHOT + + + 2.0 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject1/pom.xml new file mode 100644 index 000000000..02accc3a9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject1/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + 2.0 + + + 2.0 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject2/expected-pom.xml new file mode 100644 index 000000000..c378a90c8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject2/expected-pom.xml @@ -0,0 +1,44 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + 2.1-SNAPSHOT + + + + + groupId + subproject1 + ${module.version} + + + + + + 2.1-SNAPSHOT + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject2/pom.xml new file mode 100644 index 000000000..26082ba11 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-in-dependency-management/subproject2/pom.xml @@ -0,0 +1,44 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + 2.0 + + + + + groupId + subproject1 + ${module.version} + + + + + + 2.0 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/expected-pom.xml new file mode 100644 index 000000000..d4953cc93 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/expected-pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/pom.xml new file mode 100644 index 000000000..d8b11dc1e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject1/expected-pom.xml new file mode 100644 index 000000000..734c0a756 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject1/expected-pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + 2.1-SNAPSHOT + + + 2.0 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject1/pom.xml new file mode 100644 index 000000000..1bdd4c595 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject1/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + + + 2.0 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject2/expected-pom.xml new file mode 100644 index 000000000..e4a4871f6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject2/expected-pom.xml @@ -0,0 +1,42 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + 2.1-SNAPSHOT + + + + groupId + subproject1 + ${module.version} + + + + + 2.1-SNAPSHOT + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject2/pom.xml new file mode 100644 index 000000000..9f938676d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties-sim/subproject2/pom.xml @@ -0,0 +1,42 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + 2.0-SNAPSHOT + + + + groupId + subproject1 + ${module.version} + + + + + 2.0-SNAPSHOT + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/expected-pom.xml new file mode 100644 index 000000000..d4953cc93 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/expected-pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/pom.xml new file mode 100644 index 000000000..fe1d22844 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject1/expected-pom.xml new file mode 100644 index 000000000..734c0a756 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject1/expected-pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + 2.1-SNAPSHOT + + + 2.0 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject1/pom.xml new file mode 100644 index 000000000..02accc3a9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject1/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + 2.0 + + + 2.0 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject2/expected-pom.xml new file mode 100644 index 000000000..e4a4871f6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject2/expected-pom.xml @@ -0,0 +1,42 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + 2.1-SNAPSHOT + + + + groupId + subproject1 + ${module.version} + + + + + 2.1-SNAPSHOT + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject2/pom.xml new file mode 100644 index 000000000..cfc08c1d6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent-and-properties/subproject2/pom.xml @@ -0,0 +1,42 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + 2.0 + + + + groupId + subproject1 + ${module.version} + + + + + 2.0 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/expected-pom.xml new file mode 100644 index 000000000..6462dc40e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/expected-pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/pom.xml new file mode 100644 index 000000000..181874cff --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/subproject1/expected-pom.xml new file mode 100644 index 000000000..33f6c9020 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/subproject1/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1 + 2.1-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/subproject1/pom.xml new file mode 100644 index 000000000..c836d0db4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-parent/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + 2.0 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/expected-pom.xml new file mode 100644 index 000000000..e2bed51b6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/expected-pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.1-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1-3.4 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/pom.xml new file mode 100644 index 000000000..97c2a7f1f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + subproject1-3.4 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject1-3.4/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject1-3.4/expected-pom.xml new file mode 100644 index 000000000..0ab3ecd6a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject1-3.4/expected-pom.xml @@ -0,0 +1,33 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject1-3.4 + 2.1-SNAPSHOT + + + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject1-3.4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject1-3.4/pom.xml new file mode 100644 index 000000000..ce7018a3a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject1-3.4/pom.xml @@ -0,0 +1,33 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1-3.4 + 2.0 + + + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject2/expected-pom.xml new file mode 100644 index 000000000..b2f90ff8f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject2/expected-pom.xml @@ -0,0 +1,42 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + subproject2 + 2.1-SNAPSHOT + + + + groupId + subproject1-${subproject.version} + ${project.version} + + + + + 3.4 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject2/pom.xml new file mode 100644 index 000000000..54156eecf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-property-dependency-coordinate/subproject2/pom.xml @@ -0,0 +1,42 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + 2.0 + + + + groupId + subproject1-${subproject.version} + ${project.version} + + + + + 3.4 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/expected-pom.xml new file mode 100644 index 000000000..75f5a0d82 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + groupId + artifactId + 1 + pom + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/pom.xml new file mode 100644 index 000000000..75f5a0d82 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + groupId + artifactId + 1 + pom + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/subproject1/expected-pom.xml new file mode 100644 index 000000000..82c25c37b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/subproject1/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1 + + + subproject1 + 2.1-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/subproject1/pom.xml new file mode 100644 index 000000000..31153d642 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-with-released-parent/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1 + + + subproject1 + 2.0 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-without-extension-version/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-without-extension-version/expected-pom.xml new file mode 100644 index 000000000..5179068dd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-without-extension-version/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.1-SNAPSHOT + + + + + groupId + something + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-without-extension-version/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-without-extension-version/pom.xml new file mode 100644 index 000000000..8d0ea1e3f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/pom-without-extension-version/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + + + groupId + something + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/expected-pom.xml new file mode 100644 index 000000000..32978baa1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/expected-pom.xml @@ -0,0 +1,80 @@ + + + + 4.0.0 + + groupId + + + artifactId + + + 1.1-SNAPSHOT + + pom + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + + + scm:svn:file://localhost/tmp/scm-repo/trunk + + + file://localhost/tmp/scm-repo/trunk + + + + + + + + groupId + + + subproject1 + + + 2.1-SNAPSHOT + + + + + + + + + + + groupId + + + subproject1 + + + 2.1-SNAPSHOT + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/pom.xml new file mode 100644 index 000000000..f29d98547 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/pom.xml @@ -0,0 +1,80 @@ + + + + 4.0.0 + + groupId + + + artifactId + + + 1.0 + + pom + + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + + + file://localhost/tmp/scm-repo/tags/release-label + + + + + + + + groupId + + + subproject1 + + + 2.0 + + + + + + + + + + + groupId + + + subproject1 + + + 2.0 + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject1/expected-pom.xml new file mode 100644 index 000000000..9e52f826a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject1/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + + groupId + + + artifactId + + + 1.1-SNAPSHOT + + + + + subproject1 + + + 2.1-SNAPSHOT + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject1/pom.xml new file mode 100644 index 000000000..3e10f0d8e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject1/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + + groupId + + + artifactId + + + 1.0 + + + + + subproject1 + + + 2.0 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject2/expected-pom.xml new file mode 100644 index 000000000..9cce524e9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject2/expected-pom.xml @@ -0,0 +1,64 @@ + + + + 4.0.0 + + + groupId + + + artifactId + + + 1.1-SNAPSHOT + + + + + subproject2 + + + + + + groupId + + + subproject1 + + + 2.1-SNAPSHOT + + + + + + + + + groupId + + + subproject1 + + + 2.1-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject2/pom.xml new file mode 100644 index 000000000..427d104d0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/whitespace-around-values/subproject2/pom.xml @@ -0,0 +1,64 @@ + + + + 4.0.0 + + + groupId + + + artifactId + + + 1.0 + + + + + subproject2 + + + + + + groupId + + + subproject1 + + + 2.0 + + + + + + + + + groupId + + + subproject1 + + + 2.0 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-entities/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-entities/expected-pom.xml new file mode 100644 index 000000000..81d5beb5a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-entities/expected-pom.xml @@ -0,0 +1,31 @@ + + + + + +]> + + + 4.0.0 + groupId + artifactId + 1.0 + < & Non-ASCIIs: ß Ä° É™ σ ß Я × Ø° + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-entities/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-entities/pom.xml new file mode 100644 index 000000000..efce05fa0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-entities/pom.xml @@ -0,0 +1,31 @@ + + + + + +]> + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + < & Non-ASCIIs: ß İ ə σ ß Я א ذ + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/expected-pom.xml new file mode 100644 index 000000000..58d8f2d82 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/expected-pom.xml @@ -0,0 +1,46 @@ + + + + + + 4.0.0 + + external + parent-artifactId + 1 + + + groupId + artifactId + 1.0 + pom + + + 2.0.4 + + + + subproject1 + + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/pom.xml new file mode 100644 index 000000000..1ff58c11b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/pom.xml @@ -0,0 +1,40 @@ + + + + + + 4.0.0 + + external + parent-artifactId + 1 + + + groupId + artifactId + 1.0-SNAPSHOT + pom + + + 2.0.4 + + + + subproject1 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/expected-pom.xml new file mode 100644 index 000000000..1cd78de6a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/expected-pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + pom + + + subsubproject + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/pom.xml new file mode 100644 index 000000000..e6b7926b0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + pom + + + subsubproject + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/subsubproject/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/subsubproject/expected-pom.xml new file mode 100644 index 000000000..f0b2f7058 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/subsubproject/expected-pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + groupId + subproject1 + 1.0 + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/subsubproject/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/subsubproject/pom.xml new file mode 100644 index 000000000..4a92ffdbc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-inherited-scm/subproject1/subsubproject/pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + groupId + subproject1 + 1.0-SNAPSHOT + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-namespace/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-namespace/expected-pom.xml new file mode 100644 index 000000000..9da9aa3a6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-namespace/expected-pom.xml @@ -0,0 +1,160 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + jar + + + test + test + http://www.foo.bar/ + + + The Apache Software Foundation + http://www.apache.org/ + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + apache.snapshots + Apache Snapshot Repository + https://people.apache.org/repo/m2-snapshot-repository + + false + + + + + + + + apache.releases + Apache Release Distribution Repository + scp://people.apache.org/www/people.apache.org/repo/m2-ibiblio-rsync-repository + + + apache.snapshots + Apache Development Snapshot Repository + scp://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository + + + + + + Apache Announce List + announce-subscribe@apache.org + announce-unsubscribe@apache.org + announce@apache.org + http://mail-archives.apache.org/mod_mbox/www-announce/ + + + + + http://www.apache.org/images/asf_logo_wide.gif + + + + + + + + run-its + + + + org.apache.maven.plugins + maven-invoker-plugin + 1.2 + + src/it + + **/pom.xml + + + MWAR-143/war-common/pom.xml + MWAR-143/war-filter-overlay/pom.xml + MWAR-131/mwar131-test/pom.xml + MWAR-131/mwar131-webapp/pom.xml + MWAR-131/mwar131-webapp2/pom.xml + **/META-INF/**/pom.xml + + verify.bsh + ${project.build.directory}/local-repo + + clean + package + + src/it/settings.xml + ${project.build.directory}/its + + + + integration-test + + install + run + + + + + + + org.apache.maven.plugins + maven-install-plugin + + + it-preparation + pre-integration-test + + install-file + + + ${project.build.directory}/${project.build.finalName}.jar + ${project.groupId} + ${project.artifactId} + ${project.version} + ${project.packaging} + ${basedir}/pom.xml + true + ${project.build.directory}/local-repo + + local + + + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-namespace/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-namespace/pom.xml new file mode 100644 index 000000000..b85fbbed9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-namespace/pom.xml @@ -0,0 +1,162 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + jar + + + test + test + http://www.foo.bar/ + + + The Apache Software Foundation + http://www.apache.org/ + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + apache.snapshots + Apache Snapshot Repository + https://people.apache.org/repo/m2-snapshot-repository + + false + + + + + + + + apache.releases + Apache Release Distribution Repository + scp://people.apache.org/www/people.apache.org/repo/m2-ibiblio-rsync-repository + + + apache.snapshots + Apache Development Snapshot Repository + scp://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository + + + + + + Apache Announce List + announce-subscribe@apache.org + announce-unsubscribe@apache.org + announce@apache.org + http://mail-archives.apache.org/mod_mbox/www-announce/ + + + + + http://www.apache.org/images/asf_logo_wide.gif + + + + + + + + run-its + + + + org.apache.maven.plugins + maven-invoker-plugin + 1.2 + + src/it + + **/pom.xml + + + MWAR-143/war-common/pom.xml + MWAR-143/war-filter-overlay/pom.xml + MWAR-131/mwar131-test/pom.xml + MWAR-131/mwar131-webapp/pom.xml + MWAR-131/mwar131-webapp2/pom.xml + **/META-INF/**/pom.xml + + verify.bsh + ${project.build.directory}/local-repo + + clean + package + + src/it/settings.xml + ${project.build.directory}/its + + + + integration-test + + install + run + + + + + + + org.apache.maven.plugins + maven-install-plugin + + + it-preparation + pre-integration-test + + install-file + + + ${project.build.directory}/${project.build.finalName}.jar + ${project.groupId} + ${project.artifactId} + ${project.version} + ${project.packaging} + ${basedir}/pom.xml + true + ${project.build.directory}/local-repo + + local + + + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs-from-tag/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs-from-tag/expected-pom.xml new file mode 100644 index 000000000..63c09afb1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs-from-tag/expected-pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + + 2.0.4 + + + + ${scm.base}:pserver:anoncvs@localhost:/tmp/scm-repo:module + ${scm.base}:ext:${username}@localhost:/tmp/scm-repo:module + ${baseUrl}/module + release-label + + + scm:cvs + http://localhost/viewcvs.cgi + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs-from-tag/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs-from-tag/pom.xml new file mode 100644 index 000000000..923f88e8f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs-from-tag/pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + ${scm.base}:pserver:anoncvs@localhost:/tmp/scm-repo:module + ${scm.base}:ext:${username}@localhost:/tmp/scm-repo:module + ${baseUrl}/module + original-tag + + + scm:cvs + http://localhost/viewcvs.cgi + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs/expected-pom.xml new file mode 100644 index 000000000..2780f9c86 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs/expected-pom.xml @@ -0,0 +1,35 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + + 2.0.4 + + + + scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module + scm:cvs:ext:${username}@localhost:/tmp/scm-repo:module + http://localhost/viewcvs.cgi/module + release-label + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs/pom.xml new file mode 100644 index 000000000..b4af394d3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-cvs/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module + scm:cvs:ext:${username}@localhost:/tmp/scm-repo:module + http://localhost/viewcvs.cgi/module + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-dashes-in-comment/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-dashes-in-comment/expected-pom.xml new file mode 100644 index 000000000..f2b2147b2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-dashes-in-comment/expected-pom.xml @@ -0,0 +1,37 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + + 2.0.4 + + + + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-dashes-in-comment/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-dashes-in-comment/pom.xml new file mode 100644 index 000000000..0b3f59721 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-dashes-in-comment/pom.xml @@ -0,0 +1,37 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-empty-scm/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-empty-scm/expected-pom.xml new file mode 100644 index 000000000..c513303b8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-empty-scm/expected-pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-empty-scm/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-empty-scm/pom.xml new file mode 100644 index 000000000..5f5693643 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-empty-scm/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-encoding/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-encoding/expected-pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..44b2f6d7cefdc2f8255466348aca270b6a339cd4 GIT binary patch literal 2408 zcmd6pNpBND5QXc^uV``tDRBaV9D;EaAQ2H!EMbR;qt{?GUhqs}xbV|~?^U}!9?O=v zAfb_GsjXkXTH3#UTis6WyNxZgU=KF1x#c#psZH#)?b$P{*%8lxW@0_$eY6w1bM1|_ z?ZOVQI>zSI8uo~*ZjX^2@D{j!@_UQl%zhAigy$D4kUb~vk-fw&z8xcLqZ{x%!@9$2 z@vDXR5T6CIx$7^G+=HTzq*$V@t=22oy+YS>{~k)xM(8Svb;TGeMCyHEI*tO&U{ z3HD?aVb7{wd-l{`t?&ePF1!JjJG=*wPw^ER;fhE`ya)CWTs`T#E@M^f&nil$^H*yjx-Q|sc}A%fy}mTM?i0m~ux#8Ne;Y>U+nOU9M)cqz*T zSWoPbYvET7uQIbWR+v){hrXXOPdSn+yQFH)?b=%0RU_g&t&^U?Zons}R+J2z!TmUz@1IkxiX zf}{Y^uDaV~G*-Z_25LaTM$pecRq!6PDUo-D35T>kL-g z=*~Sx6Nx&siS(U&T>87>H|cJ5<27{?>;qcah=GAKqW%$gs@0jZ7xNGq9Z~O*b#bs> zg)KZ%-Rrr@#BiCDRC_sb22}gV`=f`4a;GVD?|D;s>N5HE z*Oy9Duz#Q5yEbt6LRbr}lT- z#X75drD~$g$Vi_RRJrB1VpJtU7BOgoYKKF1+T$(yZ<8v@HhCGVdRjD=XNCMWH98gI z`msvNK2=uKBl(J_#8tR??X^;Zl92+&91@ z%M+dt=uTF1IZm?-A5D^s6J&}_!JZ53XFQ|lfn%AWl}58gQ%(3ZtvY-Ss2Ejo*Jaw- zb|evdWJT2@ZneHTV(usF|AGE*v90gto*iW5Bb|ExlHIgcs)dxP*tL=0_5Uq83&-?W d=2f9wX{rpCm8@Kix%96nor7rxD3=>E;19^LkAeUI literal 0 HcmV?d00001 diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-encoding/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-encoding/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..c2d9c6eda8c9f57b2abcf41b4f674afd1c4dff9d GIT binary patch literal 2348 zcmchZOK%fF5QO{8uNZs+DRu&a9D;EaAQ2H!jIcw*(a&J;3-2a@3qKwBs>kE?TDF9Q zgjU&E_jLEvR9DaB*Ke!av3<9RjV;)n4QyeVjcjI9dubJWVl_Kp49rZehrQ42)NXwC z%G!2jRlE-IIktv9;Hld~Y*oGj&rkkd6F0XXY@8$$MbW@rz%F*xJku7*Fu- zuv+}pB6>*7J+_6}SFC%%T+fkby!&L1QQBo7a@%UaG0hT*_2awN*6&m4+NJe}I_Bo;wvJI$;u+QC7oCoKB zf@O?X2aDzdyo?-4v7<7Yf|+2SHjvD$OKgV>%HLV8p;`qzhrAO@<(%@(S34{iSHa7>>G^A~NTuP-KBe-I3v| zh%QKS5be_4CZkaSyE3RFg;MVd9nxYv=dIp+<-hf7Z^cotYv$Yb)|#-?#_Jld4?HKZ z+Gg(5b2PE2Lz`INc*MDXD}R&jRySUvn_%ylm5&%0I3wyGaVM?LoxNCx$mj^YN7lu` zx(ZuFB;9M=WMa6iNzz_Mo&jnfd4KeXQ0;UI-Fn@WsV#f$uL-IPrOff^q)<-%TgapR~vo&2ao}S_W%F@ literal 0 HcmV?d00001 diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-scm-expression/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-scm-expression/expected-pom.xml new file mode 100644 index 000000000..97b3f9767 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-scm-expression/expected-pom.xml @@ -0,0 +1,33 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + + 2.0.4 + + + + scm:svn:http://localhost/repo/tags/release-label + scm:svn:https://${user.name}@localhost/repo/tags/release-label + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-scm-expression/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-scm-expression/pom.xml new file mode 100644 index 000000000..e4ed45828 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-scm-expression/pom.xml @@ -0,0 +1,33 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:http://localhost/repo/trunk + scm:svn:https://${user.name}@localhost/repo/trunk + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base-and-varying-scm-urls/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base-and-varying-scm-urls/expected-pom.xml new file mode 100644 index 000000000..00c949c36 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base-and-varying-scm-urls/expected-pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/anon-scm-repo/allprojects/releases/release-label + scm:svn:file://localhost/tmp/scm-repo/allprojects/releases/release-label + file://localhost/tmp/viewvc/allprojects/releases/release-label + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base-and-varying-scm-urls/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base-and-varying-scm-urls/pom.xml new file mode 100644 index 000000000..a4eff49ac --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base-and-varying-scm-urls/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/anon-scm-repo/myproject/trunk + scm:svn:file://localhost/tmp/scm-repo/myproject/trunk + file://localhost/tmp/viewvc/myproject/trunk + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base/expected-pom.xml new file mode 100644 index 000000000..2378f925e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base/expected-pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/releases/release-label + scm:svn:file://localhost/tmp/scm-repo/releases/release-label + file://localhost/tmp/scm-repo/releases/release-label + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base/pom.xml new file mode 100644 index 000000000..8356b8df1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-tag-base/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom-with-schema.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom-with-schema.xml new file mode 100644 index 000000000..774b129d6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom-with-schema.xml @@ -0,0 +1,50 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + UTF-8 + UTF-8 + 1970-01-01T00:00:00Z + 7 + 1.${javaVersion} + 1.${javaVersion} + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom.xml new file mode 100644 index 000000000..a26743680 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom/expected-pom.xml @@ -0,0 +1,50 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + UTF-8 + UTF-8 + 1970-01-01T00:00:00Z + 7 + 1.${javaVersion} + 1.${javaVersion} + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom/pom.xml new file mode 100644 index 000000000..90bbf9eec --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom/pom.xml @@ -0,0 +1,50 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + UTF-8 + UTF-8 + initial + 7 + 1.${javaVersion} + 1.${javaVersion} + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/expected-pom.xml new file mode 100644 index 000000000..bf2c8b86c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/expected-pom.xml @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + + + + pom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/pom.xml new file mode 100644 index 000000000..7a3b0a1bf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/pom.xml @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + + + -SNAPSHOT + pom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject1/expected-pom.xml new file mode 100644 index 000000000..2243e6445 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject1/expected-pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject1/pom.xml new file mode 100644 index 000000000..bbcf3ef25 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject1/pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject2/expected-pom.xml new file mode 100644 index 000000000..03f8345ad --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject2/expected-pom.xml @@ -0,0 +1,46 @@ + + + + + + 4.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject2/pom.xml new file mode 100644 index 000000000..9db2067be --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-around-values/subproject2/pom.xml @@ -0,0 +1,46 @@ + + + + + + 4.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/expected-pom.xml new file mode 100644 index 000000000..33be3cb46 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/expected-pom.xml @@ -0,0 +1,68 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + + true + + com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder + + + com.atlassw.tools.eclipse.checkstyle.CheckstyleNature + + + + .checkstyle + + + + + + + +]]> + + + + ]]> + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/pom.xml new file mode 100644 index 000000000..bde3f472f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/cdata-section/pom.xml @@ -0,0 +1,68 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + + + 2.0.4 + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + + true + + com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder + + + com.atlassw.tools.eclipse.checkstyle.CheckstyleNature + + + + .checkstyle + + + + + + + +]]> + + + + ]]> + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/expected-pom.xml new file mode 100644 index 000000000..285c18c12 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/expected-pom.xml @@ -0,0 +1,59 @@ + + + + 4.0.0 + groupId + artifactId + + + 1.0 + + + pom + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + + + groupId + subproject1 + 2.0 + + + + + + + + + groupId + subproject1 + 2.0 + + + + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/pom.xml new file mode 100644 index 000000000..e6388f8cf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/pom.xml @@ -0,0 +1,59 @@ + + + + 4.0.0 + groupId + artifactId + + + 1.0-SNAPSHOT + + + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + + + groupId + subproject1 + 2.0-SNAPSHOT + + + + + + + + + groupId + subproject1 + 2.0-SNAPSHOT + + + + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/subproject1/expected-pom.xml new file mode 100644 index 000000000..831369456 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/subproject1/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + 2.0 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/subproject1/pom.xml new file mode 100644 index 000000000..1aca194a7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/comments-around-values/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/expected-pom.xml new file mode 100644 index 000000000..dd0653c23 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/expected-pom.xml @@ -0,0 +1,30 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/pom.xml new file mode 100644 index 000000000..669d1547d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/pom.xml @@ -0,0 +1,30 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject1/expected-pom.xml new file mode 100644 index 000000000..64f3990d0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject1/expected-pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + + external + artifactId + 1.0 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject1/pom.xml new file mode 100644 index 000000000..ea5479441 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject1/pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + + external + artifactId + 1.0 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject2/expected-pom.xml new file mode 100644 index 000000000..2e9561848 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject2/expected-pom.xml @@ -0,0 +1,48 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + groupId + subproject1 + 1.0 + pom + import + + + + + + + external + artifactId + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject2/pom.xml new file mode 100644 index 000000000..c6698dc35 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/imported-dependency-management-in-reactor/subproject2/pom.xml @@ -0,0 +1,48 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + pom + import + + + + + + + external + artifactId + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/expected-pom.xml new file mode 100644 index 000000000..7abe8ceda --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject1/expected-pom.xml new file mode 100644 index 000000000..7356fc4d8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject2/expected-pom.xml new file mode 100644 index 000000000..79b753e02 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject2/expected-pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject2/pom.xml new file mode 100644 index 000000000..f0c200c64 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-dependencies/subproject2/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/expected-pom.xml new file mode 100644 index 000000000..7abe8ceda --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject1/expected-pom.xml new file mode 100644 index 000000000..7356fc4d8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject2/expected-pom.xml new file mode 100644 index 000000000..9c9ae30c6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject2/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject2/pom.xml new file mode 100644 index 000000000..201e9819f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-extension/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/expected-pom.xml new file mode 100644 index 000000000..7abe8ceda --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject1/expected-pom.xml new file mode 100644 index 000000000..7356fc4d8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject2/expected-pom.xml new file mode 100644 index 000000000..c2b7c2650 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject2/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject2/pom.xml new file mode 100644 index 000000000..6210b1ee1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-plugins/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/expected-pom.xml new file mode 100644 index 000000000..7abe8ceda --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject1/expected-pom.xml new file mode 100644 index 000000000..7356fc4d8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject2/expected-pom.xml new file mode 100644 index 000000000..badf912de --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject2/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject2/pom.xml new file mode 100644 index 000000000..27fc275d0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-differing-snapshot-report-plugins/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 0.5-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/expected-pom.xml new file mode 100644 index 000000000..9e89d669d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/expected-pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + + + groupId + subproject1 + 1.0 + + + groupId + subproject2 + 0.5 + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/pom.xml new file mode 100644 index 000000000..dc9e67208 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + groupId + subproject2 + 0.5 + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject1/expected-pom.xml new file mode 100644 index 000000000..7356fc4d8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject2/expected-pom.xml new file mode 100644 index 000000000..5c75bb920 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject2/expected-pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + groupId + subproject1 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject2/pom.xml new file mode 100644 index 000000000..b6cc6c111 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject2/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject3/expected-pom.xml new file mode 100644 index 000000000..b7a89448d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject3/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + groupId + subproject1 + + + groupId + subproject2 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject3/pom.xml new file mode 100644 index 000000000..fb6d85a5e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-dependency/subproject3/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + groupId + subproject1 + + + groupId + subproject2 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/expected-pom.xml new file mode 100644 index 000000000..829c30076 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/expected-pom.xml @@ -0,0 +1,46 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + + + + groupId + subproject1 + 1.0 + + + groupId + subproject2 + 0.5 + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/pom.xml new file mode 100644 index 000000000..ec1741bf4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/pom.xml @@ -0,0 +1,46 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + groupId + subproject2 + 0.5 + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject1/expected-pom.xml new file mode 100644 index 000000000..7356fc4d8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject2/expected-pom.xml new file mode 100644 index 000000000..daf34bd7f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject2/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject2/pom.xml new file mode 100644 index 000000000..7027c9ca0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject2/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject3/expected-pom.xml new file mode 100644 index 000000000..8ec89dd80 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject3/expected-pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + + groupId + subproject1 + + + groupId + subproject2 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject3/pom.xml new file mode 100644 index 000000000..031fd957b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-managed-snapshot-plugin/subproject3/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + groupId + subproject1 + + + groupId + subproject2 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/expected-pom.xml new file mode 100644 index 000000000..f1cb7c6ff --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/expected-pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/pom.xml new file mode 100644 index 000000000..876538172 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject1/expected-pom.xml new file mode 100644 index 000000000..ca188f0c5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject1/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject1/pom.xml new file mode 100644 index 000000000..8e2e0791d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject1/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject2/expected-pom.xml new file mode 100644 index 000000000..0e76953e8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject2/expected-pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + groupId + subproject1 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject2/pom.xml new file mode 100644 index 000000000..0dd5cdafd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject2/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject3/expected-pom.xml new file mode 100644 index 000000000..24ba6ac4e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject3/expected-pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject3/pom.xml new file mode 100644 index 000000000..0264cb6a2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject3/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/expected-pom.xml new file mode 100644 index 000000000..453609e25 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/expected-pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject4 + pom + + + + groupId + subproject2 + 1.0 + + + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/pom.xml new file mode 100644 index 000000000..46bdc11b2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject4 + pom + + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/subsubproject/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/subsubproject/expected-pom.xml new file mode 100644 index 000000000..e55cd6c5f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/subsubproject/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + subproject4 + 1.0 + + + subsubproject + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml new file mode 100644 index 000000000..311ae9ab6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-dependencies/subproject4/subsubproject/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + subproject4 + 1.0-SNAPSHOT + + + subsubproject + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/expected-pom.xml new file mode 100644 index 000000000..3ef8a6cf5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/expected-pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/pom.xml new file mode 100644 index 000000000..d8faf456c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject1/expected-pom.xml new file mode 100644 index 000000000..ca188f0c5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject1/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject1/pom.xml new file mode 100644 index 000000000..8e2e0791d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject1/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject2/expected-pom.xml new file mode 100644 index 000000000..a5d0225f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject2/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + groupId + subproject1 + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject2/pom.xml new file mode 100644 index 000000000..3497d85f0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject2/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject3/expected-pom.xml new file mode 100644 index 000000000..f9bd31913 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject3/expected-pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject3/pom.xml new file mode 100644 index 000000000..a2f6c6808 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-extension/subproject3/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/expected-pom.xml new file mode 100644 index 000000000..3ef8a6cf5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/expected-pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/pom.xml new file mode 100644 index 000000000..d8faf456c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject1/expected-pom.xml new file mode 100644 index 000000000..442f87942 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject1/expected-pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + external + artifactId + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject1/pom.xml new file mode 100644 index 000000000..c5e8d740a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject1/pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + external + artifactId + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject2/expected-pom.xml new file mode 100644 index 000000000..90f8ea628 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject2/expected-pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + external + plugin-artifactId + 1.0 + + + groupId + subproject1 + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject2/pom.xml new file mode 100644 index 000000000..e01e97ce4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject2/pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + external + plugin-artifactId + 1.0 + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject3/expected-pom.xml new file mode 100644 index 000000000..2bd4b8a8c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject3/expected-pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + + external + plugin-artifactId + 1.0 + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject3/pom.xml new file mode 100644 index 000000000..0f5656e46 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugin-deps/subproject3/pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + external + plugin-artifactId + 1.0 + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/expected-pom.xml new file mode 100644 index 000000000..f1cb7c6ff --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/expected-pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/pom.xml new file mode 100644 index 000000000..876538172 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject1/expected-pom.xml new file mode 100644 index 000000000..6026ff706 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject1/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject1/pom.xml new file mode 100644 index 000000000..58e6ac7ef --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject1/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject2/expected-pom.xml new file mode 100644 index 000000000..1d13d61f2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject2/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + groupId + subproject1 + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject2/pom.xml new file mode 100644 index 000000000..de0e63faf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject2/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject3/expected-pom.xml new file mode 100644 index 000000000..ac5d38e64 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject3/expected-pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject3/pom.xml new file mode 100644 index 000000000..ba380ab4e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject3/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject4/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject4/expected-pom.xml new file mode 100644 index 000000000..852de1139 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject4/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject4 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject4/pom.xml new file mode 100644 index 000000000..c9aac9dd6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-plugins/subproject4/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject4 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/expected-pom.xml new file mode 100644 index 000000000..4dd8c6865 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/expected-pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + subproject3 + + + + + it + + + + groupId + subproject1 + 1.0 + + + groupId + subproject2 + 0.5 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/pom.xml new file mode 100644 index 000000000..130599c6f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + + + + + it + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + groupId + subproject2 + 0.5 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject1/expected-pom.xml new file mode 100644 index 000000000..6f3498d91 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject1/expected-pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + it + + + external + artifactId + 1.0 + + + + + + external + plugin-artifactId + 1.0 + + + external + artifactId + 1.0 + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject1/pom.xml new file mode 100644 index 000000000..bf86ed0dd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject1/pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + it + + + external + artifactId + 1.0 + + + + + + external + plugin-artifactId + 1.0 + + + external + artifactId + 1.0 + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject2/expected-pom.xml new file mode 100644 index 000000000..4a9d2749d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject2/expected-pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + it + + + groupId + subproject1 + 1.0 + + + + + + groupId + subproject1 + 1.0 + + + groupId + subproject1 + 1.0 + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject2/pom.xml new file mode 100644 index 000000000..4fa661c9b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject2/pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + it + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject3/expected-pom.xml new file mode 100644 index 000000000..30e7c7020 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject3/expected-pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + it + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject3/pom.xml new file mode 100644 index 000000000..5dd18d1ca --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-profile/subproject3/pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + it + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/expected-pom.xml new file mode 100644 index 000000000..f1cb7c6ff --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/expected-pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/pom.xml new file mode 100644 index 000000000..876538172 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + subproject3 + subproject4 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject1/expected-pom.xml new file mode 100644 index 000000000..2d7c3c8f6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject1/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject1/pom.xml new file mode 100644 index 000000000..f40f5e86b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject1/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + + external + plugin-artifactId + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject2/expected-pom.xml new file mode 100644 index 000000000..59a8f176e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject2/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + + groupId + subproject1 + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject2/pom.xml new file mode 100644 index 000000000..9f3b24e3e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject2/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject3/expected-pom.xml new file mode 100644 index 000000000..4aa566f82 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject3/expected-pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject3/pom.xml new file mode 100644 index 000000000..d9e3ceda6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject3/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + + + groupId + subproject1 + 0.5 + + + groupId + subproject2 + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject4/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject4/expected-pom.xml new file mode 100644 index 000000000..f2dcab9b3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject4/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject4 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject4/pom.xml new file mode 100644 index 000000000..00dbfe1b0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/internal-snapshot-report-plugins/subproject4/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject4 + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/expected-pom-different-version.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/expected-pom-different-version.xml new file mode 100644 index 000000000..6af0080b2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/expected-pom-different-version.xml @@ -0,0 +1,51 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + + + groupId + subproject1 + 2.0 + + + + + + + + + groupId + subproject1 + 2.0 + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/expected-pom.xml new file mode 100644 index 000000000..49a0cba49 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/expected-pom.xml @@ -0,0 +1,51 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + + + groupId + subproject1 + ${project.version} + + + + + + + + + groupId + subproject1 + ${project.version} + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/pom.xml new file mode 100644 index 000000000..0f3233e10 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/pom.xml @@ -0,0 +1,51 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + + + groupId + subproject1 + ${project.version} + + + + + + + + + groupId + subproject1 + ${project.version} + + + + + + + subproject1 + subproject2 + subproject3 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject1/expected-pom.xml new file mode 100644 index 000000000..7356fc4d8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject2/expected-pom-different-version.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject2/expected-pom-different-version.xml new file mode 100644 index 000000000..2bb402056 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject2/expected-pom-different-version.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + groupId + subproject1 + + + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject2/expected-pom.xml new file mode 100644 index 000000000..2bb402056 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject2/expected-pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + groupId + subproject1 + + + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject2/pom.xml new file mode 100644 index 000000000..163095a1a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject2/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + + + + + + + groupId + subproject1 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject3/expected-pom-different-version.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject3/expected-pom-different-version.xml new file mode 100644 index 000000000..a6f2318af --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject3/expected-pom-different-version.xml @@ -0,0 +1,62 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + groupId + subproject1 + 2.0 + + + + + + + groupId + subproject1 + 2.0 + + + + + + + + + + + + + + + + groupId + subproject1 + 2.0 + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject3/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject3/expected-pom.xml new file mode 100644 index 000000000..99ce25cbb --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject3/expected-pom.xml @@ -0,0 +1,62 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject3 + + + + groupId + subproject1 + ${project.version} + + + + + + + groupId + subproject1 + ${project.version} + + + + + + + + + + + + + + + + groupId + subproject1 + ${project.version} + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject3/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject3/pom.xml new file mode 100644 index 000000000..f3783b900 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/interpolated-versions/subproject3/pom.xml @@ -0,0 +1,62 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject3 + + + + groupId + subproject1 + ${project.version} + + + + + + + groupId + subproject1 + ${project.version} + + + + + + + + + + + + + + + + groupId + subproject1 + ${project.version} + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/expected-pom.xml new file mode 100644 index 000000000..7abe8ceda --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/pom.xml new file mode 100644 index 000000000..dd9b2511d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject1/expected-pom.xml new file mode 100644 index 000000000..7356fc4d8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject1/expected-pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject1/pom.xml new file mode 100644 index 000000000..361db59f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject2/expected-pom.xml new file mode 100644 index 000000000..3108aebbf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject2/expected-pom.xml @@ -0,0 +1,31 @@ + + + + 4.0.0 + + groupId + subproject2 + 2.0 + + + + groupId + subproject1 + 0.5 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject2/pom.xml new file mode 100644 index 000000000..428685d08 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/modules-with-different-versions/subproject2/pom.xml @@ -0,0 +1,31 @@ + + + + 4.0.0 + + groupId + subproject2 + 2.0-SNAPSHOT + + + + groupId + subproject1 + 0.5 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/expected-pom.xml new file mode 100644 index 000000000..31e26a1c4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + subproject1 + sub/subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/pom.xml new file mode 100644 index 000000000..2fe3a8fdf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1 + sub/subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/sub/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/sub/subproject2/expected-pom.xml new file mode 100644 index 000000000..762f835c4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/sub/subproject2/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + ../.. + + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label/sub/subproject2 + scm:svn:file://localhost/tmp/scm-repo/tags/release-label/sub/subproject2 + file://localhost/tmp/scm-repo/tags/release-label/sub/subproject2 + + + subproject2 + 2.0 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/sub/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/sub/subproject2/pom.xml new file mode 100644 index 000000000..ec9bbaf0d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/sub/subproject2/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + ../.. + + + + scm:svn:file://localhost/tmp/scm-repo/trunk/sub/subproject2 + scm:svn:file://localhost/tmp/scm-repo/trunk/sub/subproject2 + file://localhost/tmp/scm-repo/trunk/sub/subproject2 + + + subproject2 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/subproject1/expected-pom.xml new file mode 100644 index 000000000..6d39eb267 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/subproject1/expected-pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + 2.0 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/subproject1/pom.xml new file mode 100644 index 000000000..fd15e14f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/multimodule-with-deep-subprojects/subproject1/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-externally-released-parent/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-externally-released-parent/expected-pom.xml new file mode 100644 index 000000000..0fb839565 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-externally-released-parent/expected-pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + external + parent-artifactId + 1 + + + groupId + subproject1 + 2.0 + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-externally-released-parent/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-externally-released-parent/pom.xml new file mode 100644 index 000000000..279901c8b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-externally-released-parent/pom.xml @@ -0,0 +1,31 @@ + + + + 4.0.0 + + external + parent-artifactId + 1-SNAPSHOT + + + groupId + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/expected-pom.xml new file mode 100644 index 000000000..afc030ffe --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/pom.xml new file mode 100644 index 000000000..0991d5be2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/subproject1/expected-pom-version-changed.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/subproject1/expected-pom-version-changed.xml new file mode 100644 index 000000000..dd7559e60 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/subproject1/expected-pom-version-changed.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + 2.0 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/subproject1/expected-pom.xml new file mode 100644 index 000000000..199578324 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/subproject1/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/subproject1/pom.xml new file mode 100644 index 000000000..68c977b17 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-inherited-version/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/expected-pom.xml new file mode 100644 index 000000000..7dac60a53 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/pom.xml new file mode 100644 index 000000000..9cdabb007 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject1/expected-pom.xml new file mode 100644 index 000000000..36944d8f8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject1/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject1/pom.xml new file mode 100644 index 000000000..fe46ed579 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject1/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject2/expected-pom.xml new file mode 100644 index 000000000..27b1f4e62 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject2/expected-pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + groupId + subproject1 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject2/pom.xml new file mode 100644 index 000000000..6bb62f41a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-namespace/subproject2/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + + + + groupId + subproject1 + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/expected-pom.xml new file mode 100644 index 000000000..6fb5a05e8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/expected-pom.xml @@ -0,0 +1,32 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/pom.xml new file mode 100644 index 000000000..7e4bc93f3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/pom.xml @@ -0,0 +1,32 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/expected-pom.xml new file mode 100644 index 000000000..87341f041 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + pom + + + subsubproject + + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label/subproject1 + scm:svn:file://localhost/tmp/scm-repo/tags/release-label/subproject1 + http://localhost/viewvc/mypath/tags/release-label/subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/pom.xml new file mode 100644 index 000000000..b7128194f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + pom + + + subsubproject + + + + scm:svn:file://localhost/tmp/scm-repo/trunk/subproject1 + scm:svn:file://localhost/tmp/scm-repo/trunk/subproject1 + http://localhost/viewvc/mypath/trunk/subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/subsubproject/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/subsubproject/expected-pom.xml new file mode 100644 index 000000000..f0b2f7058 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/subsubproject/expected-pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + groupId + subproject1 + 1.0 + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/subsubproject/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/subsubproject/pom.xml new file mode 100644 index 000000000..4a92ffdbc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-overridden-scm/subproject1/subsubproject/pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + groupId + subproject1 + 1.0-SNAPSHOT + + + subsubproject + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/expected-pom.xml new file mode 100644 index 000000000..fe1d22844 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/expected-pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/pom.xml new file mode 100644 index 000000000..d8b11dc1e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject1/expected-pom.xml new file mode 100644 index 000000000..f367a287b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject1/expected-pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + 2.0 + + + 2.0-SNAPSHOT + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject1/pom.xml new file mode 100644 index 000000000..14b84b1dc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject1/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + + + 2.0-SNAPSHOT + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject2/expected-pom.xml new file mode 100644 index 000000000..cfc08c1d6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject2/expected-pom.xml @@ -0,0 +1,42 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + 2.0 + + + + groupId + subproject1 + ${module.version} + + + + + 2.0 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject2/pom.xml new file mode 100644 index 000000000..9f938676d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-properties/subproject2/pom.xml @@ -0,0 +1,42 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + 2.0-SNAPSHOT + + + + groupId + subproject1 + ${module.version} + + + + + 2.0-SNAPSHOT + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/root-project/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/root-project/expected-pom.xml new file mode 100644 index 000000000..416074370 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/root-project/expected-pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label/root-project + scm:svn:file://localhost/tmp/scm-repo/tags/release-label/root-project + file://localhost/tmp/scm-repo/tags/release-label/root-project + + + + ../subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/root-project/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/root-project/pom.xml new file mode 100644 index 000000000..93fbc571a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/root-project/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk/root-project + scm:svn:file://localhost/tmp/scm-repo/trunk/root-project + file://localhost/tmp/scm-repo/trunk/root-project + + + + ../subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/subproject1/expected-pom.xml new file mode 100644 index 000000000..5c9991c6b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/subproject1/expected-pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + ../root-project + + + subproject1 + 2.0 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/subproject1/pom.xml new file mode 100644 index 000000000..4a765e112 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-flat/subproject1/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + ../root-project + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/expected-pom.xml new file mode 100644 index 000000000..181874cff --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/expected-pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/pom.xml new file mode 100644 index 000000000..2d60439af --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/subproject1/expected-pom.xml new file mode 100644 index 000000000..c836d0db4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/subproject1/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + 2.0 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/subproject1/pom.xml new file mode 100644 index 000000000..cf375987a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/expected-pom.xml new file mode 100644 index 000000000..97c2a7f1f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/expected-pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + subproject1-3.4 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/pom.xml new file mode 100644 index 000000000..efbdc07ea --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk + scm:svn:file://localhost/tmp/scm-repo/trunk + file://localhost/tmp/scm-repo/trunk + + + + subproject1-3.4 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject1-3.4/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject1-3.4/expected-pom.xml new file mode 100644 index 000000000..ce7018a3a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject1-3.4/expected-pom.xml @@ -0,0 +1,33 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1-3.4 + 2.0 + + + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject1-3.4/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject1-3.4/pom.xml new file mode 100644 index 000000000..6f9fb5ed7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject1-3.4/pom.xml @@ -0,0 +1,33 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject1-3.4 + 2.0-SNAPSHOT + + + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject2/expected-pom.xml new file mode 100644 index 000000000..54156eecf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject2/expected-pom.xml @@ -0,0 +1,42 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + 2.0 + + + + groupId + subproject1-${subproject.version} + ${project.version} + + + + + 3.4 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject2/pom.xml new file mode 100644 index 000000000..8fff76fa7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-property-dependency-coordinate/subproject2/pom.xml @@ -0,0 +1,42 @@ + + + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + subproject2 + 2.0-SNAPSHOT + + + + groupId + subproject1-${subproject.version} + ${project.version} + + + + + 3.4 + ignored + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/expected-pom.xml new file mode 100644 index 000000000..75f5a0d82 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + groupId + artifactId + 1 + pom + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/pom.xml new file mode 100644 index 000000000..75f5a0d82 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + groupId + artifactId + 1 + pom + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/subproject1/expected-pom.xml new file mode 100644 index 000000000..31153d642 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/subproject1/expected-pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1 + + + subproject1 + 2.0 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/subproject1/pom.xml new file mode 100644 index 000000000..4badcdc2f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-released-parent/subproject1/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + groupId + artifactId + 1 + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/expected-pom.xml new file mode 100644 index 000000000..181874cff --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/expected-pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + file://localhost/tmp/scm-repo/tags/release-label + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/pom.xml new file mode 100644 index 000000000..fe4362086 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + pom + + + scm:svn:file://localhost/tmp/scm-repo/trunk/ + scm:svn:file://localhost/tmp/scm-repo/trunk/ + file://localhost/tmp/scm-repo/trunk/ + + + + subproject1 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/subproject1/expected-pom.xml new file mode 100644 index 000000000..82c3787d6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/subproject1/expected-pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label/subproject1 + scm:svn:file://localhost/tmp/scm-repo/tags/release-label/subproject1 + file://localhost/tmp/scm-repo/tags/release-label/subproject1 + + + subproject1 + 2.0 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/subproject1/pom.xml new file mode 100644 index 000000000..202f6f8a3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-scm-of-parent-ending-with-a-slash/subproject1/pom.xml @@ -0,0 +1,33 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + + scm:svn:file://localhost/tmp/scm-repo/trunk/subproject1/ + scm:svn:file://localhost/tmp/scm-repo/trunk/subproject1/ + file://localhost/tmp/scm-repo/trunk/subproject1/ + + + subproject1 + 2.0-SNAPSHOT + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-without-extension-version/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-without-extension-version/expected-pom.xml new file mode 100644 index 000000000..8d0ea1e3f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-without-extension-version/expected-pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + + + groupId + something + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-without-extension-version/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-without-extension-version/pom.xml new file mode 100644 index 000000000..a1f4d9553 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-without-extension-version/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0-SNAPSHOT + + + + + groupId + something + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/expected-pom.xml new file mode 100644 index 000000000..f29d98547 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/expected-pom.xml @@ -0,0 +1,80 @@ + + + + 4.0.0 + + groupId + + + artifactId + + + 1.0 + + pom + + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + + + scm:svn:file://localhost/tmp/scm-repo/tags/release-label + + + file://localhost/tmp/scm-repo/tags/release-label + + + + + + + + groupId + + + subproject1 + + + 2.0 + + + + + + + + + + + groupId + + + subproject1 + + + 2.0 + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/pom.xml new file mode 100644 index 000000000..0b403f0ed --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/pom.xml @@ -0,0 +1,80 @@ + + + + 4.0.0 + + groupId + + + artifactId + + + 1.0-SNAPSHOT + + pom + + + + scm:svn:file://localhost/tmp/scm-repo/trunk + + + scm:svn:file://localhost/tmp/scm-repo/trunk + + + file://localhost/tmp/scm-repo/trunk + + + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject1/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject1/expected-pom.xml new file mode 100644 index 000000000..3e10f0d8e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject1/expected-pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + + groupId + + + artifactId + + + 1.0 + + + + + subproject1 + + + 2.0 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject1/pom.xml new file mode 100644 index 000000000..ad42a164c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject1/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + + groupId + + + artifactId + + + 1.0-SNAPSHOT + + + + + subproject1 + + + 2.0-SNAPSHOT + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject2/expected-pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject2/expected-pom.xml new file mode 100644 index 000000000..427d104d0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject2/expected-pom.xml @@ -0,0 +1,64 @@ + + + + 4.0.0 + + + groupId + + + artifactId + + + 1.0 + + + + + subproject2 + + + + + + groupId + + + subproject1 + + + 2.0 + + + + + + + + + groupId + + + subproject1 + + + 2.0 + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject2/pom.xml new file mode 100644 index 000000000..066bedae4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/whitespace-around-values/subproject2/pom.xml @@ -0,0 +1,64 @@ + + + + 4.0.0 + + + groupId + + + artifactId + + + 1.0-SNAPSHOT + + + + + subproject2 + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + + + + + groupId + + + subproject1 + + + 2.0-SNAPSHOT + + + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multimodule-with-deep-subprojects/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multimodule-with-deep-subprojects/pom.xml new file mode 100644 index 000000000..d410b6e54 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multimodule-with-deep-subprojects/pom.xml @@ -0,0 +1,31 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + sub/subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multimodule-with-deep-subprojects/sub/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multimodule-with-deep-subprojects/sub/subproject2/pom.xml new file mode 100644 index 000000000..77331b93a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multimodule-with-deep-subprojects/sub/subproject2/pom.xml @@ -0,0 +1,38 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + ../../pom.xml + + + subproject2 + + + + groupId + subproject1 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multimodule-with-deep-subprojects/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multimodule-with-deep-subprojects/subproject1/pom.xml new file mode 100644 index 000000000..2a4cee289 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multimodule-with-deep-subprojects/subproject1/pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multiple-poms/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multiple-poms/pom.xml new file mode 100644 index 000000000..7abe8ceda --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multiple-poms/pom.xml @@ -0,0 +1,28 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + pom + + + subproject1 + subproject2 + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multiple-poms/subproject1/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multiple-poms/subproject1/pom.xml new file mode 100644 index 000000000..7356fc4d8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multiple-poms/subproject1/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject1 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multiple-poms/subproject2/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multiple-poms/subproject2/pom.xml new file mode 100644 index 000000000..0e76953e8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/multiple-poms/subproject2/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + groupId + artifactId + 1.0 + + + subproject2 + + + + groupId + subproject1 + 1.0 + + + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/single-pom/pom.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/single-pom/pom.xml new file mode 100644 index 000000000..ac4f9e81e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/scm-commit/single-pom/pom.xml @@ -0,0 +1,22 @@ + + + + 4.0.0 + groupId + artifactId + 1.0 + diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/release.properties b/Java-base/maven-release/src/maven-release-manager/src/test/resources/release.properties new file mode 100644 index 000000000..845165f6b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/release.properties @@ -0,0 +1,54 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +completedPhase=step1 +commitByProject=true +scm.id=scm-id +scm.url=scm-url +scm.username=username +scm.password=password +scm.privateKey=private-key +scm.passphrase=passphrase +scm.tagBase=tagBase +scm.tagNameFormat=expectedTagNameFormat +scm.branchBase=branchBase +scm.tag=tag + +exec.additionalArguments=additional-arguments +exec.pomFileName=pom-file-name + +preparationGoals=preparation-goals +completionGoals=completion-goals + +project.rel.groupId\:artifactId1=2.0 +project.rel.groupId\:artifactId2=3.0 +project.dev.groupId\:artifactId1=2.1-SNAPSHOT +project.dev.groupId\:artifactId2=3.0.1-SNAPSHOT + +project.scm.groupId\:artifactId1.id=id +project.scm.groupId\:artifactId1.connection=connection +project.scm.groupId\:artifactId1.developerConnection=developerConnection +project.scm.groupId\:artifactId1.url=url +project.scm.groupId\:artifactId1.tag=tag + +project.scm.groupId\:artifactId2.connection=connection2 +project.scm.groupId\:artifactId2.url=url2 + +dependency.external\:artifactId.development=1.1-SNAPSHOT +dependency.external\:artifactId.release=1.0 diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/rewrite-release.properties b/Java-base/maven-release/src/maven-release-manager/src/test/resources/rewrite-release.properties new file mode 100644 index 000000000..877f9bd9d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/rewrite-release.properties @@ -0,0 +1,28 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +completedPhase=step1 +scm.id=scm-id +scm.url=scm-url +scm.username=username +scm.password=password +scm.privateKey=private-key +scm.passphrase=passphrase +scm.tagBase=tagBase +scm.branchBase=branchBase diff --git a/Java-base/maven-release/src/maven-release-manager/src/test/resources/settings-security.xml b/Java-base/maven-release/src/maven-release-manager/src/test/resources/settings-security.xml new file mode 100644 index 000000000..4ea03896f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-manager/src/test/resources/settings-security.xml @@ -0,0 +1,24 @@ + + + + + + {1wQaa6S/o8MH7FnaTNL53XmhT5O0SEGXQi3gC49o6OY=} + diff --git a/Java-base/maven-release/src/maven-release-plugin/pom.xml b/Java-base/maven-release/src/maven-release-plugin/pom.xml new file mode 100644 index 000000000..3bf479efc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/pom.xml @@ -0,0 +1,289 @@ + + + + + 4.0.0 + + + org.apache.maven.release + maven-release + 3.0.0-SNAPSHOT + + + org.apache.maven.plugins + maven-release-plugin + maven-plugin + + Maven Release Plugin + This plugin is used to release a project with Maven, saving a lot of repetitive, manual work. + + + ${mavenVersion} + + + + 3.6.0 + + + + + org.apache.maven + maven-plugin-api + + + org.apache.maven.plugin-tools + maven-plugin-annotations + + + org.apache.maven.release + maven-release-manager + 3.0.0-SNAPSHOT + + + org.apache.maven + maven-model + + + org.apache.maven + maven-core + + + org.apache.maven + maven-settings + + + org.apache.maven.scm + maven-scm-api + + + org.codehaus.plexus + plexus-utils + + + org.jdom + jdom + + + + + org.apache.maven.release + maven-release-oddeven-policy + 3.0.0-SNAPSHOT + true + + + org.apache.maven.release + maven-release-semver-policy + 3.0.0-SNAPSHOT + true + + + + junit + junit + test + + + org.mockito + mockito-core + test + + + org.apache.maven + maven-compat + test + + + org.apache.maven.plugin-testing + maven-plugin-testing-harness + 2.1 + test + + + + + + + org.apache.maven.plugins + maven-site-plugin + + scp://people.apache.org/www/maven.apache.org/plugins/${project.artifactId}-${project.version} + + + + org.apache.maven.plugins + maven-plugin-plugin + ${mavenPluginPluginVersion} + + true + + + + mojo-descriptor + + descriptor + + + + generated-helpmojo + + helpmojo + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + + enforce + + ensure-no-container-api + + + + + org.codehaus.plexus:plexus-component-api + + + The new containers are not supported. You probably added a dependency that is missing the exclusions. + + + + true + + + + + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + ${mavenPluginPluginVersion} + + + + + + + run-its + + false + + + + + org.apache.maven.plugins + maven-invoker-plugin + 3.2.0 + + + integration-test-prepare + + install + run + + + + + src/it + ${project.build.directory}/it + verify + ${project.build.directory}/local-repo + src/it/mrm/settings.xml + + ${mrm.repository.url} + + true + ${maven.it.failure.ignore} + + setup/*/pom.xml + + + projects/prepare/*/*pom.xml + projects/prepare/flat-multi-module/parent-project/pom.xml + projects/prepare-with-pom/*/*pom.xml + projects/branch/*/pom.xml + projects/perform/*/pom.xml + projects/update-versions/*/pom.xml + + + projects/prepare/MRELEASE-966/pom.xml + + + true + ${maven.compiler.source} + ${maven.compiler.target} + true + + + + + org.codehaus.mojo + mrm-maven-plugin + 1.2.0 + + + + start + stop + + + + + + + src/it/mrm/repository + + + + + + + + + + jdk7 + + (,1.7] + + + + + org.apache.maven.plugins + maven-invoker-plugin + + + ${https.protocols} + -Dhttps.protocols=${https.protocols} + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/mrm/repository/dependency-1.0-SNAPSHOT.pom b/Java-base/maven-release/src/maven-release-plugin/src/it/mrm/repository/dependency-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..6e26cf4f0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/mrm/repository/dependency-1.0-SNAPSHOT.pom @@ -0,0 +1,27 @@ + + + + 4.0.0 + + test + dependency + 1.0-SNAPSHOT + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/mrm/repository/extension-1.0-SNAPSHOT.pom b/Java-base/maven-release/src/maven-release-plugin/src/it/mrm/repository/extension-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..3c5f169b8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/mrm/repository/extension-1.0-SNAPSHOT.pom @@ -0,0 +1,30 @@ + + + + + 4.0.0 + + test + extension + 1.0-SNAPSHOT + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/mrm/repository/parent-1-SNAPSHOT.pom b/Java-base/maven-release/src/maven-release-plugin/src/it/mrm/repository/parent-1-SNAPSHOT.pom new file mode 100644 index 000000000..7f49b44c6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/mrm/repository/parent-1-SNAPSHOT.pom @@ -0,0 +1,28 @@ + + + + 4.0.0 + + test + parent + 1-SNAPSHOT + pom + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/mrm/settings.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/mrm/settings.xml new file mode 100644 index 000000000..4b3caf110 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/mrm/settings.xml @@ -0,0 +1,79 @@ + + + + + + + mrm-maven-plugin + Mock Repository Manager + @mrm.repository.url@ + * + + + + + + it-server + it-username + it-password + + + + + + it-repo + + true + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + mrelease-677 + + true + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-458/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-458/pom.xml new file mode 100644 index 000000000..46954b51c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-458/pom.xml @@ -0,0 +1,79 @@ + + + + + + 4.0.0 + org.apache.maven.plugin.release.it + test-release-branch + jar + 1.0 + Maven Quick Start Archetype + http://maven.apache.org + + + junit + junit + 3.8.1 + test + + + + scm:stub| + scm:stub| + + + + + maven-release-plugin + + false + true + test-1.0.x + + + + org.apache.maven.its.release + maven-scm-provider-stub + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-458/verify.bsh b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-458/verify.bsh new file mode 100644 index 000000000..981d92378 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-458/verify.bsh @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + File buildLog = new File( basedir, "build.log" ); + + System.out.println( "Checking logs..." ); + + StringBuffer data = new StringBuffer( 1024 ); + BufferedReader reader = new BufferedReader( new FileReader( buildLog ) ); + char[] buf = new char[1024]; + int numRead = 0; + while ( ( numRead = reader.read( buf ) ) != -1 ) + { + String readData = String.valueOf( buf, 0, numRead ); + data.append( readData ); + buf = new char[1024]; + } + reader.close(); + String contents = data.toString(); + + String one_expected = "Checking in modified POMs"; + + int pos = contents.indexOf( one_expected ); + + if( contents.indexOf( one_expected, pos ) == -1 ) + { + return true; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +System.out.println( "FAILED!" ); +return false; diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-694/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-694/pom.xml new file mode 100644 index 000000000..e84c5ea17 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-694/pom.xml @@ -0,0 +1,77 @@ + + + + + + + 4.0.0 + + org.apache.maven.plugin.release.it + mrelease-694 + 1.0-SNAPSHOT + + + scm:dummy|nul + scm:dummy|nul + + + + + + org.apache.maven.plugins + maven-release-plugin + 2.4.2 + + true + true + true + true + true + false + false + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-694/test.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-694/test.properties new file mode 100644 index 000000000..38e80764e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-694/test.properties @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +branchName=RELEASE-2.6.0 +developmentVersion=2.6.1-DEV-SNAPSHOT +releaseVersion=2.6.0-BRANCH-SNAPSHOT +updateVersionsToSnapshot=false +dryRun=true \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-694/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-694/verify.groovy new file mode 100644 index 000000000..8d7f901c8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-694/verify.groovy @@ -0,0 +1,27 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def projectBranch = new XmlSlurper().parse( new File( basedir, "pom.xml.branch" ) ) +assert projectBranch.version.text() == "2.6.0-BRANCH-SNAPSHOT" + +def projectNext = new XmlSlurper().parse( new File( basedir, "pom.xml.next" ) ) +assert projectNext.version.text() == "2.6.1-DEV-SNAPSHOT" + +return true \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-745/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-745/pom.xml new file mode 100644 index 000000000..4fe5757b9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-745/pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + org.apache.maven.plugin.release.it + mrelease-745 + 1.0-SNAPSHOT + + scm:dummy|nul + scm:dummy|nul + + + + + maven-release-plugin + + true + branch-mrelease-745 + false + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-745/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-745/verify.groovy new file mode 100644 index 000000000..ddc0d4c4b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-745/verify.groovy @@ -0,0 +1,24 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +assert 1 == buildLog.getText().count("[INFO] Full run would not commit changes, because suppressCommitBeforeTagOrBranch is set.") diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-976/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-976/pom.xml new file mode 100644 index 000000000..2ad818e46 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-976/pom.xml @@ -0,0 +1,57 @@ + + + + 4.0.0 + org.apache.maven.plugin.release.it + mrelease-976 + 1.0-SNAPSHOT + https://issues.apache.org/jira/browse/MRELEASE-976 + Tests that release:branch supports setting a custom projectVersionPolicyId + + scm:dummy|nul + scm:dummy|nul + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + branch-mrelease-976 + StubVersionPolicy + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + org.apache.maven.its.release + maven-project-version-stub-policy + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-976/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-976/verify.groovy new file mode 100644 index 000000000..04ff692a3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/MRELEASE-976/verify.groovy @@ -0,0 +1,28 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def project = new XmlSlurper().parse( new File( basedir, "pom.xml" ) ) +assert project.version.text() == "1.0-SNAPSHOT" + +// verifies that the version is unchanged because of the custom policy: 1.0-SNAPSHOT -> 1.0-SNAPSHOT +def projectNext = new XmlSlurper().parse( new File( basedir, "pom.xml.next" ) ) +assert projectNext.version.text() == "1.0-SNAPSHOT" + +return true diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/invoker.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/invoker.properties new file mode 100644 index 000000000..0b47fed18 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/branch/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = release:clean release:branch \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-459/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-459/pom.xml new file mode 100644 index 000000000..06c2cb264 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-459/pom.xml @@ -0,0 +1,72 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-759 + 1.0-SNAPSHOT + + + scm:dummy|nul + scm:dummy|nul + + + + + dummy + dummy:nul + + + + + + + org.apache.maven.its.release + wagon-provider-dummy + 1.0 + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + true + custom-release + + + + + + + + custom-release + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-459/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-459/verify.groovy new file mode 100644 index 000000000..b6a4bbf3b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-459/verify.groovy @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +def addArgsExpr = /\Q[DEBUG] Additional arguments: \E(?:-Dhttps.protocols=TLSv1.2 )?-P(.+)\Q-DperformRelease=true -f pom.xml\E/ +def matcher = ( buildLog.getText() =~ addArgsExpr ) + +// M2: [DEBUG] Additional arguments: -P custom-release -DperformRelease=true -f pom.xml +// M3: [DEBUG] Additional arguments: -P it-repo,it-repo,custom-release -DperformRelease=true -f pom.xml + +assert matcher.find() +assert matcher.getCount() == 1 + +assert matcher[0][1].contains( "custom-release" ) diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-592/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-592/pom.xml new file mode 100644 index 000000000..77e304eaf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-592/pom.xml @@ -0,0 +1,116 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-592 + 1.0-SNAPSHOT + + + scm:dummy|nul + scm:dummy|nul + + + + + dummy + dummy:nul + + + + + + + org.apache.maven.its.release + wagon-provider-dummy + 1.0 + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + clean + release,!integration-tests + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + + + + release + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.1.1 + + + enforce + + enforce + + + + + + + + + + + + + + integration-tests + + true + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.1.1 + + + enforce + + enforce + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-736/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-736/pom.xml new file mode 100644 index 000000000..81d2c2d9e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-736/pom.xml @@ -0,0 +1,62 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-736 + 1.0-SNAPSHOT + + + scm:dummy|nul + scm:dummy|nul + + + + + dummy + dummy:nul + + + + + + + org.apache.maven.its.release + wagon-provider-dummy + 1.0 + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-736/test.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-736/test.properties new file mode 100644 index 000000000..d7c5eef13 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-736/test.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +dryRun=true \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-818/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-818/pom.xml new file mode 100644 index 000000000..d88c677e3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-818/pom.xml @@ -0,0 +1,65 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-818 + 1.0-SNAPSHOT + + + scm:dummy|nul + scm:dummy|nul + + + + + dummy + dummy:nul + + + + + + + org.apache.maven.its.release + wagon-provider-dummy + 1.0 + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + true + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-818/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-818/verify.groovy new file mode 100644 index 000000000..9057a5624 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-818/verify.groovy @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +def localCheckoutExpr = /\Q[INFO] This would be a LOCAL check out to perform the release ...\E/ +def matcher = ( buildLog.getText() =~ localCheckoutExpr ) + +assert matcher.find() +assert matcher.getCount() == 1 \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-832/invoker.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-832/invoker.properties new file mode 100644 index 000000000..af2f6573d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-832/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = release:clean release:perform \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-832/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-832/pom.xml new file mode 100644 index 000000000..38f8a67bc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-832/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-832 + 1.0-SNAPSHOT + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + scm:dummy|nul + perform_username + perform_password + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-832/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-832/verify.groovy new file mode 100644 index 000000000..96d8b7ecc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/MRELEASE-832/verify.groovy @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +assert buildLog.text.contains( "[DEBUG] (f) username = perform_username" ) +assert buildLog.text.contains( "[DEBUG] (f) password = perform_password" ) + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/invoker.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/invoker.properties new file mode 100644 index 000000000..676aa5db3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/perform/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = release:clean release:prepare release:perform \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/MRELEASE-808/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/MRELEASE-808/pom.xml new file mode 100644 index 000000000..af009245b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/MRELEASE-808/pom.xml @@ -0,0 +1,63 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-808 + 1.0-SNAPSHOT + + + scm:dummy|nul + scm:dummy|nul + http://${scm.host}/viewvc/${project.artifactId}/trunk/ + + + + localhost:8080 + + + + + dummy + dummy:nul + + + + + ${project.groupId}.${project.artifactId}-${project.version} + + + org.apache.maven.its.release + wagon-provider-dummy + 1.0 + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/MRELEASE-808/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/MRELEASE-808/verify.groovy new file mode 100644 index 000000000..426eebf80 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/MRELEASE-808/verify.groovy @@ -0,0 +1,24 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File releasePom = new File( basedir, 'release-pom.xml' ) +assert releasePom.exists() + +assert 1 == releasePom.getText().count("org.apache.maven.plugin.release.its.mrelease-808-1.0") diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-basic/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-basic/pom.xml new file mode 100644 index 000000000..f7141a8e6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-basic/pom.xml @@ -0,0 +1,62 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + finalname-basic + 1.0-SNAPSHOT + + + scm:dummy|nul + scm:dummy|nul + http://${scm.host}/viewvc/${project.artifactId}/trunk/ + + + + localhost:8080 + + + + + dummy + dummy:nul + + + + + + + org.apache.maven.its.release + wagon-provider-dummy + 1.0 + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-basic/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-basic/verify.groovy new file mode 100644 index 000000000..fdec012c5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-basic/verify.groovy @@ -0,0 +1,24 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File releasePom = new File( basedir, 'release-pom.xml' ) +assert releasePom.exists() + +assert 1 == releasePom.getText().count("finalname-basic-1.0") diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-multimodule/module/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-multimodule/module/pom.xml new file mode 100644 index 000000000..eb3215f44 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-multimodule/module/pom.xml @@ -0,0 +1,25 @@ + + + + 4.0.0 + + + org.apache.maven.plugin.release.its + finalname-multimodule + 1.0-SNAPSHOT + + + module + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-multimodule/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-multimodule/pom.xml new file mode 100644 index 000000000..54c3c630f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-multimodule/pom.xml @@ -0,0 +1,63 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + finalname-multimodule + 1.0-SNAPSHOT + pom + + + scm:dummy|nul + scm:dummy|nul + + + + + dummy + dummy:nul + + + + + FinalName + + + org.apache.maven.its.release + wagon-provider-dummy + 1.0 + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + + + module + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-multimodule/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-multimodule/verify.groovy new file mode 100644 index 000000000..308277e3b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/finalname-multimodule/verify.groovy @@ -0,0 +1,24 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File moduleReleasePom = new File( basedir, 'module/release-pom.xml' ) +assert moduleReleasePom.exists() + +assert 1 == moduleReleasePom.getText().count("FinalName") diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/invoker.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/invoker.properties new file mode 100644 index 000000000..0f61bae72 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare-with-pom/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = release:clean release:prepare-with-pom \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-128/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-128/pom.xml new file mode 100644 index 000000000..1240345da --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-128/pom.xml @@ -0,0 +1,50 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-128 + 1.0-SNAPSHOT + + + SCM properties being replaced during release:perform + + + + scm:svn:http://${scm.host}/svn/${project.artifactId}/trunk/ + scm:svn:http://${scm.host}/svn/${project.artifactId}/trunk/ + http://${scm.host}/viewvc/${project.artifactId}/trunk/ + + + + scmhost.apache.org + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-128/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-128/verify.groovy new file mode 100644 index 000000000..8502268ec --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-128/verify.groovy @@ -0,0 +1,39 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File pomXml = new File( basedir, 'pom.xml' ) +assert pomXml.exists() +assert 1 == pomXml.getText().count("scm:svn:http://\${scm.host}/svn/\${project.artifactId}/trunk/") +assert 1 == pomXml.getText().count("scm:svn:http://\${scm.host}/svn/\${project.artifactId}/trunk/") + +File pomXmlTag = new File( basedir, 'pom.xml.tag' ) +assert pomXmlTag.exists() +assert 1 == pomXmlTag.getText().count("scm:svn:http://\${scm.host}/svn/\${project.artifactId}/tags/mrelease-128-1.0") +assert 1 == pomXmlTag.getText().count("scm:svn:http://\${scm.host}/svn/\${project.artifactId}/tags/mrelease-128-1.0") + +File pomXmlNext = new File( basedir, 'pom.xml.next' ) +assert pomXmlNext.exists() +assert 1 == pomXmlNext.getText().count("scm:svn:http://\${scm.host}/svn/\${project.artifactId}/trunk/") +assert 1 == pomXmlNext.getText().count("scm:svn:http://\${scm.host}/svn/\${project.artifactId}/trunk/") + +File pomXmlReleaseBackup = new File( basedir, 'pom.xml.releaseBackup' ) +assert pomXmlReleaseBackup.exists() +assert 1 == pomXmlReleaseBackup.getText().count("scm:svn:http://\${scm.host}/svn/\${project.artifactId}/trunk/") +assert 1 == pomXmlReleaseBackup.getText().count("scm:svn:http://\${scm.host}/svn/\${project.artifactId}/trunk/") \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-156/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-156/pom.xml new file mode 100644 index 000000000..a20878b15 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-156/pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-156 + 1.0-SNAPSHOT + + + Multiline scmCommentPrefix + + + + scm:dummy|nul + scm:dummy|nul + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + ABCD-1234${line.separator} + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-156/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-156/verify.groovy new file mode 100644 index 000000000..22c52b01e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-156/verify.groovy @@ -0,0 +1,31 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File releaseProperties = new File( basedir, 'release.properties' ) +assert releaseProperties.exists() + +if ( System.properties[ 'os.name' ].toLowerCase().contains( 'windows' ) ) +{ + assert 1 == releaseProperties.getText().count( "scm.commentPrefix=ABCD-1234\\r\\n" ) +} +else +{ + assert 1 == releaseProperties.getText().count( "scm.commentPrefix=ABCD-1234\\n" ) +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/pom.xml new file mode 100644 index 000000000..ff953014b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/pom.xml @@ -0,0 +1,96 @@ + + + + + 4.0.0 + org.apache.maven.plugin.release.its + mrelease-161 + 1.0-SNAPSHOT + This is the base POM the release test modules + pom + O2 Release test Base Module + + release-test-module-one + release-test-module-two + + + scm:git|sd_pa/tools/release-test + + + + + + org.apache.maven.plugin.release.its + release-test-module-one + 1.0-SNAPSHOT + + + + org.apache.maven.plugin.release.its + release-test-module-one + 1.0-SNAPSHOT + test-jar + test + + + + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + + + + org.apache.maven.plugins + maven-source-plugin + + + package + + jar + + + + + + + + + o2-webdav + ${repository.o2.webdav} + + + o2-webdav + ${repository.o2.webdav} + + + + dav:${o2.module.sites.rootUrl}/${project.groupId}/${project.artifactId}-${project.version} + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/release-test-module-one/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/release-test-module-one/pom.xml new file mode 100644 index 000000000..139b52a1a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/release-test-module-one/pom.xml @@ -0,0 +1,49 @@ + + + + + org.apache.maven.plugin.release.its + mrelease-161 + 1.0-SNAPSHOT + + 4.0.0 + release-test-module-one + 1.0-SNAPSHOT + release-test-module-one + http://maven.apache.org + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/release-test-module-two/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/release-test-module-two/pom.xml new file mode 100644 index 000000000..5ff976872 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/release-test-module-two/pom.xml @@ -0,0 +1,47 @@ + + + + + org.apache.maven.plugin.release.its + mrelease-161 + 1.0-SNAPSHOT + + 4.0.0 + release-test-module-two + release-test-module-two + 1.0-SNAPSHOT + http://maven.apache.org + + + + org.apache.maven.plugin.release.its + release-test-module-one + + + + org.apache.maven.plugin.release.its + release-test-module-one + test-jar + test + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/verify.groovy new file mode 100644 index 000000000..ec4071365 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/verify.groovy @@ -0,0 +1,29 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +def projectRoot = new XmlSlurper().parse( new File( basedir, "pom.xml.next" ) ) + +assert projectRoot.dependencyManagement.dependencies.dependency[0].version.text() == "1.1-SNAPSHOT" +assert projectRoot.dependencyManagement.dependencies.dependency[1].version.text() == "1.1-SNAPSHOT" + +return true \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/pom.xml new file mode 100644 index 000000000..8cd6dc024 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/pom.xml @@ -0,0 +1,77 @@ + + + + + 4.0.0 + org.apache.maven.plugin.release.its + mrelease-161 + 1.0-SNAPSHOT + This is the base POM the release test modules + pom + O2 Release test Base Module + + release-test-module-one + release-test-module-two + + + scm:git|sd_pa/tools/release-test + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + + + + org.apache.maven.plugins + maven-source-plugin + + + package + + jar + + + + + + + + + o2-webdav + ${repository.o2.webdav} + + + o2-webdav + ${repository.o2.webdav} + + + + dav:${o2.module.sites.rootUrl}/${project.groupId}/${project.artifactId}-${project.version} + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/release-test-module-one/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/release-test-module-one/pom.xml new file mode 100644 index 000000000..139b52a1a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/release-test-module-one/pom.xml @@ -0,0 +1,49 @@ + + + + + org.apache.maven.plugin.release.its + mrelease-161 + 1.0-SNAPSHOT + + 4.0.0 + release-test-module-one + 1.0-SNAPSHOT + release-test-module-one + http://maven.apache.org + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/release-test-module-two/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/release-test-module-two/pom.xml new file mode 100644 index 000000000..4906246bb --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/release-test-module-two/pom.xml @@ -0,0 +1,49 @@ + + + + + org.apache.maven.plugin.release.its + mrelease-161 + 1.0-SNAPSHOT + + 4.0.0 + release-test-module-two + release-test-module-two + 1.0-SNAPSHOT + http://maven.apache.org + + + + org.apache.maven.plugin.release.its + release-test-module-one + 1.0-SNAPSHOT + + + + org.apache.maven.plugin.release.its + release-test-module-one + 1.0-SNAPSHOT + test-jar + test + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/verify.groovy new file mode 100644 index 000000000..3718c5488 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/verify.groovy @@ -0,0 +1,29 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +def projectRoot = new XmlSlurper().parse( new File( basedir, "release-test-module-two/pom.xml.next" ) ) + +assert projectRoot.dependencies.dependency[0].version.text() == "1.1-SNAPSHOT" +assert projectRoot.dependencies.dependency[1].version.text() == "1.1-SNAPSHOT" + +return true \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-420/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-420/pom.xml new file mode 100644 index 000000000..ee2c863ba --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-420/pom.xml @@ -0,0 +1,56 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-420 + 1.0-SNAPSHOT + + + Pick up the server from the settings.xml by the project.scm.id-property + + + + scm:dummy|nul + scm:dummy|nul + + + + it-server + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-420/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-420/verify.groovy new file mode 100644 index 000000000..a41f9c30e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-420/verify.groovy @@ -0,0 +1,24 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File releaseProperties = new File( basedir, 'release.properties' ) +assert releaseProperties.exists() + +assert 1 == releaseProperties.getText().count("scm.id=it-server") diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-483/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-483/pom.xml new file mode 100644 index 000000000..d8f50ee70 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-483/pom.xml @@ -0,0 +1,56 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-483 + 1.0-SNAPSHOT + + + PrepareReleaseMojo always increments development version + + + + scm:dummy|nul + scm:dummy|nul + + + + it-server + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-483/test.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-483/test.properties new file mode 100644 index 000000000..027d1076b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-483/test.properties @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +releaseVersion=1.0.1237 +tag=yflex_library-1.0.1237 +developmentVersion=1.0-SNAPSHOT diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-483/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-483/verify.groovy new file mode 100644 index 000000000..3db65ae0e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-483/verify.groovy @@ -0,0 +1,25 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File releaseProperties = new File( basedir, 'release.properties' ) +assert releaseProperties.exists() + +assert 1 == releaseProperties.getText().count("project.dev.org.apache.maven.plugin.release.its\\:mrelease-483=1.0-SNAPSHOT") +assert 1 == releaseProperties.getText().count("project.rel.org.apache.maven.plugin.release.its\\:mrelease-483=1.0.1237") \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-533/other-pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-533/other-pom.xml new file mode 100644 index 000000000..7e8e7a1c6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-533/other-pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-533 + 1.0-SNAPSHOT + + + scm:dummy|nul + scm:dummy|nul + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-533/test.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-533/test.properties new file mode 100644 index 000000000..e2488e78a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-533/test.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +arguments = -f other-pom.xml \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-533/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-533/verify.groovy new file mode 100644 index 000000000..f34ab1752 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-533/verify.groovy @@ -0,0 +1,24 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +assert 1 == buildLog.getText().count("[DEBUG] Specified POM file is not named 'pom.xml'. Using the '-f' command-line option to accommodate non-standard filename...") diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/invoker.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/invoker.properties new file mode 100644 index 000000000..54719b357 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/invoker.properties @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +#Require at least Maven3, so we can verify the release.properties +invoker.maven.version=3+ +invoker.profiles=mrelease571 diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/module1/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/module1/pom.xml new file mode 100644 index 000000000..902a69ae2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/module1/pom.xml @@ -0,0 +1,85 @@ + + + + 4.0.0 + + org.codehaus.maven.plugins.release.its + mrelease-571 + 1.0-SNAPSHOT + + org.codehaus.maven.plugins.release.its + mrelease-571-module1 + pom + + + + default + + true + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.0.1 + + + + enforce + + + + + + + + + + + + + + mrelease571 + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.0.1 + + + + enforce + + + + + + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/pom.xml new file mode 100644 index 000000000..1540a4046 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/pom.xml @@ -0,0 +1,54 @@ + + + + 4.0.0 + + org.codehaus.maven.plugins.release.its + mrelease-571 + 1.0-SNAPSHOT + pom + + + scm:dummy|nul + scm:dummy|nul + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + + + module1 + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/verify.groovy new file mode 100644 index 000000000..e0839d3dc --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/verify.groovy @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File releaseProperties = new File( basedir, 'release.properties' ) +assert releaseProperties.exists() + +def String execArgs = releaseProperties.filterLine { line -> + line.startsWith( 'exec.activateProfiles=' ) +} + +assert execArgs.contains( "mrelease571" ) diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-618/my-pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-618/my-pom.xml new file mode 100644 index 000000000..fbcf930c6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-618/my-pom.xml @@ -0,0 +1,51 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-618 + 1.0-SNAPSHOT + + + scm:dummy|nul + scm:dummy|nul + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + my-pom.xml + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-618/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-618/verify.groovy new file mode 100644 index 000000000..f34ab1752 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-618/verify.groovy @@ -0,0 +1,24 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +assert 1 == buildLog.getText().count("[DEBUG] Specified POM file is not named 'pom.xml'. Using the '-f' command-line option to accommodate non-standard filename...") diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-667/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-667/pom.xml new file mode 100644 index 000000000..216c5555c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-667/pom.xml @@ -0,0 +1,52 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-667 + 1.0-SNAPSHOT + + + scm:dummy|nul + scm:dummy|nul + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + -Prelease,!mrelease-677 ${arguments} + help:all-profiles + + + + org.apache.maven.plugins + maven-help-plugin + 2.1.1 + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-667/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-667/verify.groovy new file mode 100644 index 000000000..1440a7a0b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-667/verify.groovy @@ -0,0 +1,27 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +// Can only be checked with M3 +//assert 1 == buildLog.getText().count("[DEBUG] Profile with id: 'mrelease-677' has been explicitly activated.") + +assert 1 == buildLog.getText().count(" Profile Id: mrelease-677 (Active: false , Source: settings.xml)") diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-834/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-834/pom.xml new file mode 100644 index 000000000..ad9190851 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-834/pom.xml @@ -0,0 +1,44 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-834 + 1.0-SNAPSHOT + pom + + + scm:dummy|nul + scm:dummy|nul + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-834/test.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-834/test.properties new file mode 100644 index 000000000..5ba71e6f7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-834/test.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +dependency.locations.enabled=false \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-835/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-835/pom.xml new file mode 100644 index 000000000..38bd07e29 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-835/pom.xml @@ -0,0 +1,71 @@ + + + + 4.0.0 + + org.apache.maven.plugins.release.its + mrelease-835 + 1.0-SNAPSHOT + pom + + + scm:dummy|nul + scm:dummy|nul + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + dependencies + -Dflag -Dfoo=bar + invoker + validate + validate + verify + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + + + + test + dependency + 1.2.3-SNAPSHOT + + + test + dependency.test + 2.3.4-SNAPSHOT + test + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-835/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-835/verify.groovy new file mode 100644 index 000000000..027cc503b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-835/verify.groovy @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +assert 1 == buildLog.getText().count("[DEBUG] (f) autoResolveSnapshots = dependencies") + +File pomXmlNext = new File( basedir, 'pom.xml.next' ) +assert pomXmlNext.exists() +assert 1 == pomXmlNext.getText().count("1.2.3") +assert 1 == pomXmlNext.getText().count("2.3.4") diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/invoker.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/invoker.properties new file mode 100644 index 000000000..ef3b21b95 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.project = my-pom.xml \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/my-pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/my-pom.xml new file mode 100644 index 000000000..b01a9209d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/my-pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-966-my-pom + 1.0-SNAPSHOT + + + scm:dummy|nul + scm:dummy|nul + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/pom.xml new file mode 100644 index 000000000..91ebffc2d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-966-pom + 1.0-SNAPSHOT + + + scm:dummy|nul + scm:dummy|nul + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/verify.groovy new file mode 100644 index 000000000..a39cde10c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/verify.groovy @@ -0,0 +1,27 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +assert 2 == buildLog.getText().count("[INFO] Building mrelease-966-my-pom 1.0-SNAPSHOT") +assert 0 == buildLog.getText().count("[INFO] Building mrelease-966-pom 1.0-SNAPSHOT") +assert 1 == buildLog.getText().count("[INFO] [INFO] Building mrelease-966-my-pom 1.0-SNAPSHOT") +assert 1 == buildLog.getText().count("[DEBUG] Specified POM file is not named 'pom.xml'. Using the '-f' command-line option to accommodate non-standard filename...") diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/pom.xml new file mode 100644 index 000000000..a20e7d116 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/pom.xml @@ -0,0 +1,56 @@ + + + + 4.0.0 + org.apache.maven.plugin.release.it + mrelease-976 + 1.0-SNAPSHOT + https://issues.apache.org/jira/browse/MRELEASE-976 + Tests that release:prepare supports setting a custom projectVersionPolicyId + + scm:dummy|nul + scm:dummy|nul + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + StubVersionPolicy + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + org.apache.maven.its.release + maven-project-version-stub-policy + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/verify.groovy new file mode 100644 index 000000000..1a947573f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/verify.groovy @@ -0,0 +1,30 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def project = new XmlSlurper().parse( new File( basedir, "pom.xml" ) ) +assert project.version.text() == "1.0-SNAPSHOT" + +def projectTag = new XmlSlurper().parse( new File( basedir, "pom.xml.tag" ) ) +assert projectTag.version.text() == "1.0" + +def projectNext = new XmlSlurper().parse( new File( basedir, "pom.xml.next" ) ) +assert projectNext.version.text() == "1.0-SNAPSHOT" + +return true diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/pom.xml new file mode 100644 index 000000000..284c0f58f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/pom.xml @@ -0,0 +1,65 @@ + + + + 4.0.0 + + + test + parent + 1-SNAPSHOT + + + org.apache.maven.plugin.release.its + mrelease-985 + 1.0-SNAPSHOT + + + scm:dummy|nul + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + scm:dummy|nul + perform_username + perform_password + + + + + + + + test + dependency + 1.0-SNAPSHOT + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/test.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/test.properties new file mode 100644 index 000000000..7d79cfc30 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/test.properties @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +dependency.rel.test\:parent=1 +dependency.dev.test\:parent=2-SNAPSHOT +dependency.rel.test\:dependency=1.0.RELEASE +dependency.dev.test\:dependency=2.0-SNAPSHOT diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/verify.groovy new file mode 100644 index 000000000..4e05fc8f7 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/verify.groovy @@ -0,0 +1,36 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def project = new XmlSlurper().parse( new File( basedir, "pom.xml" ) ) +assert project.version.text() == "1.0-SNAPSHOT" +assert project.parent.version.text() == "1-SNAPSHOT" +assert project.dependencies.dependency.version.text() == "1.0-SNAPSHOT" + +def projectTag = new XmlSlurper().parse( new File( basedir, "pom.xml.tag" ) ) +assert projectTag.version.text() == "1.0" +assert projectTag.parent.version.text() == "1" +assert projectTag.dependencies.dependency.version.text() == "1.0.RELEASE" + +def projectNext = new XmlSlurper().parse( new File( basedir, "pom.xml.next" ) ) +assert projectNext.version.text() == "1.1-SNAPSHOT" +assert projectNext.parent.version.text() == "2-SNAPSHOT" +assert projectNext.dependencies.dependency.version.text() == "2.0-SNAPSHOT" + +return true diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/completion-goals/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/completion-goals/pom.xml new file mode 100644 index 000000000..3834fa275 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/completion-goals/pom.xml @@ -0,0 +1,58 @@ + + + + 4.0.0 + + org.apache.maven.its.release + completion-goals + 1.0-SNAPSHOT + pom + + Maven Release Plugin IT + http://maven.apache.org/ + + + scm:dummy|nul + scm:dummy|nul + + + + + + maven-release-plugin + @project.version@ + + -Dflag -Dfoo=bar + invoker + validate + validate + verify + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/completion-goals/verify.bsh b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/completion-goals/verify.bsh new file mode 100644 index 000000000..987c06cae --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/completion-goals/verify.bsh @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + File buildLog = new File( basedir, "build.log" ); + + System.out.println( "Checking logs.." ); + + StringBuffer data = new StringBuffer( 1024 ); + BufferedReader reader = new BufferedReader( new FileReader( buildLog ) ); + char[] buf = new char[1024]; + int numRead = 0; + while ( ( numRead = reader.read( buf ) ) != -1 ) + { + String readData = String.valueOf( buf, 0, numRead ); + data.append( readData ); + buf = new char[1024]; + } + reader.close(); + String contents = data.toString(); + + String expected = "Executing preparation goals"; + int index = 0; + + if( ( index = contents.indexOf( expected, index ) ) == -1 ) + { + System.out.println( "FAILED!" ); + return false; + } + expected = "Executing goals 'validate'"; + + if( ( index = contents.indexOf( expected, index ) ) == -1 ) + { + System.out.println( "FAILED!" ); + return false; + } + expected = "Executing completion goals"; + + if( ( index = contents.indexOf( expected, index ) ) == -1 ) + { + System.out.println( "FAILED!" ); + return false; + } + expected = "Executing goals 'verify'"; + + if( ( index = contents.indexOf( expected, index ) ) == -1 ) + { + System.out.println( "FAILED!" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/invoker.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/invoker.properties new file mode 100644 index 000000000..c19c7116f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.buildResult = failure \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/pom.xml new file mode 100644 index 000000000..317f36abf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/pom.xml @@ -0,0 +1,97 @@ + + + + 4.0.0 + + org.apache.maven.plugins.release.its + fail-on-snapshot + 1.0-SNAPSHOT + pom + + + scm:dummy|nul + scm:dummy|nul + + + + + + test + extension + 1.0-SNAPSHOT + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + -Dflag -Dfoo=bar + invoker + validate + validate + verify + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + test + plugin + 1.0-SNAPSHOT + + + org.apache.maven.plugins + maven-install-plugin + 3.0.0 + + + + + + + test + dependency + 1.0-SNAPSHOT + + + test + dependency.test + 1.0-SNAPSHOT + test + + + + + + + test + report + 1.0-SNAPSHOT + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/verify.groovy new file mode 100644 index 000000000..7bc9f5fb9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/verify.groovy @@ -0,0 +1,32 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def buildLog = new File(basedir,'build.log') +def nonReleased = buildLog.readLines() + .dropWhile{ !it.endsWith("Can't release project due to non released dependencies :") } + .drop(1) + .collect{ (it - '[ERROR]').trim() } + .takeWhile{ !it.startsWith("in project 'fail-on-snapshot'") } as Set + +assert nonReleased == ['test:dependency:jar:1.0-SNAPSHOT:compile', + 'test:dependency.test:jar:1.0-SNAPSHOT:test', + 'test:extension:jar:1.0-SNAPSHOT', + 'test:plugin:maven-plugin:1.0-SNAPSHOT:runtime', + 'test:report:maven-plugin:1.0-SNAPSHOT:runtime'] as Set \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-a/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-a/pom.xml new file mode 100644 index 000000000..061222fcf --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-a/pom.xml @@ -0,0 +1,41 @@ + + + + + parent-project + org.apache.maven.plugin.release + 1.0-SNAPSHOT + ../parent-project/pom.xml + + 4.0.0 + org.apache.maven.plugin.release + module-a + module-a + 1.0-SNAPSHOT + http://maven.apache.org + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-a/src/main/java/org/apache/maven/plugin/release/module/a/App.java b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-a/src/main/java/org/apache/maven/plugin/release/module/a/App.java new file mode 100644 index 000000000..05ca6ecab --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-a/src/main/java/org/apache/maven/plugin/release/module/a/App.java @@ -0,0 +1,32 @@ +package org.apache.maven.plugin.release.module.a; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-a/src/test/java/org/apache/maven/plugin/release/module/a/AppTest.java b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-a/src/test/java/org/apache/maven/plugin/release/module/a/AppTest.java new file mode 100644 index 000000000..ca41b5f53 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-a/src/test/java/org/apache/maven/plugin/release/module/a/AppTest.java @@ -0,0 +1,57 @@ +package org.apache.maven.plugin.release.module.a; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-b/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-b/pom.xml new file mode 100644 index 000000000..81563eab0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-b/pom.xml @@ -0,0 +1,41 @@ + + + + + parent-project + org.apache.maven.plugin.release + 1.0-SNAPSHOT + ../parent-project/pom.xml + + 4.0.0 + org.apache.maven.plugin.release + module-b + module-b + 1.0-SNAPSHOT + http://maven.apache.org + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-b/src/main/java/org/apache/maven/plugin/release/module/b/App.java b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-b/src/main/java/org/apache/maven/plugin/release/module/b/App.java new file mode 100644 index 000000000..46fb8fffe --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-b/src/main/java/org/apache/maven/plugin/release/module/b/App.java @@ -0,0 +1,33 @@ +package org.apache.maven.plugin.release.module.b; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-b/src/test/java/org/apache/maven/plugin/release/module/b/AppTest.java b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-b/src/test/java/org/apache/maven/plugin/release/module/b/AppTest.java new file mode 100644 index 000000000..3e11941dd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/module-b/src/test/java/org/apache/maven/plugin/release/module/b/AppTest.java @@ -0,0 +1,58 @@ +package org.apache.maven.plugin.release.module.b; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/parent-project/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/parent-project/pom.xml new file mode 100644 index 000000000..8c27df667 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/parent-project/pom.xml @@ -0,0 +1,62 @@ + + + + 4.0.0 + org.apache.maven.plugin.release + parent-project + pom + 1.0-SNAPSHOT + parent-project + http://maven.apache.org + + scm:svn:file://localhost/${project.file.parentFile.parentFile}/target/svnroot/flat-multi-module/trunk/parent-project + scm:svn:file://localhost/${project.file.parentFile.parentFile}/target/svnroot/flat-multi-module/trunk/parent-project + + + + @maven.compiler.source@ + @maven.compiler.target@ + + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + + + + + + junit + junit + 3.8.1 + test + + + + ../module-a + ../module-b + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/parent-project/verify.bsh b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/parent-project/verify.bsh new file mode 100644 index 000000000..349b5ac6b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/flat-multi-module/parent-project/verify.bsh @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + File buildLog = new File( basedir, "build.log" ); + + System.out.println( "Checking logs.." ); + + StringBuffer data = new StringBuffer( 1024 ); + BufferedReader reader = new BufferedReader( new FileReader( buildLog ) ); + char[] buf = new char[1024]; + int numRead = 0; + while ( ( numRead = reader.read( buf ) ) != -1 ) + { + String readData = String.valueOf( buf, 0, numRead ); + data.append( readData ); + buf = new char[1024]; + } + reader.close(); + String contents = data.toString(); + + String expected1 = "Full run would tag working copy '" + basedir.getParentFile() + "'"; + String expected2 = " with label 'parent-project-1.0'"; + + if( contents.indexOf( expected1 ) != -1 && contents.indexOf( expected2 ) != -1 ) + { + return true; + } + expected2 = "module-b with label 'module-b-1.0'"; + + if( contents.indexOf( expected2 ) != -1 ) + { + return true; + } + expected2 = "module-a with label 'module-a-1.0'"; + + if( contents.indexOf( expected2 ) != -1 ) + { + return true; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +System.out.println( "FAILED!" ); +return false; diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/forked-basic/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/forked-basic/pom.xml new file mode 100644 index 000000000..b508dc37d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/forked-basic/pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + org.apache.maven.its.release + forked-basic + 1.0-SNAPSHOT + pom + + Maven Release Plugin IT + http://maven.apache.org/ + + + scm:dummy|nul + scm:dummy|nul + + + + + + maven-release-plugin + @project.version@ + + -Dflag -Dfoo=bar -D "maven.repo.local=@project.build.directory@/local-repo" + forked-path + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/invoker-basic/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/invoker-basic/pom.xml new file mode 100644 index 000000000..dbe895297 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/invoker-basic/pom.xml @@ -0,0 +1,55 @@ + + + + 4.0.0 + + org.apache.maven.its.release + invoker-basic + 1.0-SNAPSHOT + pom + + Maven Release Plugin IT + http://maven.apache.org/ + + + scm:dummy|nul + scm:dummy|nul + + + + + + maven-release-plugin + @project.version@ + + -Dflag -Dfoo=bar + invoker + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/invoker.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/invoker.properties new file mode 100644 index 000000000..43b6c5fcb --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = release:clean release:prepare \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/namespace/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/namespace/pom.xml new file mode 100644 index 000000000..3fee1089a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/namespace/pom.xml @@ -0,0 +1,60 @@ + + + + 4.0.0 + + org.apache.maven.its.release + completion-goals + 1.0-SNAPSHOT + pom + + Verify that schemaLocation keeps its original value + + Maven Release Plugin IT + http://maven.apache.org/ + + + scm:dummy|nul + scm:dummy|nul + + + + + + maven-release-plugin + @project.version@ + + -Dflag -Dfoo=bar + invoker + validate + validate + verify + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/namespace/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/namespace/verify.groovy new file mode 100644 index 000000000..da22596b3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/namespace/verify.groovy @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def project = new XmlSlurper().parse( new File( basedir, "pom.xml" ) ) +assert project['@xsi:schemaLocation'] == "http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd" + +def projectTag = new XmlSlurper().parse( new File( basedir, "pom.xml.tag" ) ) +assert projectTag['@xsi:schemaLocation'] == "http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd" + +def projectNext = new XmlSlurper().parse( new File( basedir, "pom.xml.next" ) ) +assert projectNext['@xsi:schemaLocation'] == "http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd" + +return true diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/oddeven-policy/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/oddeven-policy/pom.xml new file mode 100644 index 000000000..2d0e7d86b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/oddeven-policy/pom.xml @@ -0,0 +1,54 @@ + + + + 4.0.0 + org.apache.maven.plugin.release.it + oddversion-policy + 1.0-SNAPSHOT + + scm:dummy|nul + scm:dummy|nul + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + OddEvenVersionPolicy + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + org.apache.maven.release + maven-release-oddeven-policy + @project.version@ + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-a/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-a/pom.xml new file mode 100644 index 000000000..fa942cb22 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-a/pom.xml @@ -0,0 +1,40 @@ + + + + + regular-multi-module-project + org.apache.maven.plugin.release + 1.0-SNAPSHOT + + 4.0.0 + org.apache.maven.plugin.release + module-a + module-a + 1.0-SNAPSHOT + http://maven.apache.org + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-a/src/main/java/org/apache/maven/plugin/release/module/a/App.java b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-a/src/main/java/org/apache/maven/plugin/release/module/a/App.java new file mode 100644 index 000000000..05ca6ecab --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-a/src/main/java/org/apache/maven/plugin/release/module/a/App.java @@ -0,0 +1,32 @@ +package org.apache.maven.plugin.release.module.a; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-a/src/test/java/org/apache/maven/plugin/release/module/a/AppTest.java b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-a/src/test/java/org/apache/maven/plugin/release/module/a/AppTest.java new file mode 100644 index 000000000..ca41b5f53 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-a/src/test/java/org/apache/maven/plugin/release/module/a/AppTest.java @@ -0,0 +1,57 @@ +package org.apache.maven.plugin.release.module.a; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-b/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-b/pom.xml new file mode 100644 index 000000000..eafd261c4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-b/pom.xml @@ -0,0 +1,40 @@ + + + + + regular-multi-module-project + org.apache.maven.plugin.release + 1.0-SNAPSHOT + + 4.0.0 + org.apache.maven.plugin.release + module-b + module-b + 1.0-SNAPSHOT + http://maven.apache.org + + + junit + junit + 3.8.1 + test + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-b/src/main/java/org/apache/maven/plugin/release/module/b/App.java b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-b/src/main/java/org/apache/maven/plugin/release/module/b/App.java new file mode 100644 index 000000000..8d4d841d5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-b/src/main/java/org/apache/maven/plugin/release/module/b/App.java @@ -0,0 +1,32 @@ +package org.apache.maven.plugin.release.module.b; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-b/src/test/java/org/apache/maven/plugin/release/module/b/AppTest.java b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-b/src/test/java/org/apache/maven/plugin/release/module/b/AppTest.java new file mode 100644 index 000000000..c1a903ec4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/module-b/src/test/java/org/apache/maven/plugin/release/module/b/AppTest.java @@ -0,0 +1,57 @@ +package org.apache.maven.plugin.release.module.b; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/pom.xml new file mode 100644 index 000000000..083c8df6a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/pom.xml @@ -0,0 +1,62 @@ + + + + 4.0.0 + org.apache.maven.plugin.release + regular-multi-module-project + pom + 1.0-SNAPSHOT + parent-project + http://maven.apache.org + + scm:svn:file://localhost/${project.file.parentFile.parentFile}/target/svnroot/flat-multi-module/trunk/ + scm:svn:file://localhost/${project.file.parentFile.parentFile}/target/svnroot/flat-multi-module/trunk/ + + + + @maven.compiler.source@ + @maven.compiler.target@ + + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + + + + + + junit + junit + 3.8.1 + test + + + + module-a + module-b + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/verify.bsh b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/verify.bsh new file mode 100644 index 000000000..4fa1e0d3d --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/regular-multi-module/verify.bsh @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + File buildLog = new File( basedir, "build.log" ); + + System.out.println( "Checking logs.." ); + + StringBuffer data = new StringBuffer( 1024 ); + BufferedReader reader = new BufferedReader( new FileReader( buildLog ) ); + char[] buf = new char[1024]; + int numRead = 0; + while ( ( numRead = reader.read( buf ) ) != -1 ) + { + String readData = String.valueOf( buf, 0, numRead ); + data.append( readData ); + buf = new char[1024]; + } + reader.close(); + String contents = data.toString(); + + String expected1 = "Full run would tag working copy '" + basedir + "'"; + String expected2 = " with label 'regular-multi-module-project-1.0'"; + + if( contents.indexOf( expected1 ) != -1 && contents.indexOf( expected2 ) != -1 ) + { + return true; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +System.out.println( "FAILED!" ); +return false; diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/semver-policy/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/semver-policy/pom.xml new file mode 100644 index 000000000..df9eec731 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/prepare/semver-policy/pom.xml @@ -0,0 +1,54 @@ + + + + 4.0.0 + org.apache.maven.plugin.release.it + oddversion-policy + 1.0-SNAPSHOT + + scm:dummy|nul + scm:dummy|nul + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + SemVerVersionPolicy + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + org.apache.maven.release + maven-release-semver-policy + @project.version@ + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/module-a/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/module-a/pom.xml new file mode 100644 index 000000000..defc6bab8 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/module-a/pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-555 + 1.0-SNAPSHOT + + + module-a + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/module-b/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/module-b/pom.xml new file mode 100644 index 000000000..96d119319 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/module-b/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-555 + 1.0-SNAPSHOT + + module-b + 1.0-SNAPSHOT + + + + org.apache.maven.plugin.release.its + module-a + 1.0-SNAPSHOT + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/pom.xml new file mode 100644 index 000000000..7915866be --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + org.apache.maven.plugin.release.its + mrelease-555 + pom + 1.0-SNAPSHOT + + http://jira.codehaus.org/browse/MRELEASE-555 + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + + + + + module-a + module-b + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/verify.groovy new file mode 100644 index 000000000..e1d930373 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/verify.groovy @@ -0,0 +1,28 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +def projectRoot = new XmlSlurper().parse( new File( basedir, "module-b/pom.xml" ) ) + +assert projectRoot.dependencies.dependency.version.text() == "1.1-SNAPSHOT" + +return true \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-611/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-611/pom.xml new file mode 100644 index 000000000..67a2b403a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-611/pom.xml @@ -0,0 +1,41 @@ + + + + 4.0.0 + + org.apache.maven.its.release + mrelease-661 + 1.0 + pom + + http://jira.codehaus.org/browse/MRELEASE-611 + + Ensure you can update from a non-SNAPSHOT project + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-611/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-611/verify.groovy new file mode 100644 index 000000000..369c62546 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-611/verify.groovy @@ -0,0 +1,28 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +def projectRoot = new XmlSlurper().parse( new File( basedir, "pom.xml" ) ) + +assert projectRoot.version.text() == "1.1-SNAPSHOT" + +return true \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-783/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-783/pom.xml new file mode 100644 index 000000000..9b5abcece --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-783/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + org.apache.maven.its.release + mrelease-783 + 1.0-SNAPSHOT + pom + + Maven Release Plugin IT + http://maven.apache.org/ + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/pom.xml new file mode 100644 index 000000000..fc9693f7a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/pom.xml @@ -0,0 +1,47 @@ + + + + 4.0.0 + org.apache.maven.plugin.release.it + mrelease-976 + 1.0-SNAPSHOT + https://issues.apache.org/jira/browse/MRELEASE-976 + Tests that release:update-versions supports setting a custom projectVersionPolicyId + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + StubVersionPolicy + + + + org.apache.maven.its.release + maven-project-version-stub-policy + 1.0 + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/verify.groovy b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/verify.groovy new file mode 100644 index 000000000..350012e31 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/verify.groovy @@ -0,0 +1,25 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// verifies that the version is unchanged because of the custom policy: 1.0-SNAPSHOT -> 1.0 -> 1.0-SNAPSHOT +def project = new XmlSlurper().parse( new File( basedir, "pom.xml" ) ) +assert project.version.text() == "1.0-SNAPSHOT" + +return true diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/invoker.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/invoker.properties new file mode 100644 index 000000000..a567a5836 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/projects/update-versions/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = release:clean release:update-versions \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-naming-stub-policy/invoker.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-naming-stub-policy/invoker.properties new file mode 100644 index 000000000..97189ec2e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-naming-stub-policy/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = install diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-naming-stub-policy/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-naming-stub-policy/pom.xml new file mode 100644 index 000000000..5a5a96edb --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-naming-stub-policy/pom.xml @@ -0,0 +1,61 @@ + + + + + 4.0.0 + + org.apache.maven.its.release + maven-project-naming-stub-policy + 1.0 + + + + org.apache.maven.release + maven-release-manager + @project.version@ + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + UTF-8 + + + + org.codehaus.plexus + plexus-component-metadata + 1.7.1 + + + process-classes + + generate-metadata + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-naming-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/StubNamingPolicy.java b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-naming-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/StubNamingPolicy.java new file mode 100644 index 000000000..d784a5bdd --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-naming-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/StubNamingPolicy.java @@ -0,0 +1,38 @@ +package org.apache.maven.shared.release.policy.stub; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.policy.naming.NamingPolicy; +import org.apache.maven.shared.release.policy.naming.NamingPolicyRequest; +import org.apache.maven.shared.release.policy.naming.NamingPolicyResult; + +import org.codehaus.plexus.component.annotations.Component; + +@Component( role = NamingPolicy.class, hint = "StubNamingPolicy" ) +public final class StubNamingPolicy + implements NamingPolicy +{ + + public NamingPolicyResult getName( NamingPolicyRequest request ) + { + return new NamingPolicyResult().setName( "STUB" ); + } + +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/invoker.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/invoker.properties new file mode 100644 index 000000000..97189ec2e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = install diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/pom.xml new file mode 100644 index 000000000..9d3852782 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/pom.xml @@ -0,0 +1,66 @@ + + + + + 4.0.0 + + org.apache.maven.its.release + maven-project-version-stub-policy + 1.0 + + Maven Release Stub Policy + + Provides a project version policy that switches between snapshot and release version. + + + + + org.apache.maven.release + maven-release-manager + @project.version@ + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + UTF-8 + + + + org.codehaus.plexus + plexus-component-metadata + 1.7.1 + + + process-classes + + generate-metadata + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/StubVersionPolicy.java b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/StubVersionPolicy.java new file mode 100644 index 000000000..deea559d5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/StubVersionPolicy.java @@ -0,0 +1,45 @@ +package org.apache.maven.shared.release.policy.stub; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.policy.version.VersionPolicy; +import org.apache.maven.shared.release.policy.version.VersionPolicyRequest; +import org.apache.maven.shared.release.policy.version.VersionPolicyResult; +import org.codehaus.plexus.component.annotations.Component; + +/** + * A {@link VersionPolicy} implementation that switches continously between shapsnot and release version. + */ +@Component( role = VersionPolicy.class, hint = "StubVersionPolicy" ) +public final class StubVersionPolicy + implements VersionPolicy +{ + + public VersionPolicyResult getReleaseVersion( VersionPolicyRequest request ) + { + return new VersionPolicyResult().setVersion( request.getVersion().replace( "-SNAPSHOT", "" ) ); + } + + public VersionPolicyResult getDevelopmentVersion( VersionPolicyRequest request ) + { + return new VersionPolicyResult().setVersion( request.getVersion().replace( "-SNAPSHOT", "" ) + "-SNAPSHOT" ); + } + +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/invoker.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/invoker.properties new file mode 100644 index 000000000..97189ec2e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = install diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/pom.xml new file mode 100644 index 000000000..9cfbe221f --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/pom.xml @@ -0,0 +1,63 @@ + + + + + 4.0.0 + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + Maven SCM Dummy Provider + Does nothing but telling the Release Plugin that the working copy is up-to-date. + + + + org.apache.maven.scm + maven-scm-api + 1.1 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + UTF-8 + + + + org.codehaus.plexus + plexus-maven-plugin + 1.3.8 + + + + descriptor + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/src/main/java/org/apache/maven/scm/provider/dummy/DummyScmProvider.java b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/src/main/java/org/apache/maven/scm/provider/dummy/DummyScmProvider.java new file mode 100644 index 000000000..c11540350 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/src/main/java/org/apache/maven/scm/provider/dummy/DummyScmProvider.java @@ -0,0 +1,59 @@ +package org.apache.maven.scm.provider.dummy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.CommandParameters; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.command.status.StatusScmResult; +import org.apache.maven.scm.provider.AbstractScmProvider; +import org.apache.maven.scm.provider.ScmProviderRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; + +/** + * A dummy SCM provider used to bypass the {@code ScmCheckModificationsPhase} of the Release Plugin when doing a dry run + * for integration testing. + * + * @plexus.component role="org.apache.maven.scm.provider.ScmProvider" role-hint="dummy" + * @author Benjamin Bentmann + * @version $Id$ + */ +public class DummyScmProvider + extends AbstractScmProvider +{ + + public String getScmType() + { + return "dummy"; + } + + public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter ) + throws ScmRepositoryException + { + return new DummyScmProviderRepository(); + } + + protected StatusScmResult status( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters ) + throws ScmException + { + return new StatusScmResult( "", "", "", true ); + } + +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/src/main/java/org/apache/maven/scm/provider/dummy/DummyScmProviderRepository.java b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/src/main/java/org/apache/maven/scm/provider/dummy/DummyScmProviderRepository.java new file mode 100644 index 000000000..7ad6faac9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-dummy/src/main/java/org/apache/maven/scm/provider/dummy/DummyScmProviderRepository.java @@ -0,0 +1,37 @@ +package org.apache.maven.scm.provider.dummy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.provider.ScmProviderRepository; + +/** + * A dummy SCM repository used to bypass the {@code ScmCheckModificationsPhase} of the Release Plugin when doing a dry + * run for integration testing. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class DummyScmProviderRepository + extends ScmProviderRepository +{ + + // empty by design + +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/invoker.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/invoker.properties new file mode 100644 index 000000000..97189ec2e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = install diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/pom.xml new file mode 100644 index 000000000..26cef6f39 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/pom.xml @@ -0,0 +1,65 @@ + + + + + 4.0.0 + + org.apache.maven.its.release + maven-scm-provider-stub + 1.0 + + Maven SCM Stub Provider + + Provides a minimal, file-based SCM provider to test the SCM operations of the Maven Release Plugin. + + + + + org.apache.maven.scm + maven-scm-api + 1.1 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + UTF-8 + + + + org.codehaus.plexus + plexus-maven-plugin + 1.3.8 + + + + descriptor + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubBranchCommand.java b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubBranchCommand.java new file mode 100644 index 000000000..4d8f9633a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubBranchCommand.java @@ -0,0 +1,49 @@ +package org.apache.maven.scm.provider.stub; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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 org.apache.maven.scm.CommandParameters; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmResult; +import org.apache.maven.scm.command.AbstractCommand; +import org.apache.maven.scm.command.branch.BranchScmResult; +import org.apache.maven.scm.provider.ScmProviderRepository; + +/** + * A dummy branch command. + * + * @author Peter Janes + * @version $Id$ + */ +class StubBranchCommand + extends AbstractCommand +{ + + protected ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet, + CommandParameters parameters ) + throws ScmException + { + return new BranchScmResult( null, new ArrayList() ); + } + +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubCheckInCommand.java b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubCheckInCommand.java new file mode 100644 index 000000000..86e453fde --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubCheckInCommand.java @@ -0,0 +1,107 @@ +package org.apache.maven.scm.provider.stub; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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 org.apache.maven.scm.CommandParameters; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmFileStatus; +import org.apache.maven.scm.ScmResult; +import org.apache.maven.scm.command.AbstractCommand; +import org.apache.maven.scm.command.checkin.CheckInScmResult; +import org.apache.maven.scm.provider.ScmProviderRepository; +import org.codehaus.plexus.util.FileUtils; + +/** + * A dummy check-in command. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +class StubCheckInCommand + extends AbstractCommand +{ + + protected ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet, + CommandParameters parameters ) + throws ScmException + { + List checkedInFiles = new ArrayList(); + + try + { + StubScmProviderRepository stubRepo = (StubScmProviderRepository) repository; + + File workingCopyRoot = stubRepo.getWorkingCopyRoot( fileSet ); + File repoRoot = stubRepo.getRoot(); + + getLogger().info( "Committing: " + workingCopyRoot + " > " + repoRoot ); + + List paths = stubRepo.getPaths( workingCopyRoot, fileSet ); + + for ( Iterator it = paths.iterator(); it.hasNext(); ) + { + String path = (String) it.next(); + File srcFile = new File( workingCopyRoot, path ); + File dstFile = new File( repoRoot, path ); + + getLogger().info( " " + path ); + + if ( dstFile.isDirectory() ) + { + if ( !srcFile.isDirectory() ) + { + throw new IOException( "Cannot commit a normal file to a directory: " + srcFile + " -> " + + dstFile ); + } + } + else if ( dstFile.isFile() ) + { + if ( !srcFile.isFile() ) + { + throw new IOException( "Cannot commit a directory to a normal file: " + srcFile + " -> " + + dstFile ); + } + FileUtils.copyFile( srcFile, dstFile ); + } + else + { + throw new IOException( "Cannot commit to non-existing location: " + srcFile + " -> " + dstFile ); + } + + checkedInFiles.add( new ScmFile( path, ScmFileStatus.CHECKED_IN ) ); + } + } + catch ( IOException e ) + { + throw new ScmException( "Error while checking in the files.", e ); + } + + return new CheckInScmResult( null, checkedInFiles ); + } + +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubCheckOutCommand.java b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubCheckOutCommand.java new file mode 100644 index 000000000..e2284fc88 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubCheckOutCommand.java @@ -0,0 +1,130 @@ +package org.apache.maven.scm.provider.stub; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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 org.apache.maven.scm.CommandParameter; +import org.apache.maven.scm.CommandParameters; +import org.apache.maven.scm.ScmBranch; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmFileStatus; +import org.apache.maven.scm.ScmResult; +import org.apache.maven.scm.ScmTag; +import org.apache.maven.scm.ScmVersion; +import org.apache.maven.scm.command.AbstractCommand; +import org.apache.maven.scm.command.checkout.CheckOutScmResult; +import org.apache.maven.scm.provider.ScmProviderRepository; +import org.codehaus.plexus.util.FileUtils; + +/** + * A dummy check-out command. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +class StubCheckOutCommand + extends AbstractCommand +{ + + protected ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet, + CommandParameters parameters ) + throws ScmException + { + List checkedOutFiles = new ArrayList(); + + try + { + StubScmProviderRepository stubRepo = (StubScmProviderRepository) repository; + + File workingCopyRoot = fileSet.getBasedir(); + ScmVersion version = parameters.getScmVersion( CommandParameter.SCM_VERSION ); + File revRoot; + if ( version instanceof ScmTag ) + { + revRoot = new File( stubRepo.getTagBase(), version.getName() ); + } + else if ( version instanceof ScmBranch ) + { + revRoot = new File( stubRepo.getBranchBase(), version.getName() ); + } + else + { + revRoot = stubRepo.getRoot(); + } + + getLogger().info( "Checking out: " + revRoot + " > " + workingCopyRoot ); + + if ( workingCopyRoot.isFile() ) + { + throw new IOException( "Cannot check out into exising file" ); + } + if ( workingCopyRoot.isDirectory() && workingCopyRoot.list().length > 0 ) + { + throw new IOException( "Cannot check out into non-empty directory" ); + } + + List paths = stubRepo.getPaths( workingCopyRoot, fileSet ); + if ( paths.isEmpty() ) + { + paths.add( "." ); + } + + new File( workingCopyRoot, StubScmProviderRepository.WORKING_COPY_ROOT_MARKER_FILE ).createNewFile(); + + for ( Iterator it = paths.iterator(); it.hasNext(); ) + { + String path = (String) it.next(); + File srcFile = new File( revRoot, path ); + File dstFile = new File( workingCopyRoot, path ); + + getLogger().info( " " + path ); + + if ( srcFile.isDirectory() ) + { + FileUtils.copyDirectoryStructure( srcFile, dstFile ); + } + else if ( srcFile.isFile() ) + { + FileUtils.copyFile( srcFile, dstFile ); + } + else + { + throw new IOException( "Cannot check out non-existing file: " + srcFile ); + } + + checkedOutFiles.add( new ScmFile( path, ScmFileStatus.CHECKED_OUT ) ); + } + } + catch ( IOException e ) + { + throw new ScmException( "Error while checking out the files.", e ); + } + + return new CheckOutScmResult( null, checkedOutFiles ); + } + +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubScmProvider.java b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubScmProvider.java new file mode 100644 index 000000000..7afbcee44 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubScmProvider.java @@ -0,0 +1,100 @@ +package org.apache.maven.scm.provider.stub; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.scm.CommandParameters; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmResult; +import org.apache.maven.scm.command.Command; +import org.apache.maven.scm.command.branch.BranchScmResult; +import org.apache.maven.scm.command.checkin.CheckInScmResult; +import org.apache.maven.scm.command.checkout.CheckOutScmResult; +import org.apache.maven.scm.command.status.StatusScmResult; +import org.apache.maven.scm.command.tag.TagScmResult; +import org.apache.maven.scm.provider.AbstractScmProvider; +import org.apache.maven.scm.provider.ScmProviderRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; + +/** + * A stub SCM provider used for the Maven Release Plugin when doing integration testing. + * + * @plexus.component role="org.apache.maven.scm.provider.ScmProvider" role-hint="stub" + * @author Benjamin Bentmann + * @version $Id$ + */ +public class StubScmProvider + extends AbstractScmProvider +{ + + public String getScmType() + { + return "stub"; + } + + public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter ) + throws ScmRepositoryException + { + return new StubScmProviderRepository( scmSpecificUrl ); + } + + protected ScmResult executeCommand( Command command, ScmProviderRepository repository, ScmFileSet fileSet, + CommandParameters parameters ) + throws ScmException + { + command.setLogger( getLogger() ); + + return command.execute( repository, fileSet, parameters ); + } + + protected StatusScmResult status( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters ) + throws ScmException + { + return (StatusScmResult) executeCommand( new StubStatusCommand(), repository, fileSet, parameters ); + } + + protected CheckInScmResult checkin( ScmProviderRepository repository, ScmFileSet fileSet, + CommandParameters parameters ) + throws ScmException + { + return (CheckInScmResult) executeCommand( new StubCheckInCommand(), repository, fileSet, parameters ); + } + + protected CheckOutScmResult checkout( ScmProviderRepository repository, ScmFileSet fileSet, + CommandParameters parameters ) + throws ScmException + { + return (CheckOutScmResult) executeCommand( new StubCheckOutCommand(), repository, fileSet, parameters ); + } + + protected BranchScmResult branch( ScmProviderRepository repository, ScmFileSet fileSet, + CommandParameters parameters ) + throws ScmException + { + return (BranchScmResult) executeCommand( new StubBranchCommand(), repository, fileSet, parameters ); + } + + protected TagScmResult tag( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters ) + throws ScmException + { + return (TagScmResult) executeCommand( new StubTagCommand(), repository, fileSet, parameters ); + } + +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubScmProviderRepository.java b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubScmProviderRepository.java new file mode 100644 index 000000000..df6c24219 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubScmProviderRepository.java @@ -0,0 +1,163 @@ +package org.apache.maven.scm.provider.stub; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.Collection; +import java.util.Iterator; +import java.util.List; + +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.provider.ScmProviderRepository; + +/** + * A stub SCM repository used for the Maven Release Plugin when doing integration testing. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +class StubScmProviderRepository + extends ScmProviderRepository +{ + + /** + * The root directory of the remote copy that corresponds to the root directory of the working copy. + */ + private File root; + + /** + * The root directory to create tags in. This path is derived from the root directory, assuming SVN conventions. + */ + private File tagBase; + + /** + * The root directory to create branches in. This path is derived from the root directory, assuming SVN conventions. + */ + private File branchBase; + + /** + * The simple name of the file used to mark the root directory of the working copy. + */ + static final String WORKING_COPY_ROOT_MARKER_FILE = "_base.properties"; + + public StubScmProviderRepository( String url ) + { + root = new File( url ).getAbsoluteFile(); + initTagBranchBase(); + } + + private void initTagBranchBase() + { + File base; + for ( base = root; base != null; base = base.getParentFile() ) + { + if ( "trunk".equals( base.getName() ) ) + { + base = base.getParentFile(); + break; + } + } + if ( base == null ) + { + base = root.getParentFile(); + } + tagBase = new File( base, "tags" ); + branchBase = new File( base, "branches" ); + } + + public File getRoot() + { + return root; + } + + public File getTagBase() + { + return tagBase; + } + + public File getBranchBase() + { + return branchBase; + } + + public List getPaths( File workingCopyRoot, ScmFileSet fileSet ) + { + List paths = new ArrayList(); + + Collection files = fileSet.getFileList(); + if ( files != null && !files.isEmpty() ) + { + for ( Iterator it = files.iterator(); it.hasNext(); ) + { + File file = (File) it.next(); + if ( !file.isAbsolute() ) + { + file = new File( fileSet.getBasedir(), file.getPath() ); + } + + String path = getPath( workingCopyRoot, file ); + paths.add( path ); + } + } + + return paths; + } + + private String getPath( File root, File file ) + { + StringBuffer path = new StringBuffer( 256 ); + + for ( File parent = file; !root.equals( parent ); ) + { + if ( path.length() > 0 ) + { + path.insert( 0, '/' ); + } + path.insert( 0, parent.getName() ); + + parent = parent.getParentFile(); + if ( parent == null ) + { + throw new IllegalArgumentException( "Cannot relativize " + file + " against " + root ); + } + } + + return path.toString(); + } + + public File getWorkingCopyRoot( ScmFileSet fileSet ) + { + for ( File root = fileSet.getBasedir(); root != null; root = root.getParentFile() ) + { + if ( new File( root, WORKING_COPY_ROOT_MARKER_FILE ).isFile() ) + { + return root; + } + } + throw new IllegalArgumentException( "SCM file set is not part of stub working copy: " + fileSet ); + } + + public String toString() + { + return "StubScmProviderRepository[root=" + root + ", tags=" + tagBase + ", branches=" + branchBase + "]"; + } + +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubStatusCommand.java b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubStatusCommand.java new file mode 100644 index 000000000..0b4f8c4e9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubStatusCommand.java @@ -0,0 +1,52 @@ +package org.apache.maven.scm.provider.stub; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.scm.CommandParameters; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmResult; +import org.apache.maven.scm.command.AbstractCommand; +import org.apache.maven.scm.command.status.StatusScmResult; +import org.apache.maven.scm.provider.ScmProviderRepository; + +/** + * A dummy status command. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +class StubStatusCommand + extends AbstractCommand +{ + + protected ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet, + CommandParameters parameters ) + throws ScmException + { + List changedFiles = new ArrayList(); + + return new StatusScmResult( null, changedFiles ); + } + +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubTagCommand.java b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubTagCommand.java new file mode 100644 index 000000000..d44ed8c89 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-scm-provider-stub/src/main/java/org/apache/maven/scm/provider/stub/StubTagCommand.java @@ -0,0 +1,110 @@ +package org.apache.maven.scm.provider.stub; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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 org.apache.maven.scm.CommandParameter; +import org.apache.maven.scm.CommandParameters; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmFileStatus; +import org.apache.maven.scm.ScmResult; +import org.apache.maven.scm.command.AbstractCommand; +import org.apache.maven.scm.command.tag.TagScmResult; +import org.apache.maven.scm.provider.ScmProviderRepository; +import org.codehaus.plexus.util.FileUtils; + +/** + * A dummy tag command. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +class StubTagCommand + extends AbstractCommand +{ + + protected ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet, + CommandParameters parameters ) + throws ScmException + { + List taggedFiles = new ArrayList(); + + try + { + StubScmProviderRepository stubRepo = (StubScmProviderRepository) repository; + + File workingCopyRoot = stubRepo.getWorkingCopyRoot( fileSet ); + File repoRoot = stubRepo.getRoot(); + String tagName = parameters.getString( CommandParameter.TAG_NAME ); + File tagRoot = new File( stubRepo.getTagBase(), tagName ); + + getLogger().info( "Tagging: " + repoRoot + " > " + tagRoot ); + + if ( tagRoot.exists() ) + { + throw new IOException( "Cannot override existing tag" ); + } + + List paths = stubRepo.getPaths( workingCopyRoot, fileSet ); + if ( paths.isEmpty() ) + { + paths.add( "." ); + } + + for ( Iterator it = paths.iterator(); it.hasNext(); ) + { + String path = (String) it.next(); + File srcFile = new File( repoRoot, path ); + File dstFile = new File( tagRoot, path ); + + getLogger().info( " " + path ); + + if ( srcFile.isDirectory() ) + { + FileUtils.copyDirectoryStructure( srcFile, dstFile ); + } + else if ( srcFile.isFile() ) + { + FileUtils.copyFile( srcFile, dstFile ); + } + else + { + throw new IOException( "Cannot tag non-existing file: " + srcFile ); + } + + taggedFiles.add( new ScmFile( path, ScmFileStatus.TAGGED ) ); + } + } + catch ( IOException e ) + { + throw new ScmException( "Error while tagging the files.", e ); + } + + return new TagScmResult( null, taggedFiles ); + } + +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/invoker.properties b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/invoker.properties new file mode 100644 index 000000000..97189ec2e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = install diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/pom.xml b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/pom.xml new file mode 100644 index 000000000..b2d9a0e15 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/pom.xml @@ -0,0 +1,65 @@ + + + + + 4.0.0 + + org.apache.maven.its.release + wagon-provider-dummy + 1.0 + + Maven Wagon Dummy Provider + + Provides a minimal Wagon provider to test the deploy operations of the Maven Release Plugin. + + + + + org.apache.maven.wagon + wagon-provider-api + 2.2 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + UTF-8 + + + + org.codehaus.plexus + plexus-maven-plugin + 1.3.8 + + + + descriptor + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/org/apache/maven/wagon/providers/dummy/DummyWagonProvider.java b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/org/apache/maven/wagon/providers/dummy/DummyWagonProvider.java new file mode 100644 index 000000000..daa2b3a53 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/it/setup/maven-wagon-provider-dummy/src/main/java/org/apache/maven/wagon/providers/dummy/DummyWagonProvider.java @@ -0,0 +1,183 @@ +package org.apache.maven.wagon.providers.dummy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.wagon.ConnectionException; +import org.apache.maven.wagon.ResourceDoesNotExistException; +import org.apache.maven.wagon.TransferFailedException; +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.SessionListener; +import org.apache.maven.wagon.events.TransferListener; +import org.apache.maven.wagon.proxy.ProxyInfo; +import org.apache.maven.wagon.proxy.ProxyInfoProvider; +import org.apache.maven.wagon.repository.Repository; + +/** + * DummyWagonProvider which does absolutely nothing + * + * @author Robert Scholte + * + * @plexus.component role="org.apache.maven.wagon.Wagon" role-hint="dummy" instantiation-strategy="per-lookup" + */ +public class DummyWagonProvider implements Wagon +{ + + public void get( String resourceName, File destination ) + throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException + { + } + + public boolean getIfNewer( String resourceName, File destination, long timestamp ) + throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException + { + return false; + } + + public void put( File source, String destination ) + throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException + { + } + + public void putDirectory( File sourceDirectory, String destinationDirectory ) + throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException + { + } + + public boolean resourceExists( String resourceName ) + throws TransferFailedException, AuthorizationException + { + return false; + } + + public List getFileList( String destinationDirectory ) + throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException + { + return null; + } + + public boolean supportsDirectoryCopy() + { + return false; + } + + public Repository getRepository() + { + return null; + } + + public void connect( Repository source ) + throws ConnectionException, AuthenticationException + { + } + + public void connect( Repository source, ProxyInfo proxyInfo ) + throws ConnectionException, AuthenticationException + { + } + + public void connect( Repository source, ProxyInfoProvider proxyInfoProvider ) + throws ConnectionException, AuthenticationException + { + } + + public void connect( Repository source, AuthenticationInfo authenticationInfo ) + throws ConnectionException, AuthenticationException + { + } + + public void connect( Repository source, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo ) + throws ConnectionException, AuthenticationException + { + } + + public void connect( Repository source, AuthenticationInfo authenticationInfo, ProxyInfoProvider proxyInfoProvider ) + throws ConnectionException, AuthenticationException + { + } + + public void openConnection() + throws ConnectionException, AuthenticationException + { + } + + public void disconnect() + throws ConnectionException + { + } + + public void setTimeout( int timeoutValue ) + { + } + + public int getTimeout() + { + return 0; + } + + public void setReadTimeout( int timeoutValue ) + { + } + + public int getReadTimeout() + { + return 0; + } + + public void addSessionListener( SessionListener listener ) + { + } + + public void removeSessionListener( SessionListener listener ) + { + } + + public boolean hasSessionListener( SessionListener listener ) + { + return false; + } + + public void addTransferListener( TransferListener listener ) + { + } + + public void removeTransferListener( TransferListener listener ) + { + } + + public boolean hasTransferListener( TransferListener listener ) + { + return false; + } + + public boolean isInteractive() + { + return false; + } + + public void setInteractive( boolean interactive ) + { + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java new file mode 100644 index 000000000..5a4ded431 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java @@ -0,0 +1,305 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.apache.maven.settings.Settings; +import org.apache.maven.shared.release.ReleaseManager; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.codehaus.plexus.util.StringUtils; + +/** + * Base class with shared configuration. + * + * @author Brett Porter + * @version $Id$ + */ +public abstract class AbstractReleaseMojo + extends AbstractMojo +{ + /** + */ + @Parameter( defaultValue = "${basedir}", readonly = true, required = true ) + private File basedir; + + /** + */ + @Parameter( defaultValue = "${settings}", readonly = true, required = true ) + private Settings settings; + + /** + */ + @Parameter( defaultValue = "${project}", readonly = true, required = true ) + protected MavenProject project; + + /** + */ + @Component + protected ReleaseManager releaseManager; + + /** + * Additional arguments to pass to the Maven executions, separated by spaces. + */ + @Parameter( alias = "prepareVerifyArgs", property = "arguments" ) + private String arguments; + + /** + * The file name of the POM to execute any goals against. As of version 3.0.0, this defaults to the name of + * POM file of the project being built. + */ + @Parameter( property = "pomFileName", defaultValue = "${project.file.name}" ) + private String pomFileName; + + /** + */ + @Parameter( defaultValue = "${reactorProjects}", readonly = true, required = true ) + private List reactorProjects; + + /** + * The {@code M2_HOME} parameter to use for forked Maven invocations. + * + * @since 2.0-beta-8 + */ + @Parameter( defaultValue = "${maven.home}" ) + private File mavenHome; + + /** + * The {@code JAVA_HOME} parameter to use for forked Maven invocations. + * + * @since 2.0-beta-8 + */ + @Parameter( defaultValue = "${java.home}" ) + private File javaHome; + + /** + * The command-line local repository directory in use for this build (if specified). + * + * @since 2.0-beta-8 + */ + @Parameter ( defaultValue = "${maven.repo.local}" ) + private File localRepoDirectory; + + /** + * Role hint of the {@link org.apache.maven.shared.release.exec.MavenExecutor} implementation to use. + * + * @since 2.0-beta-8 + */ + @Parameter( defaultValue = "invoker", property = "mavenExecutorId" ) + private String mavenExecutorId; + + /** + * @since 2.0 + */ + @Parameter( defaultValue = "${session}", readonly = true, required = true ) + protected MavenSession session; + + /** + * The role-hint for the {@link org.apache.maven.shared.release.strategy.Strategy} + * implementation used to specify the phases per goal. + * + * @since 3.0.0 + * @see org.apache.maven.shared.release.strategies.DefaultStrategy + */ + @Parameter( defaultValue = "default", property = "releaseStrategyId" ) + private String releaseStrategyId; + + /** + * Gets the environment settings configured for this release. + * + * @return The release environment, never null. + */ + protected ReleaseEnvironment getReleaseEnvironment() + { + return new DefaultReleaseEnvironment().setSettings( settings ) + .setJavaHome( javaHome ) + .setMavenHome( mavenHome ) + .setLocalRepositoryDirectory( localRepoDirectory ) + .setMavenExecutorId( mavenExecutorId ); + } + + /** + * Creates the release descriptor from the various goal parameters. + * + * @return The release descriptor, never null. + */ + protected ReleaseDescriptorBuilder createReleaseDescriptor() + { + ReleaseDescriptorBuilder descriptor = new ReleaseDescriptorBuilder(); + + descriptor.setInteractive( settings.isInteractiveMode() ); + + Path workingDirectory; + try + { + workingDirectory = getCommonBasedir( reactorProjects ); + } + catch ( IOException e ) + { + throw new RuntimeException( e.getMessage() ); + } + descriptor.setWorkingDirectory( workingDirectory.toFile().getAbsolutePath() ); + + Path rootBasedir = basedir.toPath(); + if ( rootBasedir.equals( workingDirectory ) ) + { + descriptor.setPomFileName( pomFileName ); + } + else + { + descriptor.setPomFileName( workingDirectory.relativize( rootBasedir ).resolve( pomFileName ).toString() ); + } + + for ( MavenProject project : reactorProjects ) + { + String versionlessKey = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ); + descriptor.putOriginalVersion( versionlessKey, project.getVersion() ); + } + + descriptor.setAdditionalArguments( this.arguments ); + + List profileIds = session.getRequest().getActiveProfiles(); + String additionalProfiles = getAdditionalProfiles(); + + if ( !profileIds.isEmpty() || StringUtils.isNotBlank( additionalProfiles ) ) + { + List profiles = new ArrayList<>( profileIds ); + + if ( additionalProfiles != null ) + { + profiles.addAll( Arrays.asList( additionalProfiles.split( "," ) ) ); + } + + descriptor.setActivateProfiles( profiles ); + } + + descriptor.setReleaseStrategyId( releaseStrategyId ); + + return descriptor; + } + + /** + * Gets the comma separated list of additional profiles for the release build. + * + * @return additional profiles to enable during release + */ + protected String getAdditionalProfiles() + { + return null; + } + + /** + * Sets the component used to perform release actions. + * + * @param releaseManager The release manager implementation to use, must not be null. + */ + void setReleaseManager( ReleaseManager releaseManager ) + { + this.releaseManager = releaseManager; + } + + /** + * Gets the effective settings for this build. + * + * @return The effective settings for this build, never null. + */ + Settings getSettings() + { + return settings; + } + + protected final File getBasedir() + { + return basedir; + } + + /** + * Sets the base directory of the build. + * + * @param basedir The build's base directory, must not be null. + */ + public void setBasedir( File basedir ) + { + this.basedir = basedir; + } + + public void setPomFileName( String pomFileName ) + { + this.pomFileName = pomFileName; + } + + /** + * Gets the list of projects in the build reactor. + * + * @return The list of reactor project, never null. + */ + public List getReactorProjects() + { + return reactorProjects; + } + + /** + * Add additional arguments. + * + * @param argument The argument to add, must not be null. + */ + protected void addArgument( String argument ) + { + if ( arguments != null ) + { + arguments += " " + argument; + } + else + { + arguments = argument; + } + } + + static Path getCommonBasedir( List reactorProjects ) + throws IOException + { + Path basePath = reactorProjects.get( 0 ).getBasedir().toPath(); + + for ( MavenProject reactorProject : reactorProjects ) + { + Path matchPath = reactorProject.getBasedir().toPath(); + while ( !basePath.startsWith( matchPath ) ) + { + matchPath = matchPath.getParent(); + } + basePath = matchPath; + } + + return basePath; + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractScmReleaseMojo.java b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractScmReleaseMojo.java new file mode 100644 index 000000000..6804603b2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractScmReleaseMojo.java @@ -0,0 +1,202 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.ArtifactUtils; +import org.apache.maven.model.Scm; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; + +/** + * Abstract Mojo containing SCM parameters + * + * @author Robert Scholte + */ +// Extra layer since 2.4. Don't use @since doclet, these would be inherited by the subclasses +public abstract class AbstractScmReleaseMojo + extends AbstractReleaseMojo +{ + /** + * The SCM username to use. + */ + @Parameter( property = "username" ) + private String username; + + /** + * The SCM password to use. + */ + @Parameter( property = "password" ) + private String password; + + /** + * The SCM tag to use. + */ + @Parameter( alias = "releaseLabel", property = "tag" ) + private String tag; + + /** + * Format to use when generating the tag name if none is specified. Property interpolation is performed on the + * tag, but in order to ensure that the interpolation occurs during release, you must use @{...} + * to reference the properties rather than ${...}. The following properties are available: + *
      + *
    • groupId or project.groupId - The groupId of the root project. + *
    • artifactId or project.artifactId - The artifactId of the root project. + *
    • version or project.version - The release version of the root project. + *
    + * + * @since 2.2.0 + */ + @Parameter( defaultValue = "@{project.artifactId}-@{project.version}", property = "tagNameFormat" ) + private String tagNameFormat; + + /** + * The tag base directory in SVN, you must define it if you don't use the standard svn layout (trunk/tags/branches). + * For example, http://svn.apache.org/repos/asf/maven/plugins/tags. The URL is an SVN URL and does not + * include the SCM provider and protocol. + */ + @Parameter( property = "tagBase" ) + private String tagBase; + + /** + * The message prefix to use for all SCM changes. + * + * @since 2.0-beta-5 + */ + @Parameter( defaultValue = "[maven-release-plugin] ", property = "scmCommentPrefix" ) + private String scmCommentPrefix; + + /** + * Implemented with git will or not push changes to the upstream repository. + * true by default to preserve backward compatibility. + * @since 2.1 + */ + @Parameter( defaultValue = "true", property = "pushChanges" ) + private boolean pushChanges = true; + + /** + * A workItem for SCMs like RTC, TFS etc, that may require additional + * information to perform a pushChange operation. + * + * @since 3.0.0 + */ + @Parameter( property = "workItem" ) + private String workItem; + + /** + * Add a new or overwrite the default implementation per provider. + * The key is the scm prefix and the value is the role hint of the + * {@link org.apache.maven.scm.provider.ScmProvider}. + * + * @since 2.0-beta-6 + * @see ScmManager#setScmProviderImplementation(String, String) + */ + @Parameter + private Map providerImplementations; + + /** + * The SCM manager. + */ + @Component + private ScmManager scmManager; + + @Override + public void execute() + throws MojoExecutionException, MojoFailureException + { + if ( providerImplementations != null ) + { + for ( Map.Entry providerEntry : providerImplementations.entrySet() ) + { + getLog().info( "Change the default '" + providerEntry.getKey() + "' provider implementation to '" + + providerEntry.getValue() + "'." ); + scmManager.setScmProviderImplementation( providerEntry.getKey(), providerEntry.getValue() ); + } + } + } + + @Override + protected ReleaseDescriptorBuilder createReleaseDescriptor() + { + ReleaseDescriptorBuilder descriptor = super.createReleaseDescriptor(); + + descriptor.setScmPassword( password ); + descriptor.setScmReleaseLabel( tag ); + descriptor.setScmTagNameFormat( tagNameFormat ); + descriptor.setScmTagBase( tagBase ); + descriptor.setScmUsername( username ); + descriptor.setScmCommentPrefix( scmCommentPrefix ); + + descriptor.setPushChanges( pushChanges ); + descriptor.setWorkItem( workItem ); + + if ( project.getScm() != null ) + { + if ( project.getScm().getDeveloperConnection() != null ) + { + descriptor.setScmSourceUrl( project.getScm().getDeveloperConnection() ); + } + else if ( project.getScm().getConnection() != null ) + { + descriptor.setScmSourceUrl( project.getScm().getConnection() ); + } + } + + // As long as Scm.getId() does not exist, read it as a property + descriptor.setScmId( project.getProperties().getProperty( "project.scm.id" ) ); + + for ( MavenProject reactorProject : session.getProjects() ) + { + if ( reactorProject.getScm() != null ) + { + String projectId = + ArtifactUtils.versionlessKey( reactorProject.getGroupId(), reactorProject.getArtifactId() ); + + descriptor.addOriginalScmInfo( projectId, buildScm( project ) ); + } + } + + return descriptor; + } + + protected Scm buildScm( MavenProject project ) + { + Scm scm; + if ( project.getOriginalModel().getScm() == null ) + { + scm = null; + } + else + { + scm = new Scm(); + scm.setConnection( project.getOriginalModel().getScm().getConnection() ); + scm.setDeveloperConnection( project.getOriginalModel().getScm().getDeveloperConnection() ); + scm.setTag( project.getOriginalModel().getScm().getTag() ); + scm.setUrl( project.getOriginalModel().getScm().getUrl() ); + } + return scm; + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java new file mode 100644 index 000000000..955b01ad2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java @@ -0,0 +1,299 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.shared.release.DefaultReleaseManagerListener; +import org.apache.maven.shared.release.ReleaseBranchRequest; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; + +/** + * Branch a project in SCM, using the same steps as the release:prepare goal, creating a branch instead of a + * tag. For more info see https://maven.apache.org/plugins/maven-release-plugin/examples/branch.html. + * + * @author Emmanuel Venisse + * @version $Id$ + * @since 2.0-beta-6 + */ +@Mojo( name = "branch", aggregator = true ) +public class BranchReleaseMojo + extends AbstractScmReleaseMojo +{ + /** + * The branch name to use. + * + * @since 2.0-beta-6 + */ + @Parameter( property = "branchName" ) + private String branchName; + + /** + * The branch base directory in SVN, you must define it if you don't use the standard svn layout + * (trunk/tags/branches). For example, http://svn.apache.org/repos/asf/maven/plugins/branches. The URL + * is an SVN URL and does not include the SCM provider and protocol. + * + * @since 2.0 + */ + @Parameter( property = "branchBase" ) + private String branchBase; + + /** + * Whether to update versions in the branch. + * + * @since 2.0-beta-6 + */ + @Parameter( defaultValue = "false", property = "updateBranchVersions" ) + private boolean updateBranchVersions; + + /** + * Whether to update versions in the working copy. + * + * @since 2.0-beta-6 + */ + @Parameter( defaultValue = "true", property = "updateWorkingCopyVersions" ) + private boolean updateWorkingCopyVersions; + + /** + * Whether to suppress a commit of changes to the working copy + * before the tag is created. + *
    + *
    This requires remoteTagging to be set to false. + *
    + *
    suppressCommitBeforeBranch is useful when you want + * to avoid poms with released versions in all revisions of your + * trunk or development branch. + * + * @since 2.1 + */ + @Parameter( defaultValue = "false", property = "suppressCommitBeforeBranch" ) + private boolean suppressCommitBeforeBranch; + + /** + * Whether to update versions to SNAPSHOT in the branch. + * + * @since 2.0-beta-6 + */ + @Parameter( defaultValue = "true", property = "updateVersionsToSnapshot" ) + private boolean updateVersionsToSnapshot; + + /** + * Whether to use "edit" mode on the SCM, to lock the file for editing during SCM operations. + * + * @since 2.0-beta-6 + */ + @Parameter( defaultValue = "false", property = "useEditMode" ) + private boolean useEditMode; + + /** + * Whether to update dependencies version to the next development version. + * + * @since 2.0-beta-6 + */ + @Parameter( defaultValue = "true", property = "updateDependencies" ) + private boolean updateDependencies; + + /** + * Whether to automatically assign submodules the parent version. If set to false, + * the user will be prompted for the version of each submodules. + * + * @since 2.0-beta-6 + */ + @Parameter( defaultValue = "false", property = "autoVersionSubmodules" ) + private boolean autoVersionSubmodules; + + /** + * Dry run: don't checkin or tag anything in the scm repository, or modify the checkout. + * Running mvn -DdryRun=true release:prepare is useful in order to check that modifications to + * poms and scm operations (only listed on the console) are working as expected. + * Modified POMs are written alongside the originals without modifying them. + * + * @since 2.0-beta-6 + */ + @Parameter( defaultValue = "false", property = "dryRun" ) + private boolean dryRun; + + /** + * Whether to add a schema to the POM if it was previously missing on release. + * + * @since 2.0-beta-6 + */ + @Parameter( defaultValue = "true", property = "addSchema" ) + private boolean addSchema; + + /** + * currently only implemented with svn scm. Enable a workaround to prevent issue + * due to svn client > 1.5.0 (https://issues.apache.org/jira/browse/SCM-406) + * + * @since 2.0 + */ + @Parameter( defaultValue = "true", property = "remoteTagging" ) + private boolean remoteTagging; + + /** + * A list of additional exclude filters that will be skipped when checking for + * modifications on the working copy. + * + * Is ignored, when checkModificationExcludes is set. + * + * @since 2.1 + */ + @Parameter + private String[] checkModificationExcludes; + + /** + * Command-line version of checkModificationExcludes. + * + * @since 2.1 + */ + @Parameter( property = "checkModificationExcludeList" ) + private String checkModificationExcludeList; + + /** + * Specify the new version for the branch. + * This parameter is only meaningful if {@link #updateBranchVersions} = {@code true}. + * + * @since 2.0 + */ + @Parameter( property = "releaseVersion" ) + private String releaseVersion; + + /** + * Specify the new version for the working copy. + * This parameter is only meaningful if {@link #updateWorkingCopyVersions} = {@code true}. + * + * @since 2.0 + */ + @Parameter( property = "developmentVersion" ) + private String developmentVersion; + + /** + * The role-hint for the {@link org.apache.maven.shared.release.policy.version.VersionPolicy} + * implementation used to calculate the project versions. + * + * @since 3.0.0 + * @see org.apache.maven.shared.release.policies.DefaultVersionPolicy + */ + @Parameter( defaultValue = "default", property = "projectVersionPolicyId" ) + private String projectVersionPolicyId; + + /** + * The role-hint for the {@link org.apache.maven.shared.release.policy.naming.NamingPolicy} + * implementation used to calculate the project names. + * + * @since 3.0.0 + * @see org.apache.maven.shared.release.policies.DefaultNamingPolicy + */ + @Parameter( property = "projectNamingPolicyId" ) + private String projectBranchNamingPolicyId; + + /** + * The SCM commit comment when branching. + * Defaults to "@{prefix} prepare branch @{releaseLabel}". + *

    + * Property interpolation is performed on the value, but in order to ensure that the interpolation occurs + * during release, you must use @{...} to reference the properties rather than ${...}. + * The following properties are available: + *

      + *
    • prefix - The comment prefix. + *
    • groupId - The groupId of the root project. + *
    • artifactId - The artifactId of the root project. + *
    • releaseLabel - The release version of the root project. + *
    + * + * @since 3.0.0-M1 + */ + @Parameter( defaultValue = "@{prefix} prepare branch @{releaseLabel}", property = "scmBranchCommitComment" ) + private String scmBranchCommitComment = "@{prefix} prepare branch @{releaseLabel}"; + + /** + * Currently only implemented with svn scm. Enable the {@code --pin-externals} option in + * {@code svn copy} command which is new in Subversion 1.9. + * + * @since 3.0.0 + */ + @Parameter( defaultValue = "false", property = "pinExternals" ) + private boolean pinExternals; + + @Override + public void execute() + throws MojoExecutionException, MojoFailureException + { + super.execute(); + + final ReleaseDescriptorBuilder config = createReleaseDescriptor(); + config.setAddSchema( addSchema ); + config.setScmUseEditMode( useEditMode ); + config.setUpdateDependencies( updateDependencies ); + config.setAutoVersionSubmodules( autoVersionSubmodules ); + config.setScmReleaseLabel( branchName ); + config.setScmBranchBase( branchBase ); + config.setBranchCreation( true ); + config.setUpdateBranchVersions( updateBranchVersions ); + config.setUpdateWorkingCopyVersions( updateWorkingCopyVersions ); + config.setUpdateVersionsToSnapshot( updateVersionsToSnapshot ); + config.setRemoteTagging( remoteTagging ); + config.setDefaultReleaseVersion( releaseVersion ); + config.setDefaultDevelopmentVersion( developmentVersion ); + config.setSuppressCommitBeforeTagOrBranch( suppressCommitBeforeBranch ); + config.setProjectVersionPolicyId( projectVersionPolicyId ); + config.setProjectNamingPolicyId( projectBranchNamingPolicyId ); + config.setScmBranchCommitComment( scmBranchCommitComment ); + config.setPinExternals( pinExternals ); + + if ( checkModificationExcludeList != null ) + { + checkModificationExcludes = checkModificationExcludeList.replaceAll( "\\s", "" ).split( "," ); + } + + if ( checkModificationExcludes != null ) + { + config.setCheckModificationExcludes( Arrays.asList( checkModificationExcludes ) ); + } + + try + { + ReleaseBranchRequest branchRequest = new ReleaseBranchRequest(); + branchRequest.setReleaseDescriptorBuilder( config ); + branchRequest.setReleaseEnvironment( getReleaseEnvironment() ); + branchRequest.setReactorProjects( getReactorProjects() ); + branchRequest.setReleaseManagerListener( new DefaultReleaseManagerListener( getLog(), dryRun ) ); + branchRequest.setDryRun( dryRun ); + branchRequest.setUserProperties( session.getUserProperties() ); + + releaseManager.branch( branchRequest ); + } + catch ( ReleaseExecutionException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + catch ( ReleaseFailureException e ) + { + throw new MojoFailureException( e.getMessage(), e ); + } + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/CleanReleaseMojo.java b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/CleanReleaseMojo.java new file mode 100644 index 000000000..43e34756e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/CleanReleaseMojo.java @@ -0,0 +1,66 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.shared.release.DefaultReleaseManagerListener; +import org.apache.maven.shared.release.ReleaseCleanRequest; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; + +/** + * Clean up after a release preparation. This is done automatically after a successful release:perform, + * so is best served for cleaning up a failed or abandoned release, or a dry run. Note that only the working copy + * is cleaned up, no previous steps are rolled back. + * For more info see https://maven.apache.org/plugins/maven-release-plugin/examples/clean-release.html. + * + * @author Brett Porter + * @version $Id$ + */ +@Mojo( name = "clean", aggregator = true ) +public class CleanReleaseMojo + extends AbstractReleaseMojo +{ + @Override + public void execute() + throws MojoExecutionException, MojoFailureException + { + ReleaseDescriptorBuilder releaseDescriptor = new ReleaseDescriptorBuilder(); + releaseDescriptor.setWorkingDirectory( getBasedir().getAbsolutePath() ); + + ReleaseCleanRequest cleanRequest = new ReleaseCleanRequest(); + cleanRequest.setReleaseDescriptorBuilder( releaseDescriptor ); + cleanRequest.setReactorProjects( getReactorProjects() ); + cleanRequest.setReleaseManagerListener( new DefaultReleaseManagerListener( getLog() ) ); + + try + { + releaseManager.clean( cleanRequest ); + } + catch ( ReleaseFailureException e ) + { + throw new MojoFailureException( e.getMessage() ); + } + } + +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java new file mode 100644 index 000000000..51636f0b2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java @@ -0,0 +1,232 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.shared.release.DefaultReleaseManagerListener; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleasePerformRequest; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.codehaus.plexus.util.StringUtils; + +/** + * Perform a release from SCM, either from a specified tag, or the tag representing the previous release in + * the working copy created by release:prepare. + * For more info see https://maven.apache.org/plugins/maven-release-plugin/examples/perform-release.html. + * + * @author Emmanuel Venisse + * @author Brett Porter + * @version $Id$ + */ +@Mojo( name = "perform", aggregator = true, requiresProject = false ) +public class PerformReleaseMojo + extends AbstractReleaseMojo +{ + /** + * A space separated list of goals to execute on deployment. Default value is either deploy or + * deploy site-deploy, if the project has a <distributionManagement>/<site> element. + */ + @Parameter( property = "goals" ) + String goals; + + /** + * Comma separated profiles to enable on deployment, in addition to active profiles for project execution. + * + * @since 2.0-beta-8 + */ + @Parameter( property = "releaseProfiles" ) + private String releaseProfiles; + + /** + * The checkout directory. + */ + @Parameter( defaultValue = "${project.build.directory}/checkout", property = "workingDirectory", required = true ) + private File workingDirectory; + + /** + * The SCM URL to checkout from. If omitted, the one from the release.properties file is used, followed + * by the URL from the current POM. + */ + @Parameter( property = "connectionUrl" ) + private String connectionUrl; + + /** + * Use a local checkout instead of doing a checkout from the upstream repository. + * ATTENTION: This will only work with distributed SCMs which support the file:// protocol + * like e.g. git, jgit or hg! + * + * TODO: we should think about having the defaults for the various SCM providers provided via modello! + * + * @since 2.0 for release:perform and 2.5.2 for release:stage + */ + @Parameter( defaultValue = "false", property = "localCheckout" ) + private boolean localCheckout; + + /** + * The SCM username to use. + */ + @Parameter( property = "username" ) + private String username; + + /** + * The SCM password to use. + */ + @Parameter( property = "password" ) + private String password; + + /** + * Whether to use the release profile that adds sources and javadocs to the released artifact, if appropriate. + * If set to true, the release plugin sets the property "performRelease" to true, which activates the profile + * "release-profile", which is inherited from the super pom. + * + * @deprecated The release profile will be removed from future versions of the super POM + */ + @Parameter( defaultValue = "false", property = "useReleaseProfile" ) + @Deprecated + private boolean useReleaseProfile; + + /** + * Dry run: don't checkout anything from the scm repository, or modify the checkout. + * The goals (by default at least {@code deploy}) will not be executed. + */ + @Parameter( defaultValue = "false", property = "dryRun" ) + private boolean dryRun; + + /** + * Add a new or overwrite the default implementation per provider. + * The key is the scm prefix and the value is the role hint of the + * {@link org.apache.maven.scm.provider.ScmProvider}. + * + * @since 2.5.3 + * @see ScmManager#setScmProviderImplementation(String, String) + */ + @Parameter + private Map providerImplementations; + + /** + * The SCM manager. + */ + @Component + private ScmManager scmManager; + + @Override + protected String getAdditionalProfiles() + { + return releaseProfiles; + } + + @Override + public void execute() + throws MojoExecutionException, MojoFailureException + { + if ( providerImplementations != null ) + { + for ( Map.Entry providerEntry : providerImplementations.entrySet() ) + { + getLog().info( "Change the default '" + providerEntry.getKey() + "' provider implementation to '" + + providerEntry.getValue() + "'." ); + scmManager.setScmProviderImplementation( providerEntry.getKey(), providerEntry.getValue() ); + } + } + + // goals may be splitted into multiple line in configuration. + // Let's build a single line command + if ( goals != null ) + { + goals = StringUtils.join( StringUtils.split( goals ), " " ); + } + + try + { + setDeploymentRepository(); + // Note that the working directory here is not the same as in the release configuration, so don't reuse that + ReleaseDescriptorBuilder releaseDescriptor = createReleaseDescriptor(); + if ( connectionUrl != null ) + { + releaseDescriptor.setScmSourceUrl( connectionUrl ); + } + + if ( username != null ) + { + releaseDescriptor.setScmUsername( username ); + } + + if ( password != null ) + { + releaseDescriptor.setScmPassword( password ); + } + + releaseDescriptor.setLocalCheckout( localCheckout ); + + releaseDescriptor.setCheckoutDirectory( workingDirectory.getAbsolutePath() ); + releaseDescriptor.setUseReleaseProfile( useReleaseProfile ); + + createGoals(); + releaseDescriptor.setPerformGoals( goals ); + + ReleasePerformRequest performRequest = new ReleasePerformRequest(); + performRequest.setReleaseDescriptorBuilder( releaseDescriptor ); + performRequest.setReleaseEnvironment( getReleaseEnvironment() ); + performRequest.setReactorProjects( getReactorProjects() ); + performRequest.setReleaseManagerListener( new DefaultReleaseManagerListener( getLog(), dryRun ) ); + performRequest.setDryRun( dryRun ); + + releaseManager.perform( performRequest ); + } + catch ( ReleaseExecutionException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + catch ( ReleaseFailureException e ) + { + throw new MojoFailureException( e.getMessage(), e ); + } + } + + /** Just here so it may be overridden by StageReleaseMojo */ + void setDeploymentRepository() + { + } + + /** Just here so it may be overridden by StageReleaseMojo */ + void createGoals() + { + if ( goals == null ) + { + // set default + goals = "deploy"; + if ( project.getDistributionManagement() != null + && project.getDistributionManagement().getSite() != null ) + { + goals += " site-deploy"; + } + } + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java new file mode 100644 index 000000000..7422354e4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java @@ -0,0 +1,390 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.apache.maven.shared.release.DefaultReleaseManagerListener; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleasePrepareRequest; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; + +/** + * Prepare for a release in SCM. Steps through several phases to ensure the POM is ready to be released and then + * prepares SCM to eventually contain a tagged version of the release and a record in the local copy of the parameters + * used. This can be followed by a call to release:perform. For more info see https://maven.apache.org/plugins/maven-release-plugin/examples/prepare-release.html. + * + * @author John Casey + * @author Emmanuel Venisse + * @author Jason van Zyl + * @author Brett Porter + * @version $Id$ + */ +// TODO [!] check how this works with version ranges +@Mojo( name = "prepare", aggregator = true, requiresDependencyCollection = ResolutionScope.TEST ) +public class PrepareReleaseMojo + extends AbstractScmReleaseMojo +{ + + /** + * Resume a previous release attempt from the point where it was stopped. + */ + @Parameter( defaultValue = "true", property = "resume" ) + private boolean resume; + + /** + * @deprecated Please use release:prepare-with-pom instead. + */ + @Deprecated + @Parameter( defaultValue = "false", property = "generateReleasePoms" ) + private boolean generateReleasePoms; + + /** + * Whether to use "edit" mode on the SCM, to lock the file for editing during SCM operations. + */ + @Parameter( defaultValue = "false", property = "useEditMode" ) + private boolean useEditMode; + + /** + * Whether to update dependencies version to the next development version. + * + * @since 2.0-beta-5 + */ + @Parameter( defaultValue = "true", property = "updateDependencies" ) + private boolean updateDependencies; + + /** + * Whether to automatically assign submodules the parent version. If set to false, the user will be prompted for the + * version of each submodules. + * + * @since 2.0-beta-5 + */ + @Parameter( defaultValue = "false", property = "autoVersionSubmodules" ) + private boolean autoVersionSubmodules; + + /** + * Dry run: don't checkin or tag anything in the scm repository, or modify the checkout. Running + * mvn -DdryRun=true release:prepare is useful in order to check that modifications to poms and scm + * operations (only listed on the console) are working as expected. Modified POMs are written alongside the + * originals without modifying them. + */ + @Parameter( defaultValue = "false", property = "dryRun" ) + private boolean dryRun; + + /** + * Whether to add a schema to the POM if it was previously missing on release. + */ + @Parameter( defaultValue = "true", property = "addSchema" ) + private boolean addSchema; + + /** + * Goals to run as part of the preparation step, after transformation but before committing. Space delimited. + */ + @Parameter( defaultValue = "clean verify", property = "preparationGoals" ) + private String preparationGoals; + + /** + * Goals to run on completion of the preparation step, after transformation back to the next development version but + * before committing. Space delimited. + * + * @since 2.2 + */ + @Parameter( defaultValue = "", property = "completionGoals" ) + private String completionGoals; + + /** + * Commits to do are atomic or by project. + * + * @since 2.0-beta-5 + */ + @Parameter( defaultValue = "false", property = "commitByProject" ) + private boolean commitByProject; + + /** + * Whether to allow timestamped SNAPSHOT dependencies. Default is to fail when finding any SNAPSHOT. + * + * @since 2.0-beta-7 + */ + @Parameter( defaultValue = "false", property = "ignoreSnapshots" ) + private boolean allowTimestampedSnapshots; + + /** + * Whether to allow usage of a SNAPSHOT version of the Release Plugin. This in an internal property used to support + * testing of the plugin itself in batch mode. + * + * @since 2.0-beta-9 + */ + @Parameter( defaultValue = "false", property = "allowReleasePluginSnapshot", readonly = true ) + private boolean allowReleasePluginSnapshot; + + /** + * A list of additional exclude filters that will be skipped when checking for modifications on the working copy. Is + * ignored, when checkModificationExcludes is set. + * + * @since 2.1 + */ + @Parameter + private String[] checkModificationExcludes; + + /** + * Command-line version of checkModificationExcludes. + * + * @since 2.1 + */ + @Parameter( property = "checkModificationExcludeList" ) + private String checkModificationExcludeList; + + /** + * Default version to use when preparing a release or a branch. + * + * @since 2.0-beta-8 + */ + @Parameter( property = "releaseVersion" ) + private String releaseVersion; + + /** + * Default version to use for new local working copy. + * + * @since 2.0-beta-8 + */ + @Parameter( property = "developmentVersion" ) + private String developmentVersion; + + /** + * Currently only implemented with svn scm. + *
      + *
    • Enables a workaround to prevent issue due to svn client > 1.5.0 (fixed in 1.6.5) + * (https://issues.apache.org/jira/browse/SCM-406)
    • + *
    • You may not want to use this in conjunction with suppressCommitBeforeTag, such that no poms with + * released versions are committed to the working copy ever.
    • + *
    + * + * @since 2.0-beta-9 + */ + @Parameter( defaultValue = "true", property = "remoteTagging" ) + private boolean remoteTagging; + + /** + * Whether to bump the working copy versions to developmentVersion. + * + * @since 2.1 + */ + @Parameter( defaultValue = "true", property = "updateWorkingCopyVersions" ) + private boolean updateWorkingCopyVersions; + + /** + * Whether to suppress a commit of changes to the working copy before the tag is created.
    + *
    + * This requires remoteTagging to be set to false.
    + *
    + * suppressCommitBeforeTag is useful when you want to avoid poms with released versions in all + * revisions of your trunk or development branch. + * + * @since 2.1 + */ + @Parameter( defaultValue = "false", property = "suppressCommitBeforeTag" ) + private boolean suppressCommitBeforeTag; + + /** + * Wait the specified number of seconds before creating the tag.
    + * waitBeforeTagging is useful when your source repository is synced between several instances and + * access to it is determined by geographical location, like the SVN repository at the Apache Software Foundation. + * + * @since 2.2 + */ + @Parameter( defaultValue = "0", property = "waitBeforeTagging" ) + private int waitBeforeTagging; + + /** + * The role-hint for the {@link org.apache.maven.shared.release.policy.version.VersionPolicy} + * implementation used to calculate the project versions. + * + * @since 2.5.1 + * @see org.apache.maven.shared.release.policies.DefaultVersionPolicy + */ + @Parameter( defaultValue = "default", property = "projectVersionPolicyId" ) + private String projectVersionPolicyId; + + /** + * The role-hint for the {@link org.apache.maven.shared.release.policy.naming.NamingPolicy} + * implementation used to calculate the project branch and tag names. + * + * @since 3.0.0 + * @see org.apache.maven.shared.release.policies.DefaultNamingPolicy + */ + @Parameter( property = "projectNamingPolicyId" ) + private String projectTagNamingPolicyId; + + /** + * The SCM commit comment when setting pom.xml to release. + * Defaults to "@{prefix} prepare release @{releaseLabel}". + *

    + * Property interpolation is performed on the value, but in order to ensure that the interpolation occurs + * during release, you must use @{...} to reference the properties rather than ${...}. + * The following properties are available: + *

      + *
    • prefix - The comment prefix. + *
    • groupId - The groupId of the root project. + *
    • artifactId - The artifactId of the root project. + *
    • releaseLabel - The release version of the root project. + *
    + * + * @since 3.0.0 + */ + @Parameter( defaultValue = "@{prefix} prepare release @{releaseLabel}", property = "scmReleaseCommitComment" ) + private String scmReleaseCommitComment = "@{prefix} prepare release @{releaseLabel}"; + + /** + * The SCM commit comment when setting pom.xml back to development. + * Defaults to "@{prefix} prepare for next development iteration". + *

    + * Property interpolation is performed on the value, but in order to ensure that the interpolation occurs + * during release, you must use @{...} to reference the properties rather than ${...}. + * The following properties are available: + *

      + *
    • prefix - The comment prefix. + *
    • groupId - The groupId of the root project. + *
    • artifactId - The artifactId of the root project. + *
    • releaseLabel - The release version of the root project. + *
    + * + * @since 3.0.0 + */ + @Parameter( + defaultValue = "@{prefix} prepare for next development iteration", + property = "scmDevelopmentCommitComment" ) + private String scmDevelopmentCommitComment = "@{prefix} prepare for next development iteration"; + + /** + * Specifies whether unresolved SNAPSHOT dependencies should automatically be resolved. + * If this is set, then this specifies the default answer to be used when unresolved SNAPSHOT + * dependencies should automatically be resolved ( 0:All 1:Project Dependencies 2:Plugins + * 3:Reports 4:Extensions ). Possible values are: + *
      + *
    • "all" or "0": resolve all kinds of snapshots, ie. project, plugin, report and extension dependencies
    • + *
    • "dependencies" or "1": resolve project dependencies
    • + *
    • "plugins" or "2": resolve plugin dependencis
    • + *
    • "reports" or "3": resolve report dependencies
    • + *
    • "extensions" or "4": resolve extension dependencies
    • + *
    + * + * @since 3.0.0 + */ + @Parameter( property = "autoResolveSnapshots" ) + private String autoResolveSnapshots; + + /** + * Currently only implemented with svn scm. Enable the {@code --pin-externals} option in + * {@code svn copy} command which is new in Subversion 1.9. + * + * @since 3.0.0 + */ + @Parameter( defaultValue = "false", property = "pinExternals" ) + private boolean pinExternals; + + /** + * {@inheritDoc} + */ + @Override + public void execute() + throws MojoExecutionException, MojoFailureException + { + if ( generateReleasePoms ) + { + throw new MojoFailureException( "Generating release POMs is no longer supported in release:prepare. " + + "Please run release:prepare-with-pom instead." ); + } + + prepareRelease( generateReleasePoms ); + } + + protected void prepareRelease( boolean generateReleasePoms ) + throws MojoExecutionException, MojoFailureException + { + // this is here so the subclass can call it without getting the extra generateReleasePoms check in execute() + // above + super.execute(); + + final ReleaseDescriptorBuilder config = createReleaseDescriptor(); + config.setAddSchema( addSchema ); + config.setGenerateReleasePoms( generateReleasePoms ); + config.setScmUseEditMode( useEditMode ); + config.setPreparationGoals( preparationGoals ); + config.setCompletionGoals( completionGoals ); + config.setCommitByProject( commitByProject ); + config.setUpdateDependencies( updateDependencies ); + config.setAutoVersionSubmodules( autoVersionSubmodules ); + config.setAllowTimestampedSnapshots( allowTimestampedSnapshots ); + config.setSnapshotReleasePluginAllowed( allowReleasePluginSnapshot ); + config.setDefaultReleaseVersion( releaseVersion ); + config.setDefaultDevelopmentVersion( developmentVersion ); + config.setRemoteTagging( remoteTagging ); + config.setUpdateWorkingCopyVersions( updateWorkingCopyVersions ); + config.setSuppressCommitBeforeTagOrBranch( suppressCommitBeforeTag ); + config.setWaitBeforeTagging( waitBeforeTagging ); + config.setProjectVersionPolicyId( projectVersionPolicyId ); + config.setProjectNamingPolicyId( projectTagNamingPolicyId ); + config.setScmDevelopmentCommitComment( scmDevelopmentCommitComment ); + config.setScmReleaseCommitComment( scmReleaseCommitComment ); + config.setAutoResolveSnapshots( autoResolveSnapshots ); + config.setPinExternals( pinExternals ); + + if ( checkModificationExcludeList != null ) + { + checkModificationExcludes = checkModificationExcludeList.replaceAll( "\\s", "" ).split( "," ); + } + + if ( checkModificationExcludes != null ) + { + config.setCheckModificationExcludes( Arrays.asList( checkModificationExcludes ) ); + } + + ReleasePrepareRequest prepareRequest = new ReleasePrepareRequest(); + prepareRequest.setReleaseDescriptorBuilder( config ); + prepareRequest.setReleaseEnvironment( getReleaseEnvironment() ); + prepareRequest.setReactorProjects( getReactorProjects() ); + prepareRequest.setReleaseManagerListener( new DefaultReleaseManagerListener( getLog(), dryRun ) ); + prepareRequest.setResume( resume ); + prepareRequest.setDryRun( dryRun ); + prepareRequest.setUserProperties( session.getUserProperties() ); + + try + { + releaseManager.prepare( prepareRequest ); + } + catch ( ReleaseExecutionException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + catch ( ReleaseFailureException e ) + { + throw new MojoFailureException( e.getMessage(), e ); + } + } + +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareWithPomReleaseMojo.java b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareWithPomReleaseMojo.java new file mode 100644 index 000000000..b56eb0d25 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareWithPomReleaseMojo.java @@ -0,0 +1,50 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; + +/** + * Prepare for a release in SCM, fully resolving dependencies for the purpose of producing a "release POM". + * + * @author Brett Porter + * @since 2.0 + */ +@Mojo( name = "prepare-with-pom", aggregator = true, requiresDependencyResolution = ResolutionScope.TEST ) +public class PrepareWithPomReleaseMojo + extends PrepareReleaseMojo +{ + /** + * Whether to generate release-pom.xml files that contain resolved information about the project. + */ + @Parameter( defaultValue = "true", property = "generateReleasePoms" ) + private boolean generateReleasePoms; + + @Override + public void execute() + throws MojoExecutionException, MojoFailureException + { + prepareRelease( generateReleasePoms ); + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/RollbackReleaseMojo.java b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/RollbackReleaseMojo.java new file mode 100644 index 000000000..11778c6f9 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/RollbackReleaseMojo.java @@ -0,0 +1,97 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.shared.release.DefaultReleaseManagerListener; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseRollbackRequest; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; + +/** + * Rollback changes made by a previous release. This requires that the previous release descriptor + * release.properties is still available in the local working copy. For more info see https://maven.apache.org/plugins/maven-release-plugin/examples/rollback-release.html. + * + * @since 2.0-beta-5 + * @author Edwin Punzalan + * @version $Id$ + */ +@Mojo( name = "rollback", aggregator = true ) +public class RollbackReleaseMojo + extends AbstractScmReleaseMojo +{ + + /** + * The SCM commit comment when rolling back. + * Defaults to "@{prefix} rollback the release of @{releaseLabel}". + *

    + * Property interpolation is performed on the value, but in order to ensure that the interpolation occurs + * during release, you must use @{...} to reference the properties rather than ${...}. + * The following properties are available: + *

      + *
    • prefix - The comment prefix. + *
    • groupId - The groupId of the root project. + *
    • artifactId - The artifactId of the root project. + *
    • releaseLabel - The release version of the root project. + *
    + * + * @since 3.0.0 + */ + @Parameter( + defaultValue = "@{prefix} rollback the release of @{releaseLabel}", + property = "scmRollbackCommitComment" ) + private String scmRollbackCommitComment = "@{prefix} rollback the release of @{releaseLabel}"; + + @Override + public void execute() + throws MojoExecutionException, MojoFailureException + { + super.execute(); + + final ReleaseDescriptorBuilder config = createReleaseDescriptor(); + config.setScmRollbackCommitComment( scmRollbackCommitComment ); + + try + { + ReleaseRollbackRequest rollbackRequest = new ReleaseRollbackRequest(); + rollbackRequest.setReleaseDescriptorBuilder( config ); + rollbackRequest.setReleaseEnvironment( getReleaseEnvironment() ); + rollbackRequest.setReactorProjects( getReactorProjects() ); + rollbackRequest.setReleaseManagerListener( new DefaultReleaseManagerListener( getLog() ) ); + + releaseManager.rollback( rollbackRequest ); + } + catch ( ReleaseExecutionException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + catch ( ReleaseFailureException e ) + { + throw new MojoFailureException( e.getMessage(), e ); + } + } + +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/StageReleaseMojo.java b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/StageReleaseMojo.java new file mode 100644 index 000000000..a92b7b3ba --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/StageReleaseMojo.java @@ -0,0 +1,74 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.codehaus.plexus.util.StringUtils; + +/** + * Perform a release from SCM to a staging repository. + * + * If no goals are given, these default to deploy or deploy site:stage-deploy, + * if the project has a <distributionManagement>/<site> element. + * + * If the goals contain site-deploy or site:deploy, these + * are overridden with site:stage-deploy. + * + * @author Nicolas De Loof + * @version $Id$ + * @since 2.0-beta-8 + */ +@Mojo( name = "stage", aggregator = true, requiresProject = false ) +public class StageReleaseMojo + extends PerformReleaseMojo +{ + /** + * URL of the staging repository to use. + * + * @since 2.0-beta-8 + */ + @Parameter( property = "stagingRepository", required = true ) + private String stagingRepository; + + @Override + void createGoals() + { + if ( goals == null ) + { + // set default + goals = "deploy"; + if ( project.getDistributionManagement() != null + && project.getDistributionManagement().getSite() != null ) + { + goals += " site:stage-deploy"; + } + } + + goals = StringUtils.replace( goals, "site-deploy", "site:stage-deploy" ); + goals = StringUtils.replace( goals, "site:deploy", "site:stage-deploy" ); + } + + @Override + void setDeploymentRepository() + { + addArgument( "-DaltDeploymentRepository=\"" + stagingRepository + "\"" ); + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java new file mode 100644 index 000000000..17c47de8a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java @@ -0,0 +1,132 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.shared.release.DefaultReleaseManagerListener; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseUpdateVersionsRequest; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; + +/** + * Update the POM versions for a project. This performs the normal version updates of the release:prepare goal + * without making other modifications to the SCM such as tagging. For more info see https://maven.apache.org/plugins/maven-release-plugin/examples/update-versions.html. + * + * @author Paul Gier + * @version $Id$ + * @since 2.0 + */ +@Mojo( name = "update-versions", aggregator = true ) +public class UpdateVersionsMojo + extends AbstractReleaseMojo +{ + + /** + * Whether to automatically assign submodules the parent version. If set to false, the user will be prompted for the + * version of each submodules. + * + * @since 2.0 + */ + @Parameter( defaultValue = "false", property = "autoVersionSubmodules" ) + private boolean autoVersionSubmodules; + + /** + * Whether to add a schema to the POM if it was previously missing on release. + * + * @since 2.0 + */ + @Parameter( defaultValue = "true", property = "addSchema" ) + private boolean addSchema; + + /** + * Default version to use for new local working copy. + * + * @since 2.0 + */ + @Parameter( property = "developmentVersion" ) + private String developmentVersion; + + /** + * Whether to update dependencies version to the next development version. + * + * @since 2.5.2 + */ + @Parameter( defaultValue = "true", property = "updateDependencies" ) + private boolean updateDependencies; + + /** + * Whether to use "edit" mode on the SCM, to lock the file for editing during SCM operations. + * + * @since 2.5.2 + */ + @Parameter( defaultValue = "false", property = "useEditMode" ) + private boolean useEditMode; + + /** + * The role-hint for the VersionPolicy implementation used to calculate the project versions. + * + * @since 3.0.0 + */ + @Parameter( defaultValue = "default", property = "projectVersionPolicyId" ) + private String projectVersionPolicyId; + + @Override + public void execute() + throws MojoExecutionException, MojoFailureException + { + final ReleaseDescriptorBuilder config = createReleaseDescriptor(); + config.setAddSchema( addSchema ); + config.setAutoVersionSubmodules( autoVersionSubmodules ); + config.setDefaultDevelopmentVersion( developmentVersion ); + config.setScmUseEditMode( useEditMode ); + config.setUpdateDependencies( updateDependencies ); + config.setProjectVersionPolicyId( projectVersionPolicyId ); + + config.addOriginalScmInfo( ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ), + project.getScm() ); + + try + { + ReleaseUpdateVersionsRequest updateVersionsRequest = new ReleaseUpdateVersionsRequest(); + updateVersionsRequest.setReleaseDescriptorBuilder( config ); + updateVersionsRequest.setReleaseEnvironment( getReleaseEnvironment() ); + updateVersionsRequest.setReactorProjects( getReactorProjects() ); + updateVersionsRequest.setReleaseManagerListener( new DefaultReleaseManagerListener( getLog() ) ); + updateVersionsRequest.setUserProperties( session.getUserProperties() ); + + releaseManager.updateVersions( updateVersionsRequest ); + } + catch ( ReleaseExecutionException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + catch ( ReleaseFailureException e ) + { + throw new MojoFailureException( e.getMessage(), e ); + } + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/branch.apt b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/branch.apt new file mode 100644 index 000000000..00c7b8972 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/branch.apt @@ -0,0 +1,75 @@ + ------ + Create a Branch + ------ + Emmanuel Venisse + ------ + 2010-01-03 + ------ + +~~ Licensed to the Apache Software Foundation (ASF) under one +~~ or more contributor license agreements. See the NOTICE file +~~ distributed with this work for additional information +~~ regarding copyright ownership. The ASF licenses this file +~~ to you under the Apache License, Version 2.0 (the +~~ "License"); you may not use this file except in compliance +~~ with the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, +~~ software distributed under the License is distributed on an +~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~~ KIND, either express or implied. See the License for the +~~ specific language governing permissions and limitations +~~ under the License. + +Create a Branch + + Creating a branch involves the following release phases: + + * Check that there are no uncommitted changes in the sources + + * Change the version in the POMs if you want to change it in the branch (you will be prompted for the versions to use) + + * Transform the SCM information in the POM to include the final destination of the tag + + * Commit the modified POMs + + * Tag the code in the SCM as a new branch with a version name (this will be prompted for) + + * Bump the version in the POMs if you want to change it to a new value y-SNAPSHOT (these values will also be prompted for) + + * Commit the modified POMs + + [] + + To create a branch execute this command: + +------- +mvn release:branch -DbranchName=my-branch +------- + + By default, the POM in the new branch keeps the same version as the local working copy, and the local POM is incremented + to the next revision. If you want to update versions in the new branch and not in the working copy, run: + +------- +mvn release:branch -DbranchName=my-branch -DupdateBranchVersions=true -DupdateWorkingCopyVersions=false +------- + + <> This can be useful if you want to create a branch from a tag + + +* Specify versions on the command line + + You may want to specify the versions to use on the command line. This can be useful for example if you are running + the release in non-interactive mode. The <<>> goal can use the same properties used by the <<>> goal for + specifying the versions to be used. + + +----------- +mvn --batch-mode release:branch -DbranchName=my-branch-1.2 -Dproject.rel.org.myCompany:projectA=1.2 \ + -Dproject.dev.org.myCompany:projectA=2.0-SNAPSHOT +----------- + + In this example, the POM in the new branch will be set to the version 1.2-SNAPSHOT, and the + local POM will be set to the version 2.0-SNAPSHOT. diff --git a/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/clean-release.apt b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/clean-release.apt new file mode 100644 index 000000000..d756db07e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/clean-release.apt @@ -0,0 +1,40 @@ + ------ + Clean a Release + ------ + Dennis Lundberg + ------ + 2010-01-03 + ------ + +~~ Licensed to the Apache Software Foundation (ASF) under one +~~ or more contributor license agreements. See the NOTICE file +~~ distributed with this work for additional information +~~ regarding copyright ownership. The ASF licenses this file +~~ to you under the Apache License, Version 2.0 (the +~~ "License"); you may not use this file except in compliance +~~ with the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, +~~ software distributed under the License is distributed on an +~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~~ KIND, either express or implied. See the License for the +~~ specific language governing permissions and limitations +~~ under the License. + +Clean a Release + + Cleaning a release goes through the following release phases: + + * Delete the release descriptor (<<>>) + + * Delete any backup POM files + + [] + + To clean a release execute this command: + +------- +mvn release:clean +------- diff --git a/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/generate-release-poms.apt b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/generate-release-poms.apt new file mode 100644 index 000000000..c722143b3 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/generate-release-poms.apt @@ -0,0 +1,45 @@ + ------ + Generate Release POMs + ------ + Carlos Sanchez + Brett Porter + John Tolentino + ------ + 2010-01-04 + ------ + +~~ Licensed to the Apache Software Foundation (ASF) under one +~~ or more contributor license agreements. See the NOTICE file +~~ distributed with this work for additional information +~~ regarding copyright ownership. The ASF licenses this file +~~ to you under the Apache License, Version 2.0 (the +~~ "License"); you may not use this file except in compliance +~~ with the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, +~~ software distributed under the License is distributed on an +~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~~ KIND, either express or implied. See the License for the +~~ specific language governing permissions and limitations +~~ under the License. + +Generate Release POMs + + To generate POMs with resolved information (e.g. version numbers) to check the values that the Release Plugin will use, + execute the <<>> goal. Resolved values will be saved in <<>>. + ++------- +mvn release:prepare-with-pom ++------- + + This relies on <<>> being present from a previous release preparation. If this is not the case, + you need to give the goal the name of the URL and optional tag to perform the release from. For example: + ++------- +mvn release:prepare-with-pom + -DconnectionUrl=scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-release-plugin-2.0 ++------- + + After the release is complete, the <<>> and other release files will be removed from the checkout. diff --git a/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/lock-files.apt b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/lock-files.apt new file mode 100644 index 000000000..6115b4882 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/lock-files.apt @@ -0,0 +1,48 @@ + ------ + Lock Files During Release + ------ + Carlos Sanchez + Brett Porter + John Tolentino + ------ + 2010-01-03 + ------ + +~~ Licensed to the Apache Software Foundation (ASF) under one +~~ or more contributor license agreements. See the NOTICE file +~~ distributed with this work for additional information +~~ regarding copyright ownership. The ASF licenses this file +~~ to you under the Apache License, Version 2.0 (the +~~ "License"); you may not use this file except in compliance +~~ with the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, +~~ software distributed under the License is distributed on an +~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~~ KIND, either express or implied. See the License for the +~~ specific language governing permissions and limitations +~~ under the License. + +~~ NOTE: For help with the syntax of this file, see: +~~ http://maven.apache.org/doxia/references/apt-format.html + +Lock Files During Release + + If you want to lock the files during a release operation set the property <<>> to <<>>. The default + value of this property is <<>>. + +------- +mvn release:perform -DuseEditMode=true +------- + + This relies on <<>> being present from a previous release preparation. If this is not the case, + you need to give the goal the name of the URL and optional tag to perform the release from. For example: + +------- +mvn release:perform -DuseEditMode=true + -DconnectionUrl=scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-release-plugin-2.0 +------- + + After the release is complete, the <<>> and other release files will be removed from the checkout. diff --git a/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/non-interactive-release.apt b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/non-interactive-release.apt new file mode 100644 index 000000000..70fd16304 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/non-interactive-release.apt @@ -0,0 +1,98 @@ + ------ + Performing a Non-interactive Release + ------ + Paul Gier + ------ + 2010-01-03 + ------ + +~~ Licensed to the Apache Software Foundation (ASF) under one +~~ or more contributor license agreements. See the NOTICE file +~~ distributed with this work for additional information +~~ regarding copyright ownership. The ASF licenses this file +~~ to you under the Apache License, Version 2.0 (the +~~ "License"); you may not use this file except in compliance +~~ with the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, +~~ software distributed under the License is distributed on an +~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~~ KIND, either express or implied. See the License for the +~~ specific language governing permissions and limitations +~~ under the License. + +Performing a Non-interactive Release + + In some environments, it may be necessary to perform a non-interactive release. This means that + the Release Plugin will obtain the required parameters from system properties (set on the command line) + or from a properties file (<<>>). + + To prevent the Release Plugin from prompting the user for any information, Maven should be put into + batch mode. + +----------- +mvn -B release:prepare +----------- + + or + +----------- +mvn --batch-mode release:prepare +----------- + +* Using system properties + + Using batch mode with no other configuration will cause the Release Plugin to use default values + for the release version, the SCM tag, and the next development version. These values can also + be set from the command line. + + The SCM tag name can be set using the <<>> property. And default values for the release version + and new development version can be set using the properties <<>> and + <<>> respectively. + +----------- +mvn --batch-mode -Dtag=my-proj-1.2 release:prepare \ + -DreleaseVersion=1.2 \ + -DdevelopmentVersion=2.0-SNAPSHOT +----------- + +* Multi-module releases + + Because there is the possibility that a release will include multiple release versions and + SNAPSHOT versions (for a multi-module project), there is a specific format for setting these + values. The property name should start with <<>> for release versions and + <<>> for the new development version. These prefixes are followed by the + project's groupId and artifactId (separated by a colon). So the result looks something like + the following example. + +----------- +mvn --batch-mode -Dtag=my-proj-1.2 -Dproject.rel.org.myCompany:projectA=1.2 \ + -Dproject.dev.org.myCompany:projectA=1.3-SNAPSHOT release:prepare +----------- + + Using this convention, multiple release versions and SNAPSHOT versions (one for each + project module) can be specified on the command line. + + These properties can be used in combination with the <<>> and + <<>>. In the case where both are used, <<>> and + <<>> act as defaults for modules that have not been given specific + values using the <<>> format. + + +* Using a properties file + + Another option is to create a properties file that contains the version information for + the project you would like to release. The properties file should be called <<>> + and the release and SNAPSHOT versions follow the same conventions as they do on the + command line. + +----------- +scm.tag=my-proj-1.2 +project.rel.org.myCompany\:projectA=1.2 +project.dev.org.myCompany\:projectA=1.3-SNAPSHOT +----------- + + <> Remember to escape the colon with a backslash, otherwise the property will not be + interpreted correctly. diff --git a/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/perform-release.apt.vm b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/perform-release.apt.vm new file mode 100644 index 000000000..7bf4033b2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/perform-release.apt.vm @@ -0,0 +1,75 @@ + ------ + Perform a Release + ------ + Carlos Sanchez + Brett Porter + John Tolentino + ------ + 2011-09-23 + ------ + +~~ Licensed to the Apache Software Foundation (ASF) under one +~~ or more contributor license agreements. See the NOTICE file +~~ distributed with this work for additional information +~~ regarding copyright ownership. The ASF licenses this file +~~ to you under the Apache License, Version 2.0 (the +~~ "License"); you may not use this file except in compliance +~~ with the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, +~~ software distributed under the License is distributed on an +~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~~ KIND, either express or implied. See the License for the +~~ specific language governing permissions and limitations +~~ under the License. + +Perform a Release + + Performing a release runs the following release phases: + + * Checkout from an SCM URL with optional tag + + * Run the predefined Maven goals to release the project (by default, <<>>) + + [] + + To perform a release, execute this command: + +------- +mvn release:perform +------- + + This relies on <<>> being present from a previous release preparation. If this is not the case, + you need to give the goal the URL and an optional tag to perform the release from. For example: + +------- +mvn org.apache.maven.plugins:maven-release-plugin:${project.version}:perform -DconnectionUrl=scm:svn:https://svn.mycompany.com/repos/path/to/myproject/tags/myproject-1.2.3 +------- + + <<>> will fork a new Maven instance to build the checked-out project. This new Maven instance will use the + same system configuration and Maven profiles used by the one running the <<>> goal. Since there's no pom.xml, + you should use the fully qualified name of the goal to ensure the right version of the maven-release-plugin is used. + + + It is possible to + force some profiles to get enabled during release (for example to enable time-consuming tasks that are only relevant + at release-time) by setting a comma separated list of profiles names in the <<>> parameter. The goals and + profiles required to release the project can then be configured in the POM: + +------- + + org.apache.maven.plugins + maven-release-plugin + ${project.version} + + + release + + +------- + + After the release is complete, the <<>> and other release files will be removed from the checkout. diff --git a/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/prepare-release.apt.vm b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/prepare-release.apt.vm new file mode 100644 index 000000000..afa9dab2c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/prepare-release.apt.vm @@ -0,0 +1,144 @@ + ------ + Prepare a Release + ------ + Carlos Sanchez + Brett Porter + John Tolentino + Dennis Lundberg + ------ + 2010-01-03 + ------ + +~~ Licensed to the Apache Software Foundation (ASF) under one +~~ or more contributor license agreements. See the NOTICE file +~~ distributed with this work for additional information +~~ regarding copyright ownership. The ASF licenses this file +~~ to you under the Apache License, Version 2.0 (the +~~ "License"); you may not use this file except in compliance +~~ with the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, +~~ software distributed under the License is distributed on an +~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~~ KIND, either express or implied. See the License for the +~~ specific language governing permissions and limitations +~~ under the License. + +Prepare a Release + + Preparing a release goes through the following release phases: + + * Check that there are no uncommitted changes in the sources + + * Check that there are no SNAPSHOT dependencies + + * Change the version in the POMs from x-SNAPSHOT to a new version (you will be prompted for the versions to use) + + * Transform the SCM information in the POM to include the final destination of the tag + + * Run the project tests against the modified POMs to confirm everything is in working order + + * Commit the modified POMs + + * Tag the code in the SCM with a version name (this will be prompted for) + + * Bump the version in the POMs to a new value y-SNAPSHOT (these values will also be prompted for) + + * Commit the modified POMs + + [] + + To prepare a release execute this command: + +------- +mvn release:prepare +------- + + <> If an error occurs, or the process is cancelled, then running this command again will pick up from where the + last one left off. + + If you wish to start again, use: + +------- +mvn release:prepare -Dresume=false +------- + + Alternatively, you can use: + +------- +mvn release:clean release:prepare +------- + + <> If any changes have been made to your source files they might need to be reverted before you restart the + prepare process. You can use <<>> to make the plugin do it for you. + +* Multi-module projects + + You will be prompted for the version number for each module of the project. + If you prefer that every module gets the same version as the parent POM, + you can set the option <<>> to <<>>. Now you will + be asked only once for the release version and the next development version. + +* Generating release POMs + + It is possible to generate a <<>> file for each project that contains the fully resolved project used + at release time as a record for later. As of the 2.0 release, this requires calling an alternate goal: + +--- +mvn release:prepare-with-pom +--- + + This goal is equivalent to the <<>> goal, except that it requires a previous build of the project to + exist to properly populate the <<>> files. + +* Overriding the default tag name format + + By default, if you do not specify a tag name, a default tag name of <<>>-<<>> will be + suggested (and if running non-interactively used). + + You can specify the exact tag name to use from the command line by passing the <<>> property, but if you + want to have the tag name generated, but just change the default pattern, you can use the <<>> + configuration option. + + For example to have the tag name default to the version number prefixed with a <<>> you could configure + your pom like so: + ++----- + + [...] + + [...] + + [...] + + org.apache.maven.plugins + maven-release-plugin + ${project.version} + + v@{project.version} + + + [...] + + [...] + + [...] + ++----- + + The tagNameFormat uses <<<@\{>>> and <<<}>>> as delimiters in order to ensure that the default Maven property + interpolation does not substitute the values before the version transformation has taken place. + + The following properties are supported: + + * <<>> which corresponds to the project's groupId. + + * <<>> which corresponds to the project's artifactId. + + * <<>> which corresponds to the project's release version. + + [] + + The <<>> prefix is optional and may be omitted. \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/rollback-release.apt b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/rollback-release.apt new file mode 100644 index 000000000..84787699b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/rollback-release.apt @@ -0,0 +1,54 @@ + ------ + Rollback a Release + ------ + Edwin Punzalan + ------ + 2010-01-03 + ------ + +~~ Licensed to the Apache Software Foundation (ASF) under one +~~ or more contributor license agreements. See the NOTICE file +~~ distributed with this work for additional information +~~ regarding copyright ownership. The ASF licenses this file +~~ to you under the Apache License, Version 2.0 (the +~~ "License"); you may not use this file except in compliance +~~ with the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, +~~ software distributed under the License is distributed on an +~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~~ KIND, either express or implied. See the License for the +~~ specific language governing permissions and limitations +~~ under the License. + +Rollback a Release + + To rollback a release, the following requirement must be met: + + * You haven't run <<>> on the project. This means that the backup files and the release descriptor from the previous + release command still exist. + + [] + + When a release is rolled back, the following release phases are executed: + + * All project POMs are reverted back to their pre-release state locally, and also in the SCM if the previous release + command was able to successfully make changes in the SCM to the POMs. This is done by using the backup files created during + <<>>. + + * The created branch/tag in SCM for the release is removed. + <> This is not yet implemented so you will need to manually remove the branch/tag from your SCM. + For more info see {{{https://issues.apache.org/jira/browse/MRELEASE-229}MRELEASE-229}}. + + [] + + To rollback a release execute this command: + +------- +mvn release:rollback +------- + + <> If an error occurs, or the process is cancelled, then running this command again will pick up from where the + last one left off. diff --git a/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/run-goals-before-commit.apt.vm b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/run-goals-before-commit.apt.vm new file mode 100644 index 000000000..00563ff3e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/run-goals-before-commit.apt.vm @@ -0,0 +1,54 @@ + ------ + Run Additional Goals Before Commit + ------ + Carlos Sanchez + Brett Porter + John Tolentino + ------ + 2010-01-03 + ------ + +~~ Licensed to the Apache Software Foundation (ASF) under one +~~ or more contributor license agreements. See the NOTICE file +~~ distributed with this work for additional information +~~ regarding copyright ownership. The ASF licenses this file +~~ to you under the Apache License, Version 2.0 (the +~~ "License"); you may not use this file except in compliance +~~ with the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, +~~ software distributed under the License is distributed on an +~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~~ KIND, either express or implied. See the License for the +~~ specific language governing permissions and limitations +~~ under the License. + +Run Additional Goals Before Commit + + To run additional goals after release preparation but before committing, specify them using the <<>> + property. + ++----- + + [...] + + [...] + + [...] + + org.apache.maven.plugins + maven-release-plugin + ${project.version} + + clean verify + + + [...] + + [...] + + [...] + ++----- diff --git a/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/update-versions.apt b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/update-versions.apt new file mode 100644 index 000000000..28e0218a6 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/examples/update-versions.apt @@ -0,0 +1,58 @@ + ------ + Update POM Versions + ------ + Paul Gier + ------ + 2010-01-03 + ------ + +~~ Licensed to the Apache Software Foundation (ASF) under one +~~ or more contributor license agreements. See the NOTICE file +~~ distributed with this work for additional information +~~ regarding copyright ownership. The ASF licenses this file +~~ to you under the Apache License, Version 2.0 (the +~~ "License"); you may not use this file except in compliance +~~ with the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, +~~ software distributed under the License is distributed on an +~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~~ KIND, either express or implied. See the License for the +~~ specific language governing permissions and limitations +~~ under the License. + +Updating POM Versions + + In some situations you may want an easy way to update the version numbers in each POM of a multi-module + project. The <<>> goal is designed to accomplish this. + + To update the version numbers in your POMs, run: + +------- +mvn release:update-versions +------- + + You will be prompted for the version number for each module of the project. If you prefer that each module + version be the same as the parent POM, you can use the option <<>>. + +------- +mvn release:update-versions -DautoVersionSubmodules=true +------- + + In this case you will only be prompted for the desired version number once. + + +* Specify versions on the command line. + + You may want to specify the version(s) to use on the command line. This can be useful for example if you are running + the update in non-interactive mode. The <<>> goal can use the same properties used by the <<>> goal + for specifying the versions to be used. + + +----------- +mvn --batch-mode release:update-versions -DdevelopmentVersion=1.2.0-SNAPSHOT +----------- + + In this example, the local POM will be set to the version 1.2.0-SNAPSHOT diff --git a/Java-base/maven-release/src/maven-release-plugin/src/site/apt/index.apt b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/index.apt new file mode 100644 index 000000000..832be4f46 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/index.apt @@ -0,0 +1,98 @@ + ------ + Introduction + ------ + Carlos Sanchez + Brett Porter + John Tolentino + ------ + 2010-01-03 + ------ + +~~ Licensed to the Apache Software Foundation (ASF) under one +~~ or more contributor license agreements. See the NOTICE file +~~ distributed with this work for additional information +~~ regarding copyright ownership. The ASF licenses this file +~~ to you under the Apache License, Version 2.0 (the +~~ "License"); you may not use this file except in compliance +~~ with the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, +~~ software distributed under the License is distributed on an +~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~~ KIND, either express or implied. See the License for the +~~ specific language governing permissions and limitations +~~ under the License. + +Maven Release Plugin + + This plugin is used to release a project with Maven, saving a lot of repetitive, manual work. + Releasing a project is made in two steps: prepare and perform. + + <> + +* Goals Overview + + * {{{./clean-mojo.html}release:clean}} Clean up after a release preparation. + + * {{{./prepare-mojo.html}release:prepare}} Prepare for a release in SCM. + + * {{{./prepare-with-pom-mojo.html}release:prepare-with-pom}} Prepare for a release in SCM, and generate release POMs + that record the fully resolved projects used. + + * {{{./rollback-mojo.html}release:rollback}} Rollback a previous release. + + * {{{./perform-mojo.html}release:perform}} Perform a release from SCM. + + * {{{./stage-mojo.html}release:stage}} Perform a release from SCM into a staging folder/repository. + + * {{{./branch-mojo.html}release:branch}} Create a branch of the current project with all versions updated. + + * {{{./update-versions-mojo.html}release:update-versions}} Update the versions in the POM(s). + +* Usage + + General instructions on how to use the Release Plugin can be found on the {{{./usage.html}usage page}}. Some more + specific use cases are described in the examples given below. + + In case you still have questions regarding the plugin's usage, please have a look at the {{{./faq.html}FAQ}} and feel + free to contact the {{{./mailing-lists.html}user mailing list}}. The posts to the mailing list are archived and could + already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching + the {{{./mailing-lists.html}mail archive}}. + + If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our + {{{./issue-management.html}issue tracker}}. When creating a new issue, please provide a comprehensive description of your + concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, + entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. + Of course, patches are welcome, too. Contributors can check out the project from our + {{{./scm.html}source repository}} and will find supplementary information in the + {{{http://maven.apache.org/guides/development/guide-helping.html}guide to helping with Maven}}. + +* Examples + + To provide you with better understanding on some usages of the Maven Release Plugin, + you can take a look into the following examples: + + + * {{{./examples/prepare-release.html}Prepare a Release}} + + * {{{./examples/perform-release.html}Perform a Release}} + + * {{{./examples/rollback-release.html}Rollback a Release}} + + * {{{./examples/clean-release.html}Clean a Release}} + + * {{{./examples/generate-release-poms.html}Generate Release POMs}} + + * {{{./examples/lock-files.html}Lock Files During Release}} + + * {{{./examples/run-goals-before-commit.html}Run Additional Goals Before Commit}} + + * {{{./examples/branch.html}Create a Branch}} + + * {{{./examples/non-interactive-release.html}Non-interactive Release}} + + * {{{./examples/update-versions.html}Update POM Versions}} + + [] diff --git a/Java-base/maven-release/src/maven-release-plugin/src/site/apt/usage.apt.vm b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/usage.apt.vm new file mode 100644 index 000000000..e2384ce38 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/site/apt/usage.apt.vm @@ -0,0 +1,153 @@ + ------ + Usage + ------ + Carlos Sanchez + Brett Porter + John Tolentino + Robert Scholte + ------ + 2011-11-10 + ------ + +~~ Licensed to the Apache Software Foundation (ASF) under one +~~ or more contributor license agreements. See the NOTICE file +~~ distributed with this work for additional information +~~ regarding copyright ownership. The ASF licenses this file +~~ to you under the Apache License, Version 2.0 (the +~~ "License"); you may not use this file except in compliance +~~ with the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, +~~ software distributed under the License is distributed on an +~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~~ KIND, either express or implied. See the License for the +~~ specific language governing permissions and limitations +~~ under the License. + +Usage + +* Prepare your project to use the maven-release-plugin + + To be able to make a solid start with the maven-release-plugin, there are 2 things you should include in our pom: + + * the <<>>-section with a <<>> + + * the maven-release-plugin with a locked version + + [] + + The <<>> contains the URL of the Source Control Management system pointing to the folder containing this <<>> + This URL is prefixed with <<>> so the plugin can pick the right implementation for committing and tagging. + The {{{http://maven.apache.org/scm/scms-overview.html}Maven SCM}}-page contains an overview all the supported SCMs, per SCM you can see how the URL should look like. + ++-------- + + + ... + + scm:svn:https://svn.mycompany.com/repos/myapplication/trunk/mycomponent/ + + + + + + org.apache.maven.plugins + maven-release-plugin + ${project.version} + + + ... + + ... + + ++------- + +======================================================================= + + The following are some common scenarios in preparing a release. + +* Use a different username in the SCM server than the one in the operating system + + Most of the SCMs are simply executed as an external command as the current user on your system. If this username is + not the same as the SCM username, you may need to set the following option: + ++------ +mvn -Dusername=your_scm_username release:prepare ++------ + +* Set where to tag the files in Subversion + + This example shows how to set the repository location for all tags to be created in Subversion. + Note that this is not needed if you use the standard SVN layout, where the root project is in <<>>, and + there is a sibling <<>> directory. + ++------------------- + + ... + + + + org.apache.maven.plugins + maven-release-plugin + ${project.version} + + https://svn.mycompany.com/repos/myapplication/releases + + + + ... + + ... + ++------------------- + +* Do a Dry Run + + Since the Release Plugin performs a number of operations that change the project, it may be wise to do a dry run + before a big release or on a new project. To do this, commit all of your files as if you were about to run a full + release and run: + ++------ +mvn release:prepare -DdryRun=true ++------ + + This will ask all the same questions, run the same tests, and output a copy of how the POMs will look after + transformation. You can check the output and review the POMs, then run: + ++------ +mvn release:clean ++------ + + This will remove all of the files created above, and the project will be ready to execute the proper release. + +* Run in Batch Mode + + Sometimes it is desirable to do the commit/tag process on a regular interval (e.g. to produce nightly or integration + builds through a build server). To use the default inputs for the versions and tag information and not prompt for any + values, use Maven's <<<--batch-mode>>> setting: + ++------ +mvn --batch-mode release:prepare ++------ + +* Use a staging repository + + Sometimes it is desirable to deploy a pre-release to be approved before made publicly available. One option is to + create release candidates versions using the <<>> goal, but the final deployed artifact will NOT + be the exact one that has been approved as RCx. + + A common solution is to use a staging repository, where a test-version is deployed with it's documentation for + review. If all is fine, it is then copied to the public repository. Using this strategy, the artifact that has + been tested IS the one that is deployed. + + The <<>> goal uses this strategy. It replaces the <<>> goal and does the same + tasks, but requires a <<>> parameter. It will automatically re-configure the <<>> and + <<>> goals to use the staging strategy. + + After the release is complete, the <<>> and other release files will NOT be removed, so that + you can still execute a <<>> if some error has been detected and a new candidate must + be created after some fixes. You just need to use a distinct tag in SCM, or rename the one that has been created + if the SCM provider supports renaming tags. diff --git a/Java-base/maven-release/src/maven-release-plugin/src/site/fml/faq.fml b/Java-base/maven-release/src/maven-release-plugin/src/site/fml/faq.fml new file mode 100644 index 000000000..bdf41f879 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/site/fml/faq.fml @@ -0,0 +1,101 @@ + + + + + + + + + When releasing from a parent POM, won't all its modules have the same release version and dev version as + this parent? + + +

    Maven Release Plugin will prompt for each project's version.

    +
    +
    + + How can I release a parent POM without releasing all its modules? + + +

    You need to pass the -N flag to Maven and configure the Release Plugin to pass the + -N flag on its forked builds with the -Darguments flag.

    +

    Here's an example:

    + +mvn -N -Darguments=-N release:prepare +mvn -N -Darguments=-N release:perform + +
    +
    + + How can I hide my username and password? + +

    Add a server-entry to your settings.xml, where you define your credentials (see settings.xml#servers for more details). + Since you can't set an id for the scm in your pom.xml, you should add a property pointing to the server-id. +

    + + + ... + + my-scm-server + + +]]> + +
    +
    + + How can I customize the comment prefix of a commit during release preparation? + +

    + By default the plugin will prefix the comment with [maven-release-plugin] . + You can change this by adding -DscmCommentPrefix=#42 to the Maven command.
    + If you need to end this with a linebreak, add ${line.separator}.
    + If the comment prefix contains whitespace characters, surround the argument with quotes. +

    +

    + When using the plugin-configuration, you can't end with a space, because Plexus will trim the content. + But you can end with a linebreak just like the example below: +

    + + + #42${line.separator} + ... + +]]> + +
    +
    + + Why is release:prepare failing when trying to tag with + "svn: Path '...' does not exist in revision ..." + +

    If the pom.xml has no scm-section but inherits one from its parent, the prepare goal will fail + when trying to tag. The message will be something like:

    +
    svn: Path '...' does not exist in revision ...
    +

    To fix it, roll-back the release, add the scm section to the pom.xml, commit and retry the release.

    +
    +
    +
    +
    \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/site/site.xml b/Java-base/maven-release/src/maven-release-plugin/src/site/site.xml new file mode 100644 index 000000000..a6907be57 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/site/site.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/CleanReleaseMojoTest.java b/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/CleanReleaseMojoTest.java new file mode 100644 index 000000000..d80848a54 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/CleanReleaseMojoTest.java @@ -0,0 +1,75 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; + +import java.io.File; + +import org.apache.maven.plugin.testing.AbstractMojoTestCase; +import org.apache.maven.shared.release.ReleaseCleanRequest; +import org.apache.maven.shared.release.ReleaseManager; +import org.mockito.ArgumentCaptor; + +/** + * Test release:clean. + * + * @author Brett Porter + */ +public class CleanReleaseMojoTest + extends AbstractMojoTestCase +{ + protected CleanReleaseMojo mojo; + + private File workingDirectory; + + protected void setUp() + throws Exception + { + super.setUp(); + + File testFile = getTestFile( "target/test-classes/mojos/clean/clean.xml" ); + mojo = (CleanReleaseMojo) lookupMojo( "clean", testFile ); + workingDirectory = testFile.getParentFile(); + mojo.setBasedir( workingDirectory ); + } + + public void testClean() + throws Exception + { + // prepare + ArgumentCaptor request = ArgumentCaptor.forClass( ReleaseCleanRequest.class ); + + ReleaseManager mock = mock( ReleaseManager.class ); + mojo.setReleaseManager( mock ); + + // execute + mojo.execute(); + + // verify + verify( mock ).clean( request.capture() ); + + assertEquals( mojo.getReactorProjects(), request.getValue().getReactorProjects() ); + + verifyNoMoreInteractions( mock ); + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PerformReleaseMojoTest.java b/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PerformReleaseMojoTest.java new file mode 100644 index 000000000..c423c405a --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PerformReleaseMojoTest.java @@ -0,0 +1,396 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.DistributionManagement; +import org.apache.maven.model.Profile; +import org.apache.maven.model.Site; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.testing.AbstractMojoTestCase; +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseManager; +import org.apache.maven.shared.release.ReleasePerformRequest; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.mockito.ArgumentCaptor; + +/** + * Test release:perform. + * + * @author Brett Porter + */ +public class PerformReleaseMojoTest + extends AbstractMojoTestCase +{ + private File workingDirectory; + + public void testPerform() + throws Exception + { + PerformReleaseMojo mojo = getMojoWithProjectSite( "perform.xml" ); + + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( mojo ); + builder.setWorkingDirectory( workingDirectory.getAbsolutePath() ); + File checkoutDirectory = getTestFile( "target/checkout" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + builder.setPerformGoals( "deploy site-deploy" ); + + ReleaseManager mock = mock( ReleaseManager.class ); + mojo.setReleaseManager( mock ); + + // execute + mojo.execute(); + + // verify + ArgumentCaptor argument = ArgumentCaptor.forClass(ReleasePerformRequest.class); + verify( mock ).perform( argument.capture() ); + assertNotNull( argument.getValue().getReleaseDescriptorBuilder() ); + assertNotNull( argument.getValue().getReleaseEnvironment() ); + assertNotNull( argument.getValue().getReactorProjects() ); + assertEquals( Boolean.FALSE, argument.getValue().getDryRun() ); + verifyNoMoreInteractions( mock ); + } + + public void testPerformWithFlatStructure() + throws Exception + { + PerformReleaseMojo mojo = getMojoWithProjectSite( "perform-with-flat-structure.xml" ); + + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( mojo ); + builder.setWorkingDirectory( workingDirectory.getAbsolutePath() ); + File checkoutDirectory = getTestFile( "target/checkout" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + builder.setPerformGoals( "deploy" ); + builder.setScmSourceUrl( "scm:svn:file://localhost/target/svnroot/flat-multi-module/trunk/root-project" ); + + ReleaseManager mock = mock( ReleaseManager.class ); + mojo.setReleaseManager( mock ); + + // execute + mojo.execute(); + + // verify + ArgumentCaptor argument = ArgumentCaptor.forClass(ReleasePerformRequest.class); + verify( mock ).perform( argument.capture() ); + assertNotNull( argument.getValue().getReleaseDescriptorBuilder() ); + assertNotNull( argument.getValue().getReleaseEnvironment() ); + assertNotNull( argument.getValue().getReactorProjects() ); + assertEquals( Boolean.FALSE, argument.getValue().getDryRun() ); + verifyNoMoreInteractions( mock ); + } + + + public void testPerformWithoutSite() + throws Exception + { + File testFileDirectory = getTestFile( "target/test-classes/mojos/perform/" ); + PerformReleaseMojo mojo = + (PerformReleaseMojo) lookupMojo( "perform", new File( testFileDirectory, "perform-without-site.xml" ) ); + mojo.setBasedir( testFileDirectory ); + mojo.setPomFileName( "pom.xml" ); + + MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" ); + setVariableValueToObject( mojo, "session", newMavenSession( project ) ); + + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( mojo ); + builder.setWorkingDirectory( workingDirectory.getAbsolutePath() ); + File checkoutDirectory = getTestFile( "target/checkout" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + builder.setPerformGoals( "deploy" ); + + ReleaseManager mock = mock( ReleaseManager.class ); + mojo.setReleaseManager( mock ); + + // execute + mojo.execute(); + + // verify + ArgumentCaptor argument = ArgumentCaptor.forClass(ReleasePerformRequest.class); + verify( mock ).perform( argument.capture() ); + assertNotNull( argument.getValue().getReleaseDescriptorBuilder() ); + assertNotNull( argument.getValue().getReleaseEnvironment() ); + assertNotNull( argument.getValue().getReactorProjects() ); + assertEquals( Boolean.FALSE, argument.getValue().getDryRun() ); + verifyNoMoreInteractions( mock ); + } + + private PerformReleaseMojo getMojoWithProjectSite( String fileName ) + throws Exception + { + PerformReleaseMojo mojo = (PerformReleaseMojo) lookupMojo( "perform", new File( workingDirectory, fileName ) ); + mojo.setBasedir( workingDirectory ); + mojo.setPomFileName( fileName ); + + MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" ); + DistributionManagement distributionManagement = new DistributionManagement(); + distributionManagement.setSite( new Site() ); + project.setDistributionManagement( distributionManagement ); + + setVariableValueToObject( mojo, "session", newMavenSession( project ) ); + + return mojo; + } + + public void testPerformWithExecutionException() + throws Exception + { + PerformReleaseMojo mojo = getMojoWithProjectSite( "perform.xml" ); + + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( mojo ); + builder.setWorkingDirectory( workingDirectory.getAbsolutePath() ); + File checkoutDirectory = getTestFile( "target/checkout" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + builder.setPerformGoals( "deploy site-deploy" ); + + ReleaseManager mock = mock( ReleaseManager.class ); + doThrow( new ReleaseExecutionException( "..." ) ).when( mock ).perform( isA( ReleasePerformRequest.class ) ); + mojo.setReleaseManager( mock ); + + // execute + try + { + mojo.execute(); + + fail( "Should have thrown an exception" ); + } + catch ( MojoExecutionException e ) + { + assertEquals( "Check cause", ReleaseExecutionException.class, e.getCause().getClass() ); + } + + // verify + ArgumentCaptor argument = ArgumentCaptor.forClass(ReleasePerformRequest.class); + verify( mock ).perform( argument.capture() ); + assertNotNull( argument.getValue().getReleaseDescriptorBuilder() ); + assertNotNull( argument.getValue().getReleaseEnvironment() ); + assertNotNull( argument.getValue().getReactorProjects() ); + assertEquals( Boolean.FALSE, argument.getValue().getDryRun() ); + + verifyNoMoreInteractions( mock ); + } + + public void testPerformWithExecutionFailure() + throws Exception + { + PerformReleaseMojo mojo = getMojoWithProjectSite( "perform.xml" ); + + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( mojo ); + builder.setWorkingDirectory( workingDirectory.getAbsolutePath() ); + File checkoutDirectory = getTestFile( "target/checkout" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + builder.setPerformGoals( "deploy site-deploy" ); + + ReleaseManager mock = mock( ReleaseManager.class ); + ReleaseFailureException cause = new ReleaseFailureException( "..." ); + doThrow( cause ).when( mock ).perform( isA( ReleasePerformRequest.class ) ); + + mojo.setReleaseManager( mock ); + + // execute + try + { + mojo.execute(); + + fail( "Should have thrown an exception" ); + } + catch ( MojoFailureException e ) + { + assertEquals( "Check cause exists", cause, e.getCause() ); + } + + // verify + ArgumentCaptor argument = ArgumentCaptor.forClass(ReleasePerformRequest.class); + verify( mock ).perform( argument.capture() ); + assertNotNull( argument.getValue().getReleaseDescriptorBuilder() ); + assertNotNull( argument.getValue().getReleaseEnvironment() ); + assertNotNull( argument.getValue().getReactorProjects() ); + assertEquals( Boolean.FALSE, argument.getValue().getDryRun() ); + + verifyNoMoreInteractions( mock ); + } + + public void testPerformWithScm() + throws Exception + { + PerformReleaseMojo mojo = getMojoWithProjectSite( "perform-with-scm.xml" ); + + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( mojo ); + builder.setWorkingDirectory( workingDirectory.getAbsolutePath() ); + File checkoutDirectory = getTestFile( "target/checkout" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + builder.setPerformGoals( "deploy site-deploy" ); + builder.setScmSourceUrl( "scm-url" ); + + ReleaseManager mock = mock( ReleaseManager.class ); + mojo.setReleaseManager( mock ); + + // execute + mojo.execute(); + + // verify + ArgumentCaptor argument = ArgumentCaptor.forClass(ReleasePerformRequest.class); + verify( mock ).perform( argument.capture() ); + assertNotNull( argument.getValue().getReleaseDescriptorBuilder() ); + assertNotNull( argument.getValue().getReleaseEnvironment() ); + assertNotNull( argument.getValue().getReactorProjects() ); + assertEquals( Boolean.FALSE, argument.getValue().getDryRun() ); + + verifyNoMoreInteractions( mock ); + } + + public void testPerformWithProfiles() + throws Exception + { + PerformReleaseMojo mojo = getMojoWithProjectSite( "perform.xml" ); + + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( mojo ); + builder.setWorkingDirectory( workingDirectory.getAbsolutePath() ); + File checkoutDirectory = getTestFile( "target/checkout" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + builder.setPerformGoals( "deploy site-deploy" ); + builder.setAdditionalArguments( "-P prof1,2prof" ); + + MavenSession session = (MavenSession) getVariableValueFromObject( mojo, "session"); + Profile profile1 = new Profile(); + profile1.setId( "prof1" ); + session.getRequest().addProfile( profile1 ); + Profile profile2 = new Profile(); + profile2.setId( "2prof" ); + session.getRequest().addProfile( profile2 ); + session.getRequest().setActiveProfiles( Arrays.asList( "prof1", "2prof" ) ); + + ReleaseManager mock = mock( ReleaseManager.class ); + mojo.setReleaseManager( mock ); + + // execute + mojo.execute(); + + // verify + ArgumentCaptor argument = ArgumentCaptor.forClass(ReleasePerformRequest.class); + verify( mock ).perform( argument.capture() ); + assertNotNull( argument.getValue().getReleaseDescriptorBuilder() ); + assertNotNull( argument.getValue().getReleaseEnvironment() ); + assertNotNull( argument.getValue().getReactorProjects() ); + assertEquals( Boolean.FALSE, argument.getValue().getDryRun() ); + + verifyNoMoreInteractions( mock ); + } + + public void testPerformWithProfilesAndArguments() + throws Exception + { + PerformReleaseMojo mojo = getMojoWithProjectSite( "perform-with-args.xml" ); + + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( mojo ); + builder.setWorkingDirectory( workingDirectory.getAbsolutePath() ); + File checkoutDirectory = getTestFile( "target/checkout" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + builder.setPerformGoals( "deploy site-deploy" ); + builder.setAdditionalArguments( "-Dmaven.test.skip=true -P prof1,2prof" ); + + MavenSession session = (MavenSession) getVariableValueFromObject( mojo, "session"); + Profile profile1 = new Profile(); + profile1.setId( "prof1" ); + session.getRequest().addProfile( profile1 ); + Profile profile2 = new Profile(); + profile2.setId( "2prof" ); + session.getRequest().addProfile( profile2 ); + session.getRequest().setActiveProfiles( Arrays.asList( "prof1", "2prof" ) ); + + ReleaseManager mock = mock( ReleaseManager.class ); + mojo.setReleaseManager( mock ); + + // execute + mojo.execute(); + + // verify + ArgumentCaptor argument = ArgumentCaptor.forClass(ReleasePerformRequest.class); + verify( mock ).perform( argument.capture() ); + assertNotNull( argument.getValue().getReleaseDescriptorBuilder() ); + assertNotNull( argument.getValue().getReleaseEnvironment() ); + assertNotNull( argument.getValue().getReactorProjects() ); + assertEquals( Boolean.FALSE, argument.getValue().getDryRun() ); + + verifyNoMoreInteractions( mock ); + } + + public void testPerformWithMultilineGoals() + throws Exception + { + PerformReleaseMojo mojo = getMojoWithProjectSite( "perform-with-multiline-goals.xml" ); + + ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( mojo ); + builder.setWorkingDirectory( workingDirectory.getAbsolutePath() ); + File checkoutDirectory = getTestFile( "target/checkout" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + builder.setPerformGoals( "deploy site-deploy" ); + + ReleaseManager mock = mock( ReleaseManager.class ); + mojo.setReleaseManager( mock ); + + // execute + mojo.execute(); + + // verify + ArgumentCaptor argument = ArgumentCaptor.forClass(ReleasePerformRequest.class); + verify( mock ).perform( argument.capture() ); + assertNotNull( argument.getValue().getReleaseDescriptorBuilder() ); + assertNotNull( argument.getValue().getReleaseEnvironment() ); + assertNotNull( argument.getValue().getReactorProjects() ); + assertEquals( Boolean.FALSE, argument.getValue().getDryRun() ); + + verifyNoMoreInteractions( mock ); + } + + private ReleaseDescriptorBuilder createReleaseDescriptorBuilder( PerformReleaseMojo mojo ) throws Exception + { + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + + @SuppressWarnings( "unchecked" ) + List reactorProjects = (List) getVariableValueFromObject( mojo, "reactorProjects" ); + + for ( MavenProject project : reactorProjects ) + { + builder.putOriginalVersion( project.getGroupId() + ':' + project.getArtifactId(), project.getVersion() ); + } + + return builder; + } + + protected void setUp() + throws Exception + { + super.setUp(); + workingDirectory = getTestFile( "target/test-classes/mojos/perform" ); + } +} \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PrepareReleaseMojoTest.java b/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PrepareReleaseMojoTest.java new file mode 100644 index 000000000..8c1b39724 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/PrepareReleaseMojoTest.java @@ -0,0 +1,276 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertThat; + +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; + +import java.io.File; +import java.util.Collections; +import java.util.List; +import java.util.Properties; + +import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.testing.AbstractMojoTestCase; +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.ReleaseExecutionException; +import org.apache.maven.shared.release.ReleaseFailureException; +import org.apache.maven.shared.release.ReleaseManager; +import org.apache.maven.shared.release.ReleasePrepareRequest; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.mockito.ArgumentCaptor; + +/** + * Test release:prepare. + * + * @author Brett Porter + */ +public class PrepareReleaseMojoTest + extends AbstractMojoTestCase +{ + private void setDefaults( PrepareReleaseMojo mojo ) + throws IllegalAccessException + { + setVariableValueToObject( mojo, "updateWorkingCopyVersions", Boolean.TRUE ); + } + + public void testPrepare() + throws Exception + { + File testFile = getTestFile( "target/test-classes/mojos/prepare/prepare.xml" ); + final PrepareReleaseMojo mojo = (PrepareReleaseMojo) lookupMojo( "prepare", testFile ); + setDefaults( mojo ); + mojo.setBasedir( testFile.getParentFile() ); + mojo.setPomFileName( "pom.xml" ); + mojo.session = new MavenSession( null, null, null, null, null, null, null, null, null ) + { + public Properties getExecutionProperties() + { + return new Properties(); + }; + + @Override + public List getProjects() + { + return Collections.singletonList( mojo.project ); + } + }; + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setWorkingDirectory( testFile.getParentFile().getAbsolutePath() ); + builder.setUpdateDependencies( false ); + + ReleaseManager mock = mock( ReleaseManager.class ); + mojo.setReleaseManager( mock ); + + // execute + mojo.execute(); + + ArgumentCaptor prepareRequest = ArgumentCaptor.forClass( ReleasePrepareRequest.class ); + + // verify + verify( mock ).prepare( prepareRequest.capture() ); + + assertThat( prepareRequest.getValue().getReleaseDescriptorBuilder(), + is( instanceOf( ReleaseDescriptorBuilder.class ) ) ); + assertThat( prepareRequest.getValue().getReleaseEnvironment(), is( instanceOf( ReleaseEnvironment.class ) ) ); + assertThat( prepareRequest.getValue().getReactorProjects(), is( notNullValue() ) ); + assertThat( prepareRequest.getValue().getResume(), is( true ) ); + assertThat( prepareRequest.getValue().getDryRun(), is( false ) ); + } + + public void testPrepareWithExecutionException() + throws Exception + { + File testFile = getTestFile( "target/test-classes/mojos/prepare/prepare.xml" ); + final PrepareReleaseMojo mojo = (PrepareReleaseMojo) lookupMojo( "prepare", testFile ); + setDefaults( mojo ); + mojo.setBasedir( testFile.getParentFile() ); + mojo.setPomFileName( "pom.xml" ); + mojo.session = new MavenSession( null, null, null, null, null, null, null, null, null ) + { + public Properties getExecutionProperties(){ + return new Properties(); + }; + + @Override + public List getProjects() + { + return Collections.singletonList( mojo.project ); + } + }; + + ReleaseManager mock = mock( ReleaseManager.class ); + doThrow( new ReleaseExecutionException( "..." ) ).when( mock ).prepare( isA( ReleasePrepareRequest.class ) ); + mojo.setReleaseManager( mock ); + + //execute + try + { + mojo.execute(); + + fail( "Should have thrown an exception" ); + } + catch ( MojoExecutionException e ) + { + assertEquals( "Check cause", ReleaseExecutionException.class, e.getCause().getClass() ); + } + + // verify + verify( mock ).prepare( isA( ReleasePrepareRequest.class ) ); + verifyNoMoreInteractions( mock ); + } + + public void testPrepareWithExecutionFailure() + throws Exception + { + File testFile = getTestFile( "target/test-classes/mojos/prepare/prepare.xml" ); + final PrepareReleaseMojo mojo = (PrepareReleaseMojo) lookupMojo( "prepare", testFile ); + setDefaults( mojo ); + mojo.setBasedir( testFile.getParentFile() ); + mojo.setPomFileName( "pom.xml" ); + mojo.session = new MavenSession( null, null, null, null, null, null, null, null, null ) + { + public Properties getExecutionProperties(){ + return new Properties(); + }; + + @Override + public List getProjects() + { + return Collections.singletonList( mojo.project ); + } + }; + + ReleaseManager mock = mock( ReleaseManager.class ); + ReleaseFailureException cause = new ReleaseFailureException( "..." ); + doThrow( cause ).when( mock ).prepare( isA( ReleasePrepareRequest.class ) ); + mojo.setReleaseManager( mock ); + + // execute + try + { + mojo.execute(); + + fail( "Should have thrown an exception" ); + } + catch ( MojoFailureException e ) + { + assertEquals( "Check cause exists", cause, e.getCause() ); + } + // verify + verify( mock ).prepare( isA( ReleasePrepareRequest.class ) ); + verifyNoMoreInteractions( mock ); + } + +/* + public void testPerformWithScm() + throws Exception + { + PerformReleaseMojo mojo = (PerformReleaseMojo) lookupMojo( "perform", getTestFile( + "target/test-classes/mojos/perform/perform-with-scm.xml" ) ); + + ReleaseDescriptor releaseConfiguration = new ReleaseDescriptor(); + releaseConfiguration.setSettings( mojo.getSettings() ); + releaseConfiguration.setUrl( "scm-url" ); + + Mock mock = new Mock( ReleaseManager.class ); + Constraint[] constraints = new Constraint[]{new IsEqual( releaseConfiguration ), + new IsEqual( new File( getBasedir(), "target/checkout" ) ), new IsEqual( "deploy site-deploy" ), + new IsEqual( Boolean.TRUE )}; + mock.expects( new InvokeOnceMatcher() ).method( "perform" ).with( constraints ); + mojo.setReleaseManager( (ReleaseManager) mock.proxy() ); + + mojo.execute(); + + assertTrue( true ); + } + + public void testPerformWithProfiles() + throws Exception + { + PerformReleaseMojo mojo = (PerformReleaseMojo) lookupMojo( "perform", getTestFile( + "target/test-classes/mojos/perform/perform.xml" ) ); + + ReleaseDescriptor releaseConfiguration = new ReleaseDescriptor(); + releaseConfiguration.setSettings( mojo.getSettings() ); + releaseConfiguration.setAdditionalArguments( "-P prof1,2prof" ); + + MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" ); + Profile profile1 = new Profile(); + profile1.setId( "prof1" ); + Profile profile2 = new Profile(); + profile2.setId( "2prof" ); + project.setActiveProfiles( Arrays.asList( new Profile[]{profile1, profile2} ) ); + + Mock mock = new Mock( ReleaseManager.class ); + Constraint[] constraints = new Constraint[]{new IsEqual( releaseConfiguration ), + new IsEqual( new File( getBasedir(), "target/checkout" ) ), new IsEqual( "deploy site-deploy" ), + new IsEqual( Boolean.TRUE )}; + mock.expects( new InvokeOnceMatcher() ).method( "perform" ).with( constraints ); + mojo.setReleaseManager( (ReleaseManager) mock.proxy() ); + + mojo.execute(); + + assertTrue( true ); + } + + public void testPerformWithProfilesAndArguments() + throws Exception + { + PerformReleaseMojo mojo = (PerformReleaseMojo) lookupMojo( "perform", getTestFile( + "target/test-classes/mojos/perform/perform-with-args.xml" ) ); + + ReleaseDescriptor releaseConfiguration = new ReleaseDescriptor(); + releaseConfiguration.setSettings( mojo.getSettings() ); + releaseConfiguration.setAdditionalArguments( "-Dmaven.test.skip=true -P prof1,2prof" ); + + MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" ); + Profile profile1 = new Profile(); + profile1.setId( "prof1" ); + Profile profile2 = new Profile(); + profile2.setId( "2prof" ); + project.setActiveProfiles( Arrays.asList( new Profile[]{profile1, profile2} ) ); + + Mock mock = new Mock( ReleaseManager.class ); + Constraint[] constraints = new Constraint[]{new IsEqual( releaseConfiguration ), + new IsEqual( new File( getBasedir(), "target/checkout" ) ), new IsEqual( "deploy site-deploy" ), + new IsEqual( Boolean.TRUE )}; + mock.expects( new InvokeOnceMatcher() ).method( "perform" ).with( constraints ); + mojo.setReleaseManager( (ReleaseManager) mock.proxy() ); + + mojo.execute(); + + assertTrue( true ); + } +*/ +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/StageReleaseMojoTest.java b/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/StageReleaseMojoTest.java new file mode 100644 index 000000000..a4c6ebbbe --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/StageReleaseMojoTest.java @@ -0,0 +1,114 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; + +import java.io.File; + +import org.apache.maven.model.DistributionManagement; +import org.apache.maven.model.Site; +import org.apache.maven.plugin.testing.AbstractMojoTestCase; +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.release.ReleaseManager; +import org.apache.maven.shared.release.ReleasePerformRequest; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.mockito.ArgumentCaptor; + +/** + * Test release:stage. + * + * @author Brett Porter + */ +public class StageReleaseMojoTest + extends AbstractMojoTestCase +{ + private File workingDirectory; + + public void testStage() + throws Exception + { + StageReleaseMojo mojo = getMojoWithProjectSite( "stage.xml" ); + + ReleaseDescriptorBuilder builder = new ReleaseDescriptorBuilder(); + builder.setWorkingDirectory( workingDirectory.getAbsolutePath() ); + File checkoutDirectory = getTestFile( "target/checkout" ); + builder.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() ); + builder.setPerformGoals( "deploy site:stage-deploy" ); + builder.setAdditionalArguments( "-DaltDeploymentRepository=\"staging\"" ); + + ReleasePerformRequest performRequest = new ReleasePerformRequest(); + performRequest.setReleaseDescriptorBuilder( builder ); + performRequest.setReleaseEnvironment( mojo.getReleaseEnvironment() ); + performRequest.setReactorProjects( mojo.getReactorProjects() ); + performRequest.setDryRun( false ); + + ReleaseManager mock = mock( ReleaseManager.class ); + mojo.setReleaseManager( mock ); + + mojo.execute(); + + // verify + ArgumentCaptor argument = ArgumentCaptor.forClass(ReleasePerformRequest.class); + verify( mock ).perform( argument.capture() ); + assertNotNull( argument.getValue().getReleaseDescriptorBuilder() ); + assertNotNull( argument.getValue().getReleaseEnvironment() ); + assertNotNull( argument.getValue().getReactorProjects() ); + assertEquals( Boolean.FALSE, argument.getValue().getDryRun() ); + verifyNoMoreInteractions( mock ); + } + + public void testCreateGoals() + throws Exception + { + StageReleaseMojo mojo = getMojoWithProjectSite( "stage.xml" ); + mojo.createGoals(); + assertEquals( "deploy site:stage-deploy", mojo.goals ); + mojo.goals = "deploy site:deploy"; + mojo.createGoals(); + assertEquals( "deploy site:stage-deploy", mojo.goals ); + } + + private StageReleaseMojo getMojoWithProjectSite( String fileName ) + throws Exception + { + StageReleaseMojo mojo = (StageReleaseMojo) lookupMojo( "stage", new File( workingDirectory, fileName ) ); + mojo.setBasedir( workingDirectory ); + mojo.setPomFileName( "pom.xml" ); + + MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" ); + DistributionManagement distributionManagement = new DistributionManagement(); + distributionManagement.setSite( new Site() ); + project.setDistributionManagement( distributionManagement ); + + setVariableValueToObject( mojo, "session", newMavenSession( project ) ); + + return mojo; + } + + protected void setUp() + throws Exception + { + super.setUp(); + workingDirectory = getTestFile( "target/test-classes/mojos/stage" ); + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/stubs/FlatMultiModuleMavenProjectStub.java b/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/stubs/FlatMultiModuleMavenProjectStub.java new file mode 100644 index 000000000..afb33f87b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/stubs/FlatMultiModuleMavenProjectStub.java @@ -0,0 +1,105 @@ +package org.apache.maven.plugins.release.stubs; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.DistributionManagement; +import org.apache.maven.model.Model; +import org.apache.maven.model.Scm; + +/** + * Stub for a MavenProject with a flat structure. + *

    + * TODO: shouldn't need to do this, but the "stub" in the harness just throws away values you set. + * Just overriding the ones I need for this plugin. + * + * @author Maria Odea Ching + */ +/* + * @noinspection ClassNameSameAsAncestorName + */ +public class FlatMultiModuleMavenProjectStub + extends org.apache.maven.plugin.testing.stubs.MavenProjectStub +{ + public void setDistributionManagement( DistributionManagement distributionManagement ) + { + getModel().setDistributionManagement( distributionManagement ); + } + + public Model getModel() + { + Model model = super.getModel(); + if ( model == null ) + { + model = new Model(); + setModel( model ); + } + return model; + } + + public DistributionManagement getDistributionManagement() + { + return getModel().getDistributionManagement(); + } + + public List getModules() + { + List modules = new ArrayList(); + modules.add( "../core" ); + modules.add( "../webapp" ); + modules.add( "../commons" ); + + return modules; + } + + public File getBasedir() + { + return new File( "/flat-multi-module/root-project" ).getAbsoluteFile(); + } + + public Scm getScm() + { + Scm scm = new Scm(); + scm.setConnection( "scm:svn:file://localhost/target/svnroot/flat-multi-module/trunk/root-project" ); + + return scm; + } + + @Override + public String getGroupId() + { + return "GROUPID"; + } + + @Override + public String getArtifactId() + { + return "ARTIFACTID"; + } + + @Override + public String getVersion() + { + return "VERSION"; + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/stubs/MavenProjectStub.java b/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/stubs/MavenProjectStub.java new file mode 100644 index 000000000..63eefa4d0 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/stubs/MavenProjectStub.java @@ -0,0 +1,75 @@ +package org.apache.maven.plugins.release.stubs; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.model.DistributionManagement; +import org.apache.maven.model.Model; + +/** + * Stub for MavenProject. + *

    + * TODO: shouldn't need to do this, but the "stub" in the harness just throws away values you set. + * Just overriding the ones I need for this plugin. + * + * @author Brett Porter + * @noinspection ClassNameSameAsAncestorName + */ +public class MavenProjectStub + extends org.apache.maven.plugin.testing.stubs.MavenProjectStub +{ + public void setDistributionManagement( DistributionManagement distributionManagement ) + { + getModel().setDistributionManagement( distributionManagement ); + } + + public Model getModel() + { + Model model = super.getModel(); + if ( model == null ) + { + model = new Model(); + setModel( model ); + } + return model; + } + + public DistributionManagement getDistributionManagement() + { + return getModel().getDistributionManagement(); + } + + @Override + public String getGroupId() + { + return "GROUPID"; + } + + @Override + public String getArtifactId() + { + return "ARTIFACTID"; + } + + @Override + public String getVersion() + { + return "VERSION"; + } +} diff --git a/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/clean/clean.xml b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/clean/clean.xml new file mode 100644 index 000000000..58832e50c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/clean/clean.xml @@ -0,0 +1,34 @@ + + + + + + + + maven-release-plugin + + + + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-args.xml b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-args.xml new file mode 100644 index 000000000..14af0dca5 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-args.xml @@ -0,0 +1,40 @@ + + + + + + + + maven-release-plugin + + + + + + + ${basedir}/target/checkout + true + deploy site-deploy + -Dmaven.test.skip=true + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-flat-structure.xml b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-flat-structure.xml new file mode 100644 index 000000000..32e25fcb2 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-flat-structure.xml @@ -0,0 +1,40 @@ + + + + + + + + maven-release-plugin + + + + + + + ${basedir}/target/checkout + true + scm:svn:file://localhost/target/svnroot/flat-multi-module/trunk/root-project + deploy + + + + + diff --git a/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-multiline-goals.xml b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-multiline-goals.xml new file mode 100644 index 000000000..f54463988 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-multiline-goals.xml @@ -0,0 +1,42 @@ + + + + + + + + maven-release-plugin + + + + + + + ${basedir}/target/checkout + true + + deploy + site-deploy + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-scm.xml b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-scm.xml new file mode 100644 index 000000000..cb8a86603 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-with-scm.xml @@ -0,0 +1,40 @@ + + + + + + + + maven-release-plugin + + + + + + + ${basedir}/target/checkout + true + scm-url + deploy site-deploy + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-without-site.xml b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-without-site.xml new file mode 100644 index 000000000..be9fcbb0b --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform-without-site.xml @@ -0,0 +1,39 @@ + + + + + + + + maven-release-plugin + + + + + + + ${basedir}/target/checkout + deploy + true + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform.xml b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform.xml new file mode 100644 index 000000000..0580f0042 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/perform/perform.xml @@ -0,0 +1,39 @@ + + + + + + + + maven-release-plugin + + + + + + + ${basedir}/target/checkout + deploy site-deploy + true + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/prepare/prepare.xml b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/prepare/prepare.xml new file mode 100644 index 000000000..623ff2b86 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/prepare/prepare.xml @@ -0,0 +1,37 @@ + + + + + + + + maven-release-plugin + + + + + + + true + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/stage/stage.xml b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/stage/stage.xml new file mode 100644 index 000000000..d1ac5835e --- /dev/null +++ b/Java-base/maven-release/src/maven-release-plugin/src/test/resources/mojos/stage/stage.xml @@ -0,0 +1,40 @@ + + + + + + + + maven-release-plugin + + + + + + + ${basedir}/target/checkout + staging + deploy site-deploy + true + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/pom.xml b/Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/pom.xml new file mode 100644 index 000000000..8c8eb2ca4 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/pom.xml @@ -0,0 +1,84 @@ + + + + + 4.0.0 + + + org.apache.maven.release + maven-release + 3.0.0-SNAPSHOT + ../.. + + + maven-release-oddeven-policy + + Maven Release Odd-Even Policy + + A version policy that proposes even version numbers only for releases and odd numbers for development + + + + true + + + + + org.apache.maven.release + maven-release-api + ${project.version} + + + org.eclipse.aether + aether-util + 1.0.0.v20140518 + + + org.codehaus.plexus + plexus-component-annotations + true + + + + junit + junit + test + + + + + + + org.codehaus.plexus + plexus-component-metadata + + + process-classes + + generate-metadata + + + + + + + + diff --git a/Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/main/java/org/apache/maven/shared/release/policy/oddeven/OddEvenVersionPolicy.java b/Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/main/java/org/apache/maven/shared/release/policy/oddeven/OddEvenVersionPolicy.java new file mode 100644 index 000000000..2aedf9c6c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/main/java/org/apache/maven/shared/release/policy/oddeven/OddEvenVersionPolicy.java @@ -0,0 +1,142 @@ +package org.apache.maven.shared.release.policy.oddeven; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.shared.release.policy.PolicyException; +import org.apache.maven.shared.release.policy.version.VersionPolicy; +import org.apache.maven.shared.release.policy.version.VersionPolicyRequest; +import org.apache.maven.shared.release.policy.version.VersionPolicyResult; +import org.apache.maven.shared.release.versions.Version; +import org.apache.maven.shared.release.versions.VersionParseException; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.util.StringUtils; + +/** + * A {@link VersionPolicy} implementation that propose even version numbers only for releases and odd + * numbers for development. For example:

      + *
    • 1.0.0-SNAPSHOT gets 1.0.0 for next release,
    • + *
    • 1.0.1-SNAPSHOT gets 1.0.2 for next release,
    • + *
    • 1.0.2 gets 1.0.3-SNAPSHOT for next development version.
    • + *
    + */ +@Component( + role = VersionPolicy.class, + hint = "OddEvenVersionPolicy", + description = "A VersionPolicy implementation that selects even version numbers only for releases" +) +public final class OddEvenVersionPolicy + implements VersionPolicy +{ + + @Override + public VersionPolicyResult getReleaseVersion( VersionPolicyRequest request ) + throws PolicyException + { + return calculateNextVersion( request, false ); + } + + @Override + public VersionPolicyResult getDevelopmentVersion( VersionPolicyRequest request ) + throws PolicyException + { + return calculateNextVersion( request, true ); + } + + private VersionPolicyResult calculateNextVersion( VersionPolicyRequest request, boolean development ) + { + Version defaultVersionInfo = null; + + try + { + defaultVersionInfo = new Version( request.getVersion() ); + } + catch ( VersionParseException e ) + { + throw new IllegalArgumentException( "Can't tell if version with no digits is even: " + e.getMessage(), e ); + } + + Version newVersion = newVersion( defaultVersionInfo, development ); + + return new VersionPolicyResult().setVersion( newVersion.toString() ); + } + + private Version newVersion( Version defaultVersionInfo, boolean development ) + { + Version newVersion; + int mostSignificantSegment; + + if ( StringUtils.isNumeric( defaultVersionInfo.getAnnotationRevision() ) ) + { + mostSignificantSegment = Integer.parseInt( defaultVersionInfo.getAnnotationRevision() ); + + int skip = getVersionIncrements( development, mostSignificantSegment % 2 == 0 ); + + newVersion = defaultVersionInfo.setAnnotationRevision( String.valueOf( mostSignificantSegment + skip ) ); + } + else + { + List digits = defaultVersionInfo.getDigits(); + + if ( digits == null ) + { + throw new IllegalArgumentException( "Can't tell if version with no digits is even." ); + } + + mostSignificantSegment = Integer.parseInt( digits.get( digits.size() - 1 ) ); + + int skip = getVersionIncrements( development, mostSignificantSegment % 2 == 0 ); + + digits.set( digits.size() - 1, String.valueOf( String.valueOf( mostSignificantSegment + skip ) ) ); + + newVersion = defaultVersionInfo.setDigits( digits ); + } + + if ( development ) + { + return newVersion.setBuildSpecifier( Artifact.SNAPSHOT_VERSION ); + } + else + { + return newVersion.setBuildSpecifier( null ); + } + } + + private int getVersionIncrements( boolean development, boolean isEven ) + { + if ( development && !isEven ) + { + // do we need a snapshot? make sure the version info is odd + return 2; + } + else if ( !development && isEven ) + { + // do we need a release? make sure the version info is even + return 0; + } + else + { + // by default, never reuse revisions + return 1; + } + } +} diff --git a/Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/main/java/org/apache/maven/shared/release/policy/oddeven/package-info.java b/Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/main/java/org/apache/maven/shared/release/policy/oddeven/package-info.java new file mode 100644 index 000000000..4f0063539 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/main/java/org/apache/maven/shared/release/policy/oddeven/package-info.java @@ -0,0 +1,25 @@ +// CHECKSTYLE_OFF: RegexpHeader +/** + * A {@link org.apache.maven.shared.release.policy.version.VersionPolicy VersionPolicy} implementation that allows + * release even version numbers only and skips the odd. + */ +package org.apache.maven.shared.release.policy.oddeven; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ diff --git a/Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/site/site.xml b/Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/site/site.xml new file mode 100644 index 000000000..220ecbb57 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/site/site.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/test/java/org/apache/maven/shared/release/policy/oddeven/OddEvenVersionPolicyTestCase.java b/Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/test/java/org/apache/maven/shared/release/policy/oddeven/OddEvenVersionPolicyTestCase.java new file mode 100644 index 000000000..48f7b6b73 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-policies/maven-release-oddeven-policy/src/test/java/org/apache/maven/shared/release/policy/oddeven/OddEvenVersionPolicyTestCase.java @@ -0,0 +1,82 @@ +package org.apache.maven.shared.release.policy.oddeven; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; + +import org.apache.maven.shared.release.policy.version.VersionPolicy; +import org.apache.maven.shared.release.policy.version.VersionPolicyRequest; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public final class OddEvenVersionPolicyTestCase +{ + + private VersionPolicy versionPolicy; + + @Before + public void setUp() + { + versionPolicy = new OddEvenVersionPolicy(); + } + + @After + public void tearDown() + { + versionPolicy = null; + } + + @Test + public void testConvertToSnapshot() + throws Exception + { + String suggestedVersion = versionPolicy.getDevelopmentVersion( newVersionPolicyRequest( "1.0.0" ) ) + .getVersion(); + + assertEquals( "1.0.1-SNAPSHOT", suggestedVersion ); + } + + @Test + public void testConvertToRelease() + throws Exception + { + String suggestedVersion = versionPolicy.getReleaseVersion( newVersionPolicyRequest( "1.0.0-SNAPSHOT" ) ) + .getVersion(); + + assertEquals( "1.0.0", suggestedVersion ); + } + + @Test + public void testConvertOddToRelease() + throws Exception + { + String suggestedVersion = versionPolicy.getReleaseVersion( newVersionPolicyRequest( "1.0.1-SNAPSHOT" ) ) + .getVersion(); + + assertEquals( "1.0.2", suggestedVersion ); + } + + private static VersionPolicyRequest newVersionPolicyRequest( String version ) + { + return new VersionPolicyRequest().setVersion( version ); + } + +} diff --git a/Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/pom.xml b/Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/pom.xml new file mode 100644 index 000000000..0f003d2e1 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/pom.xml @@ -0,0 +1,81 @@ + + + + + 4.0.0 + + + org.apache.maven.release + maven-release + 3.0.0-SNAPSHOT + ../.. + + + maven-release-semver-policy + + Maven Release SemVer Policy + + A version policy that enforce SemVer format and upgrades minor element for next development version. + + + + + ${project.parent.groupId} + maven-release-api + ${project.parent.version} + + + org.semver + api + 0.9.33 + + + + + org.codehaus.plexus + plexus-component-annotations + true + + + + junit + junit + test + + + + + + + org.codehaus.plexus + plexus-component-metadata + + + process-classes + + generate-metadata + + + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/src/main/java/org/apache/maven/shared/release/policy/semver/SemVerVersionPolicy.java b/Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/src/main/java/org/apache/maven/shared/release/policy/semver/SemVerVersionPolicy.java new file mode 100644 index 000000000..0a20c620c --- /dev/null +++ b/Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/src/main/java/org/apache/maven/shared/release/policy/semver/SemVerVersionPolicy.java @@ -0,0 +1,80 @@ +package org.apache.maven.shared.release.policy.semver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.shared.release.policy.PolicyException; +import org.apache.maven.shared.release.policy.version.VersionPolicy; +import org.apache.maven.shared.release.policy.version.VersionPolicyRequest; +import org.apache.maven.shared.release.policy.version.VersionPolicyResult; +import org.apache.maven.shared.release.versions.VersionParseException; +import org.codehaus.plexus.component.annotations.Component; +import org.semver.Version; +import org.semver.Version.Element; + +/** + * + * Uses SemVer implementation to increase minor element when resolving the development version + * + */ +@Component( + role = VersionPolicy.class, + hint = "SemVerVersionPolicy", + description = "A VersionPolicy following the SemVer rules" + ) +public class SemVerVersionPolicy implements VersionPolicy +{ + + public VersionPolicyResult getReleaseVersion( VersionPolicyRequest request ) + throws PolicyException, VersionParseException + { + Version version; + try + { + version = Version.parse( request.getVersion() ); + } + catch ( IllegalArgumentException e ) + { + throw new VersionParseException( e.getMessage() ); + } + + VersionPolicyResult result = new VersionPolicyResult(); + result.setVersion( version.toReleaseVersion().toString() ); + return result; + } + + public VersionPolicyResult getDevelopmentVersion( VersionPolicyRequest request ) + throws PolicyException, VersionParseException + { + Version version; + try + { + version = Version.parse( request.getVersion() ); + } + catch ( IllegalArgumentException e ) + { + throw new VersionParseException( e.getMessage() ); + } + + version = version.next( Element.MINOR ); + VersionPolicyResult result = new VersionPolicyResult(); + result.setVersion( version.toString() + "-SNAPSHOT" ); + return result; + } +} diff --git a/Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/src/site/site.xml b/Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/src/site/site.xml new file mode 100644 index 000000000..220ecbb57 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/src/site/site.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/src/test/java/org/apache/maven/shared/release/policy/semver/SemVerVersionPolicyTest.java b/Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/src/test/java/org/apache/maven/shared/release/policy/semver/SemVerVersionPolicyTest.java new file mode 100644 index 000000000..94bc63e29 --- /dev/null +++ b/Java-base/maven-release/src/maven-release-policies/maven-release-semver-policy/src/test/java/org/apache/maven/shared/release/policy/semver/SemVerVersionPolicyTest.java @@ -0,0 +1,71 @@ +package org.apache.maven.shared.release.policy.semver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.*; + +import org.apache.maven.shared.release.policy.version.VersionPolicy; +import org.apache.maven.shared.release.policy.version.VersionPolicyRequest; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class SemVerVersionPolicyTest +{ + + private VersionPolicy versionPolicy; + + @Before + public void setUp() + { + versionPolicy = new SemVerVersionPolicy(); + } + + @After + public void tearDown() + { + versionPolicy = null; + } + + @Test + public void testConvertToSnapshot() + throws Exception + { + String suggestedVersion = versionPolicy.getDevelopmentVersion( newVersionPolicyRequest( "1.0.0" ) ) + .getVersion(); + + assertEquals( "1.1.0-SNAPSHOT", suggestedVersion ); + } + + @Test + public void testConvertToRelease() + throws Exception + { + String suggestedVersion = versionPolicy.getReleaseVersion( newVersionPolicyRequest( "1.0.0-SNAPSHOT" ) ) + .getVersion(); + + assertEquals( "1.0.0", suggestedVersion ); + } + + private static VersionPolicyRequest newVersionPolicyRequest( String version ) + { + return new VersionPolicyRequest().setVersion( version ); + } +} diff --git a/Java-base/maven-release/src/pom.xml b/Java-base/maven-release/src/pom.xml new file mode 100644 index 000000000..cdd698b08 --- /dev/null +++ b/Java-base/maven-release/src/pom.xml @@ -0,0 +1,209 @@ + + + + + 4.0.0 + + + org.apache.maven + maven-parent + 34 + + + + org.apache.maven.release + maven-release + 3.0.0-SNAPSHOT + pom + + Maven Release + Tooling to release a project with Maven, saving a lot of repetitive, manual work. + + + maven-release-api + maven-release-manager + maven-release-policies/maven-release-oddeven-policy + maven-release-policies/maven-release-semver-policy + maven-release-plugin + + + + scm:git:https://gitbox.apache.org/repos/asf/maven-release.git + scm:git:https://gitbox.apache.org/repos/asf/maven-release.git + https://github.com/apache/maven-release/tree/${project.scm.tag} + HEAD + + + jira + https://issues.apache.org/jira/browse/MRELEASE + + + Jenkins + https://builds.apache.org/job/maven-box/job/maven-release/ + + + + apache.website + scm:svn:https://svn.apache.org/repos/asf/maven/website/components/${maven.site.path} + + + + + + John R Fallows + + + Gertjan Gaillet + + + Russ Kociuba + + + Georges-Etienne Legendre + + + Henning Schmiedehausen + + + Thorsten Heit + + + + + 1.11.2 + 7 + 3.0 + maven-release-archives/maven-release-LATEST + 2020-04-07T18:00:00Z + + + + + + + org.apache.rat + apache-rat-plugin + + + .repository + + + + + + + + + + + org.apache.maven + maven-artifact + ${mavenVersion} + + + org.apache.maven + maven-core + ${mavenVersion} + + + org.apache.maven + maven-compat + ${mavenVersion} + test + + + org.apache.maven + maven-model + ${mavenVersion} + + + org.apache.maven + maven-plugin-api + ${mavenVersion} + + + org.apache.maven + maven-repository-metadata + ${mavenVersion} + + + org.apache.maven + maven-settings + ${mavenVersion} + + + + org.apache.maven.scm + maven-scm-api + ${scmVersion} + + + org.apache.maven.scm + maven-scm-manager-plexus + 1.8 + runtime + + + org.apache.maven.scm + maven-scm-providers-standard + ${scmVersion} + pom + + + org.apache.maven.scm + maven-scm-provider-svn-commons + ${scmVersion} + + + org.apache.maven.scm + maven-scm-test + ${scmVersion} + test + + + + org.codehaus.plexus + plexus-utils + 3.0.15 + + + org.jdom + jdom + 1.1.3 + + + junit + junit + 4.13 + test + + + org.mockito + mockito-core + 2.28.2 + + + org.xmlunit + xmlunit-core + 2.6.4 + + + + diff --git a/Java-base/maven-release/src/src/site/apt/index.apt b/Java-base/maven-release/src/src/site/apt/index.apt new file mode 100644 index 000000000..1f0b5da66 --- /dev/null +++ b/Java-base/maven-release/src/src/site/apt/index.apt @@ -0,0 +1,50 @@ + ------ + Maven Release + ------ + Hervé Boutemy + ------ + 2011-06-24 + ------ + +~~ Licensed to the Apache Software Foundation (ASF) under one +~~ or more contributor license agreements. See the NOTICE file +~~ distributed with this work for additional information +~~ regarding copyright ownership. The ASF licenses this file +~~ to you under the Apache License, Version 2.0 (the +~~ "License"); you may not use this file except in compliance +~~ with the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, +~~ software distributed under the License is distributed on an +~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~~ KIND, either express or implied. See the License for the +~~ specific language governing permissions and limitations +~~ under the License. + +Maven Release + + Maven Release provides tooling to release a project with Maven, saving a lot of repetitive, manual work. + + It consists of following modules: + +*----------------------------------------------------------+----------------+ +|| Module || Description || +*----------------------------------------------------------+----------------+ +| {{{./maven-release-api/}maven-release-api}} | APIs to implement to extend maven-release-plugin +*----------------------------------------------------------+----------------+ +| {{{./maven-release-manager/}maven-release-manager}} | core classes +*----------------------------------------------------------+----------------+ +| {{{./maven-release-plugin/}maven-release-plugin}} | release plugin to use from Maven +*----------------------------------------------------------+----------------+ +| {{{./maven-release-policies/maven-release-oddeven-policy/}maven-release-oddeven-policy}} | a version policy that proposes even version numbers only for releases and odd numbers for development +*----------------------------------------------------------+----------------+ +| {{{./maven-release-policies/maven-release-semver-policy/}maven-release-semver-policy}} | a version policy that enforce SemVer format and upgrades minor element for next development version +*----------------------------------------------------------+----------------+ + +Notes for Developers + + There are tests in this project which require you to set the M2_HOME + environment variable. Since many of the tests print error messages, + it is easy to forget about this and then be puzzled. diff --git a/Java-base/maven-release/src/src/site/resources/download.cgi b/Java-base/maven-release/src/src/site/resources/download.cgi new file mode 100644 index 000000000..1b178d2e6 --- /dev/null +++ b/Java-base/maven-release/src/src/site/resources/download.cgi @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Just call the standard mirrors.cgi script. It will use download.html +# as the input template. +exec /www/www.apache.org/dyn/mirrors/mirrors.cgi $* \ No newline at end of file diff --git a/Java-base/maven-release/src/src/site/site.xml b/Java-base/maven-release/src/src/site/site.xml new file mode 100644 index 000000000..027bb6ae4 --- /dev/null +++ b/Java-base/maven-release/src/src/site/site.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + diff --git a/Java-base/maven-release/src/src/site/xdoc/download.xml.vm b/Java-base/maven-release/src/src/site/xdoc/download.xml.vm new file mode 100644 index 000000000..b86131de8 --- /dev/null +++ b/Java-base/maven-release/src/src/site/xdoc/download.xml.vm @@ -0,0 +1,126 @@ + + + + + + + Download ${project.name} Source + + +
    + +

    ${project.name} ${project.version} is distributed in source format. Use a source archive if you intend to build + ${project.name} yourself. Otherwise, simply use the ready-made binary artifacts from central repository.

    + +

    You will be prompted for a mirror - if the file is not found on yours, please be patient, as it may take 24 + hours to reach all mirrors.

    + +

    In order to guard against corrupted downloads/installations, it is highly recommended to + verify the signature + of the release bundles against the public KEYS used by the Apache Maven + developers.

    + +

    ${project.name} is distributed under the Apache License, version 2.0.

    + +

    We strongly encourage our users to configure a Maven repository mirror closer to their location, please read How to Use Mirrors for Repositories.

    + + + + +

    + [if-any logo] + + logo + + [end] + The currently selected mirror is + [preferred]. + If you encounter a problem with this mirror, + please select another mirror. + If all mirrors are failing, there are + backup + mirrors + (at the end of the mirrors list) that should be available. +

    + +
    + Other mirrors: + + +
    + +

    + You may also consult the + complete list of + mirrors. +

    + + + + + +

    This is the current stable version of ${project.name}.

    + + + + + + + + + + + + + + + + + + +
    LinkChecksumSignature
    ${project.name} ${project.version} (Source zip)maven/release/${project.artifactId}-${project.version}-source-release.zipmaven/release/${project.artifactId}-${project.version}-source-release.zip.sha512maven/release/${project.artifactId}-${project.version}-source-release.zip.asc
    +
    + + + +

    Older non-recommended releases can be found on our archive site.

    + +
    +
    + +
    + diff --git a/Java/maven-release-AbstractReleaseMojo_198/Dockerfile b/Java/maven-release-AbstractReleaseMojo_198/Dockerfile new file mode 100644 index 000000000..2af4a85ec --- /dev/null +++ b/Java/maven-release-AbstractReleaseMojo_198/Dockerfile @@ -0,0 +1,18 @@ +FROM ghcr.io/kupl/starlab-benchmarks/java-base:maven-release + +ENV TZ=Asia/Seoul + +COPY ./metadata.json . +COPY ./npe.json . +COPY ./buggy.java /tmp/buggy.java +RUN export BUGGY_PATH=$(cat metadata.json | jq -r ".npe.filepath") \ + && export BUGGY_LINE=$(cat metadata.json | jq -r ".npe.line") \ + && export BUGGY_MTHD=$(cat metadata.json | jq -r ".npe.npe_method") \ + && mv /tmp/buggy.java $BUGGY_PATH \ + && echo "[{\"filepath\": \"$BUGGY_PATH\", \"line\": $BUGGY_LINE, \"method_name\": \"$BUGGY_MTHD\"}]" | jq . > traces.json + +RUN git init . && git add -A + +RUN $(cat metadata.json | jq -r ".buildCommand") + +RUN $(cat metadata.json | jq -r ".testCommand"); if [ $? -eq 0 ]; then exit 1; fi diff --git a/Java/maven-release-AbstractReleaseMojo_198/buggy.java b/Java/maven-release-AbstractReleaseMojo_198/buggy.java new file mode 100644 index 000000000..3b6c2aed1 --- /dev/null +++ b/Java/maven-release-AbstractReleaseMojo_198/buggy.java @@ -0,0 +1,290 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.apache.maven.settings.Settings; +import org.apache.maven.shared.release.ReleaseManager; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; +import org.apache.maven.shared.release.env.DefaultReleaseEnvironment; +import org.apache.maven.shared.release.env.ReleaseEnvironment; +import org.codehaus.plexus.util.StringUtils; + +/** + * Base class with shared configuration. + * + * @author Brett Porter + * @version $Id$ + */ +public abstract class AbstractReleaseMojo + extends AbstractMojo +{ + /** + */ + @Parameter( defaultValue = "${basedir}", readonly = true, required = true ) + private File basedir; + + /** + */ + @Parameter( defaultValue = "${settings}", readonly = true, required = true ) + private Settings settings; + + /** + */ + @Parameter( defaultValue = "${project}", readonly = true, required = true ) + protected MavenProject project; + + /** + */ + @Component + protected ReleaseManager releaseManager; + + /** + * Additional arguments to pass to the Maven executions, separated by spaces. + */ + @Parameter( alias = "prepareVerifyArgs", property = "arguments" ) + private String arguments; + + /** + * The file name of the POM to execute any goals against. As of version 3.0.0, this defaults to the name of + * POM file of the project being built. + */ + @Parameter( property = "pomFileName", defaultValue = "${project.file.name}" ) + private String pomFileName; + + /** + */ + @Parameter( defaultValue = "${reactorProjects}", readonly = true, required = true ) + private List reactorProjects; + + /** + * The {@code M2_HOME} parameter to use for forked Maven invocations. + * + * @since 2.0-beta-8 + */ + @Parameter( defaultValue = "${maven.home}" ) + private File mavenHome; + + /** + * The {@code JAVA_HOME} parameter to use for forked Maven invocations. + * + * @since 2.0-beta-8 + */ + @Parameter( defaultValue = "${java.home}" ) + private File javaHome; + + /** + * The command-line local repository directory in use for this build (if specified). + * + * @since 2.0-beta-8 + */ + @Parameter ( defaultValue = "${maven.repo.local}" ) + private File localRepoDirectory; + + /** + * Role hint of the {@link org.apache.maven.shared.release.exec.MavenExecutor} implementation to use. + * + * @since 2.0-beta-8 + */ + @Parameter( defaultValue = "invoker", property = "mavenExecutorId" ) + private String mavenExecutorId; + + /** + * @since 2.0 + */ + @Parameter( defaultValue = "${session}", readonly = true, required = true ) + protected MavenSession session; + + /** + * The role-hint for the {@link org.apache.maven.shared.release.strategy.Strategy} + * implementation used to specify the phases per goal. + * + * @since 3.0.0 + * @see org.apache.maven.shared.release.strategies.DefaultStrategy + */ + @Parameter( defaultValue = "default", property = "releaseStrategyId" ) + private String releaseStrategyId; + + /** + * Gets the environment settings configured for this release. + * + * @return The release environment, never null. + */ + protected ReleaseEnvironment getReleaseEnvironment() + { + return new DefaultReleaseEnvironment().setSettings( settings ) + .setJavaHome( javaHome ) + .setMavenHome( mavenHome ) + .setLocalRepositoryDirectory( localRepoDirectory ) + .setMavenExecutorId( mavenExecutorId ); + } + + /** + * Creates the release descriptor from the various goal parameters. + * + * @return The release descriptor, never null. + */ +/** + * Creates the release descriptor from the various goal parameters. + * + * @return The release descriptor, never null. + */ +protected org.apache.maven.shared.release.config.ReleaseDescriptorBuilder createReleaseDescriptor() { + org.apache.maven.shared.release.config.ReleaseDescriptorBuilder descriptor = new org.apache.maven.shared.release.config.ReleaseDescriptorBuilder(); + descriptor.setInteractive(settings.isInteractiveMode()); + java.nio.file.Path workingDirectory; + try { + workingDirectory = org.apache.maven.plugins.release.AbstractReleaseMojo.getCommonBasedir(reactorProjects); + } catch (java.io.IOException e) { + throw new java.lang.RuntimeException(e.getMessage()); + } + descriptor.setWorkingDirectory(workingDirectory.toFile().getAbsolutePath()); + java.nio.file.Path rootBasedir = basedir.toPath(); + if (rootBasedir.equals(workingDirectory)) { + descriptor.setPomFileName(pomFileName); + } else { + descriptor.setPomFileName(workingDirectory.relativize(rootBasedir).resolve(pomFileName).toString()); + } + for (org.apache.maven.project.MavenProject project : reactorProjects) { + java.lang.String versionlessKey = org.apache.maven.artifact.ArtifactUtils.versionlessKey(project.getGroupId(), project.getArtifactId()); + descriptor.putOriginalVersion(versionlessKey, project.getVersion()); + } + descriptor.setAdditionalArguments(this.arguments); + java.util.List profileIds = session.getRequest().getActiveProfiles(); + java.lang.String additionalProfiles = getAdditionalProfiles(); + if ((!profileIds.isEmpty()) || org.codehaus.plexus.util.StringUtils.isNotBlank(additionalProfiles)) { + java.util.List profiles = new java.util.ArrayList<>(profileIds); + { + profiles.addAll(java.util.Arrays.asList(/* NPEX_NULL_EXP */ + additionalProfiles.split(","))); + } + descriptor.setActivateProfiles(profiles); + } + descriptor.setReleaseStrategyId(releaseStrategyId); + return descriptor; +} + + /** + * Gets the comma separated list of additional profiles for the release build. + * + * @return additional profiles to enable during release + */ + protected String getAdditionalProfiles() + { + return null; + } + + /** + * Sets the component used to perform release actions. + * + * @param releaseManager The release manager implementation to use, must not be null. + */ + void setReleaseManager( ReleaseManager releaseManager ) + { + this.releaseManager = releaseManager; + } + + /** + * Gets the effective settings for this build. + * + * @return The effective settings for this build, never null. + */ + Settings getSettings() + { + return settings; + } + + protected final File getBasedir() + { + return basedir; + } + + /** + * Sets the base directory of the build. + * + * @param basedir The build's base directory, must not be null. + */ + public void setBasedir( File basedir ) + { + this.basedir = basedir; + } + + public void setPomFileName( String pomFileName ) + { + this.pomFileName = pomFileName; + } + + /** + * Gets the list of projects in the build reactor. + * + * @return The list of reactor project, never null. + */ + public List getReactorProjects() + { + return reactorProjects; + } + + /** + * Add additional arguments. + * + * @param argument The argument to add, must not be null. + */ + protected void addArgument( String argument ) + { + if ( arguments != null ) + { + arguments += " " + argument; + } + else + { + arguments = argument; + } + } + + static Path getCommonBasedir( List reactorProjects ) + throws IOException + { + Path basePath = reactorProjects.get( 0 ).getBasedir().toPath(); + + for ( MavenProject reactorProject : reactorProjects ) + { + Path matchPath = reactorProject.getBasedir().toPath(); + while ( !basePath.startsWith( matchPath ) ) + { + matchPath = matchPath.getParent(); + } + basePath = matchPath; + } + + return basePath; + } +} diff --git a/Java/maven-release-AbstractReleaseMojo_198/metadata.json b/Java/maven-release-AbstractReleaseMojo_198/metadata.json new file mode 100644 index 000000000..12a29ef41 --- /dev/null +++ b/Java/maven-release-AbstractReleaseMojo_198/metadata.json @@ -0,0 +1,21 @@ +{ + "language": "java", + "id": "maven-release-AbstractReleaseMojo_198", + "buggyPath": ".", + "referencePath": null, + "buildCommand": "mvn package -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100 -DskipTests=true -DskipITs=true -Dtest=None -DfailIfNoTests=false", + "testCommand": "mvn test -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100", + "categories": [ + "safety", + "npe" + ], + "npe": { + "filepath": "maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java", + "line": 188, + "npe_method": "createReleaseDescriptor", + "deref_field": "additionalProfiles", + "npe_class": "AbstractReleaseMojo", + "repo": "maven-release", + "bug_id": "AbstractReleaseMojo_198" + } +} diff --git a/Java/maven-release-AbstractReleaseMojo_198/npe.json b/Java/maven-release-AbstractReleaseMojo_198/npe.json new file mode 100644 index 000000000..83417a2c9 --- /dev/null +++ b/Java/maven-release-AbstractReleaseMojo_198/npe.json @@ -0,0 +1,7 @@ +{ + "filepath": "maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java", + "line": 188, + "npe_method": "createReleaseDescriptor", + "deref_field": "additionalProfiles", + "npe_class": "AbstractReleaseMojo" +} \ No newline at end of file diff --git a/Java/maven-release-AbstractScmReleaseMojo_130/Dockerfile b/Java/maven-release-AbstractScmReleaseMojo_130/Dockerfile new file mode 100644 index 000000000..2af4a85ec --- /dev/null +++ b/Java/maven-release-AbstractScmReleaseMojo_130/Dockerfile @@ -0,0 +1,18 @@ +FROM ghcr.io/kupl/starlab-benchmarks/java-base:maven-release + +ENV TZ=Asia/Seoul + +COPY ./metadata.json . +COPY ./npe.json . +COPY ./buggy.java /tmp/buggy.java +RUN export BUGGY_PATH=$(cat metadata.json | jq -r ".npe.filepath") \ + && export BUGGY_LINE=$(cat metadata.json | jq -r ".npe.line") \ + && export BUGGY_MTHD=$(cat metadata.json | jq -r ".npe.npe_method") \ + && mv /tmp/buggy.java $BUGGY_PATH \ + && echo "[{\"filepath\": \"$BUGGY_PATH\", \"line\": $BUGGY_LINE, \"method_name\": \"$BUGGY_MTHD\"}]" | jq . > traces.json + +RUN git init . && git add -A + +RUN $(cat metadata.json | jq -r ".buildCommand") + +RUN $(cat metadata.json | jq -r ".testCommand"); if [ $? -eq 0 ]; then exit 1; fi diff --git a/Java/maven-release-AbstractScmReleaseMojo_130/buggy.java b/Java/maven-release-AbstractScmReleaseMojo_130/buggy.java new file mode 100644 index 000000000..1bd911816 --- /dev/null +++ b/Java/maven-release-AbstractScmReleaseMojo_130/buggy.java @@ -0,0 +1,198 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.ArtifactUtils; +import org.apache.maven.model.Scm; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; + +/** + * Abstract Mojo containing SCM parameters + * + * @author Robert Scholte + */ +// Extra layer since 2.4. Don't use @since doclet, these would be inherited by the subclasses +public abstract class AbstractScmReleaseMojo + extends AbstractReleaseMojo +{ + /** + * The SCM username to use. + */ + @Parameter( property = "username" ) + private String username; + + /** + * The SCM password to use. + */ + @Parameter( property = "password" ) + private String password; + + /** + * The SCM tag to use. + */ + @Parameter( alias = "releaseLabel", property = "tag" ) + private String tag; + + /** + * Format to use when generating the tag name if none is specified. Property interpolation is performed on the + * tag, but in order to ensure that the interpolation occurs during release, you must use @{...} + * to reference the properties rather than ${...}. The following properties are available: + *
      + *
    • groupId or project.groupId - The groupId of the root project. + *
    • artifactId or project.artifactId - The artifactId of the root project. + *
    • version or project.version - The release version of the root project. + *
    + * + * @since 2.2.0 + */ + @Parameter( defaultValue = "@{project.artifactId}-@{project.version}", property = "tagNameFormat" ) + private String tagNameFormat; + + /** + * The tag base directory in SVN, you must define it if you don't use the standard svn layout (trunk/tags/branches). + * For example, http://svn.apache.org/repos/asf/maven/plugins/tags. The URL is an SVN URL and does not + * include the SCM provider and protocol. + */ + @Parameter( property = "tagBase" ) + private String tagBase; + + /** + * The message prefix to use for all SCM changes. + * + * @since 2.0-beta-5 + */ + @Parameter( defaultValue = "[maven-release-plugin] ", property = "scmCommentPrefix" ) + private String scmCommentPrefix; + + /** + * Implemented with git will or not push changes to the upstream repository. + * true by default to preserve backward compatibility. + * @since 2.1 + */ + @Parameter( defaultValue = "true", property = "pushChanges" ) + private boolean pushChanges = true; + + /** + * A workItem for SCMs like RTC, TFS etc, that may require additional + * information to perform a pushChange operation. + * + * @since 3.0.0 + */ + @Parameter( property = "workItem" ) + private String workItem; + + /** + * Add a new or overwrite the default implementation per provider. + * The key is the scm prefix and the value is the role hint of the + * {@link org.apache.maven.scm.provider.ScmProvider}. + * + * @since 2.0-beta-6 + * @see ScmManager#setScmProviderImplementation(String, String) + */ + @Parameter + private Map providerImplementations; + + /** + * The SCM manager. + */ + @Component + private ScmManager scmManager; + + @Override +public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException { + { + for (java.util.Map.Entry providerEntry : /* NPEX_NULL_EXP */ + providerImplementations.entrySet()) { + getLog().info(((("Change the default '" + providerEntry.getKey()) + "' provider implementation to '") + providerEntry.getValue()) + "'."); + scmManager.setScmProviderImplementation(providerEntry.getKey(), providerEntry.getValue()); + } + } +} + + @Override + protected ReleaseDescriptorBuilder createReleaseDescriptor() + { + ReleaseDescriptorBuilder descriptor = super.createReleaseDescriptor(); + + descriptor.setScmPassword( password ); + descriptor.setScmReleaseLabel( tag ); + descriptor.setScmTagNameFormat( tagNameFormat ); + descriptor.setScmTagBase( tagBase ); + descriptor.setScmUsername( username ); + descriptor.setScmCommentPrefix( scmCommentPrefix ); + + descriptor.setPushChanges( pushChanges ); + descriptor.setWorkItem( workItem ); + + if ( project.getScm() != null ) + { + if ( project.getScm().getDeveloperConnection() != null ) + { + descriptor.setScmSourceUrl( project.getScm().getDeveloperConnection() ); + } + else if ( project.getScm().getConnection() != null ) + { + descriptor.setScmSourceUrl( project.getScm().getConnection() ); + } + } + + // As long as Scm.getId() does not exist, read it as a property + descriptor.setScmId( project.getProperties().getProperty( "project.scm.id" ) ); + + for ( MavenProject reactorProject : session.getProjects() ) + { + if ( reactorProject.getScm() != null ) + { + String projectId = + ArtifactUtils.versionlessKey( reactorProject.getGroupId(), reactorProject.getArtifactId() ); + + descriptor.addOriginalScmInfo( projectId, buildScm( project ) ); + } + } + + return descriptor; + } + + protected Scm buildScm( MavenProject project ) + { + Scm scm; + if ( project.getOriginalModel().getScm() == null ) + { + scm = null; + } + else + { + scm = new Scm(); + scm.setConnection( project.getOriginalModel().getScm().getConnection() ); + scm.setDeveloperConnection( project.getOriginalModel().getScm().getDeveloperConnection() ); + scm.setTag( project.getOriginalModel().getScm().getTag() ); + scm.setUrl( project.getOriginalModel().getScm().getUrl() ); + } + return scm; + } +} diff --git a/Java/maven-release-AbstractScmReleaseMojo_130/metadata.json b/Java/maven-release-AbstractScmReleaseMojo_130/metadata.json new file mode 100644 index 000000000..a07e0b0c5 --- /dev/null +++ b/Java/maven-release-AbstractScmReleaseMojo_130/metadata.json @@ -0,0 +1,21 @@ +{ + "language": "java", + "id": "maven-release-AbstractScmReleaseMojo_130", + "buggyPath": ".", + "referencePath": null, + "buildCommand": "mvn package -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100 -DskipTests=true -DskipITs=true -Dtest=None -DfailIfNoTests=false", + "testCommand": "mvn test -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100", + "categories": [ + "safety", + "npe" + ], + "npe": { + "filepath": "maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractScmReleaseMojo.java", + "line": 130, + "npe_method": "execute", + "deref_field": "providerImplementations", + "npe_class": "AbstractScmReleaseMojo", + "repo": "maven-release", + "bug_id": "AbstractScmReleaseMojo_130" + } +} diff --git a/Java/maven-release-AbstractScmReleaseMojo_130/npe.json b/Java/maven-release-AbstractScmReleaseMojo_130/npe.json new file mode 100644 index 000000000..32588b022 --- /dev/null +++ b/Java/maven-release-AbstractScmReleaseMojo_130/npe.json @@ -0,0 +1,7 @@ +{ + "filepath": "maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractScmReleaseMojo.java", + "line": 130, + "npe_method": "execute", + "deref_field": "providerImplementations", + "npe_class": "AbstractScmReleaseMojo" +} \ No newline at end of file diff --git a/Java/maven-release-AbstractScmReleaseMojo_156/Dockerfile b/Java/maven-release-AbstractScmReleaseMojo_156/Dockerfile new file mode 100644 index 000000000..2af4a85ec --- /dev/null +++ b/Java/maven-release-AbstractScmReleaseMojo_156/Dockerfile @@ -0,0 +1,18 @@ +FROM ghcr.io/kupl/starlab-benchmarks/java-base:maven-release + +ENV TZ=Asia/Seoul + +COPY ./metadata.json . +COPY ./npe.json . +COPY ./buggy.java /tmp/buggy.java +RUN export BUGGY_PATH=$(cat metadata.json | jq -r ".npe.filepath") \ + && export BUGGY_LINE=$(cat metadata.json | jq -r ".npe.line") \ + && export BUGGY_MTHD=$(cat metadata.json | jq -r ".npe.npe_method") \ + && mv /tmp/buggy.java $BUGGY_PATH \ + && echo "[{\"filepath\": \"$BUGGY_PATH\", \"line\": $BUGGY_LINE, \"method_name\": \"$BUGGY_MTHD\"}]" | jq . > traces.json + +RUN git init . && git add -A + +RUN $(cat metadata.json | jq -r ".buildCommand") + +RUN $(cat metadata.json | jq -r ".testCommand"); if [ $? -eq 0 ]; then exit 1; fi diff --git a/Java/maven-release-AbstractScmReleaseMojo_156/buggy.java b/Java/maven-release-AbstractScmReleaseMojo_156/buggy.java new file mode 100644 index 000000000..f22d39d23 --- /dev/null +++ b/Java/maven-release-AbstractScmReleaseMojo_156/buggy.java @@ -0,0 +1,188 @@ +package org.apache.maven.plugins.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.ArtifactUtils; +import org.apache.maven.model.Scm; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; + +/** + * Abstract Mojo containing SCM parameters + * + * @author Robert Scholte + */ +// Extra layer since 2.4. Don't use @since doclet, these would be inherited by the subclasses +public abstract class AbstractScmReleaseMojo + extends AbstractReleaseMojo +{ + /** + * The SCM username to use. + */ + @Parameter( property = "username" ) + private String username; + + /** + * The SCM password to use. + */ + @Parameter( property = "password" ) + private String password; + + /** + * The SCM tag to use. + */ + @Parameter( alias = "releaseLabel", property = "tag" ) + private String tag; + + /** + * Format to use when generating the tag name if none is specified. Property interpolation is performed on the + * tag, but in order to ensure that the interpolation occurs during release, you must use @{...} + * to reference the properties rather than ${...}. The following properties are available: + *
      + *
    • groupId or project.groupId - The groupId of the root project. + *
    • artifactId or project.artifactId - The artifactId of the root project. + *
    • version or project.version - The release version of the root project. + *
    + * + * @since 2.2.0 + */ + @Parameter( defaultValue = "@{project.artifactId}-@{project.version}", property = "tagNameFormat" ) + private String tagNameFormat; + + /** + * The tag base directory in SVN, you must define it if you don't use the standard svn layout (trunk/tags/branches). + * For example, http://svn.apache.org/repos/asf/maven/plugins/tags. The URL is an SVN URL and does not + * include the SCM provider and protocol. + */ + @Parameter( property = "tagBase" ) + private String tagBase; + + /** + * The message prefix to use for all SCM changes. + * + * @since 2.0-beta-5 + */ + @Parameter( defaultValue = "[maven-release-plugin] ", property = "scmCommentPrefix" ) + private String scmCommentPrefix; + + /** + * Implemented with git will or not push changes to the upstream repository. + * true by default to preserve backward compatibility. + * @since 2.1 + */ + @Parameter( defaultValue = "true", property = "pushChanges" ) + private boolean pushChanges = true; + + /** + * A workItem for SCMs like RTC, TFS etc, that may require additional + * information to perform a pushChange operation. + * + * @since 3.0.0 + */ + @Parameter( property = "workItem" ) + private String workItem; + + /** + * Add a new or overwrite the default implementation per provider. + * The key is the scm prefix and the value is the role hint of the + * {@link org.apache.maven.scm.provider.ScmProvider}. + * + * @since 2.0-beta-6 + * @see ScmManager#setScmProviderImplementation(String, String) + */ + @Parameter + private Map providerImplementations; + + /** + * The SCM manager. + */ + @Component + private ScmManager scmManager; + + @Override + public void execute() + throws MojoExecutionException, MojoFailureException + { + if ( providerImplementations != null ) + { + for ( Map.Entry providerEntry : providerImplementations.entrySet() ) + { + getLog().info( "Change the default '" + providerEntry.getKey() + "' provider implementation to '" + + providerEntry.getValue() + "'." ); + scmManager.setScmProviderImplementation( providerEntry.getKey(), providerEntry.getValue() ); + } + } + } + + @Override +protected org.apache.maven.shared.release.config.ReleaseDescriptorBuilder createReleaseDescriptor() { + org.apache.maven.shared.release.config.ReleaseDescriptorBuilder descriptor = super.createReleaseDescriptor(); + descriptor.setScmPassword(password); + descriptor.setScmReleaseLabel(tag); + descriptor.setScmTagNameFormat(tagNameFormat); + descriptor.setScmTagBase(tagBase); + descriptor.setScmUsername(username); + descriptor.setScmCommentPrefix(scmCommentPrefix); + descriptor.setPushChanges(pushChanges); + descriptor.setWorkItem(workItem); + { + if (/* NPEX_NULL_EXP */ + project.getScm().getDeveloperConnection() != null) { + descriptor.setScmSourceUrl(project.getScm().getDeveloperConnection()); + } else if (project.getScm().getConnection() != null) { + descriptor.setScmSourceUrl(project.getScm().getConnection()); + } + } + // As long as Scm.getId() does not exist, read it as a property + descriptor.setScmId(project.getProperties().getProperty("project.scm.id")); + for (org.apache.maven.project.MavenProject reactorProject : session.getProjects()) { + if (reactorProject.getScm() != null) { + java.lang.String projectId = org.apache.maven.artifact.ArtifactUtils.versionlessKey(reactorProject.getGroupId(), reactorProject.getArtifactId()); + descriptor.addOriginalScmInfo(projectId, buildScm(project)); + } + } + return descriptor; +} + + protected Scm buildScm( MavenProject project ) + { + Scm scm; + if ( project.getOriginalModel().getScm() == null ) + { + scm = null; + } + else + { + scm = new Scm(); + scm.setConnection( project.getOriginalModel().getScm().getConnection() ); + scm.setDeveloperConnection( project.getOriginalModel().getScm().getDeveloperConnection() ); + scm.setTag( project.getOriginalModel().getScm().getTag() ); + scm.setUrl( project.getOriginalModel().getScm().getUrl() ); + } + return scm; + } +} diff --git a/Java/maven-release-AbstractScmReleaseMojo_156/metadata.json b/Java/maven-release-AbstractScmReleaseMojo_156/metadata.json new file mode 100644 index 000000000..846ed8495 --- /dev/null +++ b/Java/maven-release-AbstractScmReleaseMojo_156/metadata.json @@ -0,0 +1,21 @@ +{ + "language": "java", + "id": "maven-release-AbstractScmReleaseMojo_156", + "buggyPath": ".", + "referencePath": null, + "buildCommand": "mvn package -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100 -DskipTests=true -DskipITs=true -Dtest=None -DfailIfNoTests=false", + "testCommand": "mvn test -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100", + "categories": [ + "safety", + "npe" + ], + "npe": { + "filepath": "maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractScmReleaseMojo.java", + "line": 154, + "npe_method": "createReleaseDescriptor", + "deref_field": "getScm", + "npe_class": "AbstractScmReleaseMojo", + "repo": "maven-release", + "bug_id": "AbstractScmReleaseMojo_156" + } +} diff --git a/Java/maven-release-AbstractScmReleaseMojo_156/npe.json b/Java/maven-release-AbstractScmReleaseMojo_156/npe.json new file mode 100644 index 000000000..f1b1895d1 --- /dev/null +++ b/Java/maven-release-AbstractScmReleaseMojo_156/npe.json @@ -0,0 +1,7 @@ +{ + "filepath": "maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractScmReleaseMojo.java", + "line": 154, + "npe_method": "createReleaseDescriptor", + "deref_field": "getScm", + "npe_class": "AbstractScmReleaseMojo" +} \ No newline at end of file From 0c5035a5d06edd63d8c03a476352dc2bc26e665c Mon Sep 17 00:00:00 2001 From: Seokhyun Lee <7948302+henrylee97@users.noreply.github.com> Date: Thu, 30 Nov 2023 21:05:22 +0900 Subject: [PATCH 2/2] refactor(java): maven-invoker-plugin (#115) --- Java-base/maven-invoker-plugin/Dockerfile | 28 + .../maven-invoker-plugin/src/Jenkinsfile | 20 + Java-base/maven-invoker-plugin/src/README.md | 99 + Java-base/maven-invoker-plugin/src/pom.xml | 408 +++ .../src/it/MINVOKER-190-logDirectory/pom.xml | 65 + .../src/it/module/pom.xml | 32 + .../MINVOKER-190-logDirectory/verify.groovy | 21 + .../src/it/MINVOKER-191/invoker.properties | 18 + .../src/src/it/MINVOKER-191/module-a/pom.xml | 40 + .../org/apache/maven/plugins/foo/Hello.java | 28 + .../apache/maven/plugins/foo/HelloTest.java | 32 + .../src/src/it/MINVOKER-191/module-b/pom.xml | 40 + .../org/apache/maven/plugins/foo/Hello.java | 28 + .../apache/maven/plugins/foo/HelloTest.java | 32 + .../src/src/it/MINVOKER-191/plugin/pom.xml | 62 + .../MINVOKER-191/plugin/src/it/basic/pom.xml | 47 + .../apache/maven/it/plugins/dummy/MyMojo.java | 78 + .../src/src/it/MINVOKER-191/pom.xml | 79 + .../it/MINVOKER-196_junit_report_file/pom.xml | 73 + .../src/it/project/pom.xml | 32 + .../src/it/project/verify.groovy | 42 + .../src/it/project_2/pom.xml | 71 + .../src/it/project_2/verify.groovy | 20 + .../src/it/settings.xml | 31 + .../verify.groovy | 52 + .../invoker.properties | 18 + .../module-a/pom.xml | 32 + .../module-b/pom.xml | 39 + .../plugin/pom.xml | 59 + .../it/MINVOKER-243_install-reactor/pom.xml | 80 + .../verify.groovy | 29 + .../src/src/it/clone-clean/invoker.properties | 19 + .../src/src/it/clone-clean/pom.xml | 65 + .../src/src/it/clone-clean/setup.bsh | 32 + .../it/clone-clean/src/it/clone-clean/pom.xml | 32 + .../src/src/it/clone-clean/verify.bsh | 31 + .../invoker.properties | 19 + .../it/clone-maven-plugin-packaging/pom.xml | 65 + .../src/it/clone-clean/pom.xml | 32 + .../clone-maven-plugin-packaging/verify.bsh | 31 + .../invoker.properties | 19 + .../src/it/exec-timeout-invoker-level/pom.xml | 65 + .../src/it/basic/invoker.properties | 17 + .../src/it/basic/pom.xml | 53 + .../apache/maven/it/plugins/dummy/MyMojo.java | 89 + .../exec-timeout-invoker-level/verify.groovy | 22 + .../invoker.properties | 19 + .../src/it/exec-timeout-mojo-level/pom.xml | 66 + .../src/it/basic/pom.xml | 53 + .../apache/maven/it/plugins/dummy/MyMojo.java | 89 + .../it/exec-timeout-mojo-level/verify.groovy | 22 + .../invoker.properties | 18 + .../fail-build-streamLogsOnFailures/pom.xml | 64 + .../src/it/project/pom.xml | 35 + .../verify.groovy | 29 + .../invoker.properties | 18 + .../pom.xml | 65 + .../src/it/project/pom.xml | 35 + .../verify.groovy | 31 + .../fail-build-with-verify/invoker.properties | 18 + .../src/src/it/fail-build-with-verify/pom.xml | 66 + .../src/it/project/pom.xml | 35 + .../src/it/project/prebuild.bsh | 24 + .../src/it/fail-build-with-verify/verify.bsh | 41 + .../src/src/it/fail-build/invoker.properties | 18 + .../src/src/it/fail-build/pom.xml | 66 + .../src/it/fail-build/src/it/project/pom.xml | 35 + .../it/fail-build/src/it/project/prebuild.bsh | 24 + .../src/src/it/fail-build/verify.bsh | 41 + .../src/it/fail-ignore-with-verify/pom.xml | 67 + .../src/it/project/pom.xml | 32 + .../src/src/it/fail-ignore/pom.xml | 66 + .../src/it/fail-ignore/src/it/project/pom.xml | 32 + .../fail-noprojects_integration-test/pom.xml | 61 + .../it/fail-noprojects_run/invoker.properties | 18 + .../src/src/it/fail-noprojects_run/pom.xml | 61 + .../fail-noprojects_verify/invoker.properties | 18 + .../src/src/it/fail-noprojects_verify/pom.xml | 62 + .../src/it/fail-postbuild/invoker.properties | 18 + .../src/src/it/fail-postbuild/pom.xml | 65 + .../it/fail-postbuild/src/it/project/pom.xml | 32 + .../src/it/project/postbuild.bsh | 20 + .../src/it/project/prebuild.bsh | 24 + .../src/src/it/fail-postbuild/verify.bsh | 41 + .../src/it/fail-prebuild/invoker.properties | 18 + .../src/src/it/fail-prebuild/pom.xml | 65 + .../it/fail-prebuild/src/it/project/pom.xml | 32 + .../fail-prebuild/src/it/project/prebuild.bsh | 26 + .../src/src/it/fail-prebuild/verify.bsh | 41 + .../it/fail-run-postbuild/invoker.properties | 18 + .../src/src/it/fail-run-postbuild/pom.xml | 65 + .../fail-run-postbuild/src/it/project/pom.xml | 32 + .../src/it/project/postbuild.bsh | 24 + .../src/it/project/src/main/java/Foo.java | 24 + .../src/src/it/fail-run-postbuild/verify.bsh | 41 + .../src/src/it/filtering-extensions/pom.xml | 70 + .../src/it/project/.mvn/extensions.xml | 27 + .../src/it/project/pom.xml | 71 + .../filtering-extensions/src/it/settings.xml | 55 + .../src/it/filtering-extensions/verify.bsh | 75 + .../src/it/install-extra-artifacts/pom.xml | 70 + .../src/it/install-extra-artifacts/verify.bsh | 69 + .../it/integration-test-never-fails/pom.xml | 65 + .../src/it/project/pom.xml | 33 + .../src/it/project/prebuild.bsh | 24 + .../integration-test-never-fails/verify.bsh | 41 + .../src/it/invocation-cmdline-exclude/pom.xml | 61 + .../src/it/minvoker-140/pom.xml | 54 + .../test.properties | 18 + .../src/src/it/invocation-debug/pom.xml | 68 + .../src/it/minvoker-142/invoker.properties | 18 + .../src/it/minvoker-142/pom.xml | 58 + .../src/it/minvoker-142/verify.groovy | 20 + .../src/it/invocation-emptyproperty/pom.xml | 68 + .../src/it/minvoker-118/pom.xml | 58 + .../it/invocation-environmentvariable/pom.xml | 67 + .../src/it/minvoker-145/pom.xml | 58 + .../src/it/minvoker-145/verify.groovy | 24 + .../src/it/minvoker-255/invoker.properties | 24 + .../src/it/minvoker-255/pom.xml | 61 + .../src/it/minvoker-255/verify.groovy | 24 + .../verify.groovy | 21 + .../it/invocation-group-properties/pom.xml | 69 + .../it/projects/group-1/invoker.properties | 18 + .../projects/group-1/sub-1/invoker.properties | 19 + .../src/it/projects/group-1/sub-1/pom.xml | 52 + .../src/it/projects/group-1/sub-2/pom.xml | 52 + .../projects/group-2/sub-1/invoker.properties | 18 + .../src/it/projects/group-2/sub-1/pom.xml | 52 + .../src/it/projects/group-2/sub-2/pom.xml | 52 + .../src/it/projects/invoker.properties | 18 + .../invocation-group-properties/verify.groovy | 20 + .../src/src/it/invocation-multiple/pom.xml | 75 + .../src/it/project/invoker.properties | 43 + .../src/it/project/pom.xml | 107 + .../project/src/main/java/org/TestMojo.java | 69 + .../src/it/project/system1.properties | 18 + .../src/it/project/system2.properties | 18 + .../invocation-multiple/src/it/settings.xml | 60 + .../src/src/it/invocation-multiple/verify.bsh | 66 + .../src/src/it/invocation-offline/pom.xml | 71 + .../src/it/project/invoker.properties | 24 + .../invocation-offline/src/it/project/pom.xml | 41 + .../it/invocation-offline/src/it/settings.xml | 60 + .../src/src/it/invocation-offline/verify.bsh | 32 + .../src/src/it/invocation-project/pom.xml | 70 + .../src/it/project/invoker.properties | 22 + .../invocation-project/src/it/project/pom.xml | 35 + .../src/it/project/setup.bsh | 38 + .../src/it/project/sub-1/pom.xml | 29 + .../src/it/project/sub-2/pom.xml | 29 + .../src/it/project/sub-3/pom.xml | 29 + .../it/invocation-project/src/it/settings.xml | 60 + .../src/src/it/invocation-project/verify.bsh | 54 + .../invoker.properties | 18 + .../itests/pom.xml | 62 + .../itests/src/it/basic/pom.xml | 47 + .../plugin/pom.xml | 40 + .../apache/maven/it/plugins/dummy/MyMojo.java | 78 + .../it/invocation-reactor-indirect/pom.xml | 77 + .../src/src/it/invocation-spaces/pom.xml | 76 + .../src/it projects/project/spacy pom.xml | 70 + .../project/src/main/resources/test.txt | 2 + .../src/it projects/settings.xml | 63 + .../src/src/it/invocation-spaces/verify.bsh | 74 + .../src/it/invoker-report/invoker.properties | 18 + .../src/src/it/invoker-report/pom.xml | 81 + .../src/it/failure-build/pom.xml | 39 + .../src/it/failure-post/invoker.properties | 18 + .../src/it/failure-post/pom.xml | 32 + .../src/it/failure-post/verify.bsh | 21 + .../src/it/failure-pre/invoker.properties | 18 + .../invoker-report/src/it/failure-pre/pom.xml | 32 + .../src/it/failure-pre/setup.bsh | 21 + .../src/it/skip-jre/invoker.properties | 19 + .../it/invoker-report/src/it/skip-jre/pom.xml | 32 + .../src/it/skip-maven/invoker.properties | 19 + .../invoker-report/src/it/skip-maven/pom.xml | 32 + .../src/it/skip-os/invoker.properties | 19 + .../it/invoker-report/src/it/skip-os/pom.xml | 32 + .../src/it/success/invoker.properties | 19 + .../it/invoker-report/src/it/success/pom.xml | 32 + .../src/src/it/invoker-report/verify.bsh | 32 + .../src/src/it/local-repo-default/pom.xml | 72 + .../local-repo-default/src/it/project/pom.xml | 32 + .../src/it/project/postbuild.bsh | 39 + .../it/local-repo-default/src/it/settings.xml | 57 + .../src/src/it/local-repo-default/verify.bsh | 71 + .../src/src/it/local-repo-isolated/pom.xml | 71 + .../src/it/project/pom.xml | 32 + .../local-repo-isolated/src/it/settings.xml | 57 + .../src/src/it/local-repo-isolated/verify.bsh | 53 + .../src/src/it/local-repo-path/pom.xml | 77 + .../it/local-repo-path/src/it/project/pom.xml | 32 + .../it/local-repo-path/src/it/settings.xml | 31 + .../src/src/it/local-repo-path/verify.bsh | 32 + .../src/src/it/local-repo-url/pom.xml | 70 + .../it/local-repo-url/src/it/project/pom.xml | 32 + .../src/it/project/postbuild.groovy | 42 + .../src/it/local-repo-url/src/it/settings.xml | 31 + .../src/src/it/local-repo-url/verify.groovy | 20 + .../not-clone-not-plugin/invoker.properties | 19 + .../src/src/it/not-clone-not-plugin/pom.xml | 64 + .../src/it/clone-clean/pom.xml | 32 + .../src/it/not-clone-not-plugin/verify.bsh | 31 + .../src/src/it/pom-filtering-encoding/pom.xml | 68 + .../src/it/latin-1/pom.xml | 54 + .../src/it/utf-8/pom.xml | 54 + .../src/it/pom-filtering-encoding/verify.bsh | 73 + .../src/src/it/pom-filtering-reactor/pom.xml | 65 + .../src/it/mod2-parent/mod1-parent/pom.xml | 33 + .../src/it/mod2-parent/mod1/pom.xml | 40 + .../src/it/mod2-parent/mod1/src/it/pom.xml | 35 + .../src/it/mod2-parent/mod2/pom.xml | 39 + .../src/it/mod2-parent/mod3/pom.xml | 40 + .../src/it/mod2-parent/mod3/src/it/pom.xml | 35 + .../src/it/mod2-parent/pom.xml | 49 + .../src/it/pom-filtering-reactor/verify.bsh | 65 + .../src/src/it/pom-filtering/pom.xml | 81 + .../it/pom-filtering/src/it/project/pom.xml | 71 + .../src/it/pom-filtering/src/it/settings.xml | 55 + .../src/src/it/pom-filtering/verify.bsh | 93 + .../src/src/it/pom-less-invocation/pom.xml | 64 + .../src/it/no-pom/workaround.txt | 1 + .../src/src/it/pom-less-invocation/verify.bsh | 53 + .../it/postbuild-executed-only-once/pom.xml | 71 + .../src/it/project/invoker.properties | 20 + .../src/it/project/pom.xml | 69 + .../src/it/project/postbuild.bsh | 40 + .../it/post_executed_only_once/App.java | 36 + .../it/post_executed_only_once/AppTest.java | 35 + .../src/it/project/system2.properties | 18 + .../postbuild-executed-only-once/verify.bsh | 41 + .../src/it/project-cloning-reactor/pom.xml | 65 + .../src/it/aggregator/pom.xml | 38 + .../src/it/module-a/pom.xml | 39 + .../src/it/module-b/pom.xml | 39 + .../src/it/parent/pom.xml | 32 + .../src/it/project-cloning-reactor/verify.bsh | 32 + .../src/src/it/project-cloning/pom.xml | 64 + .../src/src/it/project-cloning/setup.bsh | 35 + .../project-cloning/src/it/module-1/pom.xml | 32 + .../src/it/module-1/sub-module/pom.xml | 32 + .../it/project-cloning/src/it/module/pom.xml | 32 + .../src/src/it/project-cloning/verify.bsh | 59 + .../src/src/it/project-setup/pom.xml | 68 + .../src/it/project1/invoker.properties | 19 + .../it/project-setup/src/it/project1/pom.xml | 32 + .../it/project-setup/src/it/project2/pom.xml | 32 + .../src/it/project3/invoker.properties | 18 + .../it/project-setup/src/it/project3/pom.xml | 32 + .../it/project-setup/src/it/project4/pom.xml | 32 + .../it/project-setup/src/it/project5/pom.xml | 32 + .../src/it/project6/invoker.properties | 18 + .../it/project-setup/src/it/project6/pom.xml | 32 + .../src/src/it/project-setup/verify.bsh | 88 + .../script-accessibility/invoker.properties | 18 + .../src/src/it/script-accessibility/pom.xml | 68 + .../src/it/beanshell/pom.xml | 32 + .../src/it/beanshell/verify.bsh | 25 + .../src/it/groovy/pom.xml | 32 + .../src/it/groovy/verify.groovy | 25 + .../src/main/java/org/MyClass.java | 34 + .../src/src/it/script-additional-vars/pom.xml | 68 + .../src/it/beanshell/pom.xml | 32 + .../src/it/beanshell/postbuild.bsh | 43 + .../src/it/beanshell/prebuild.bsh | 43 + .../src/it/beanshell/selector.bsh | 41 + .../src/it/groovy/pom.xml | 32 + .../src/it/groovy/postbuild.groovy | 43 + .../src/it/groovy/prebuild.groovy | 43 + .../src/it/groovy/selector.groovy | 41 + .../script-class-loading/invoker.properties | 18 + .../src/src/it/script-class-loading/pom.xml | 77 + .../src/it/beanshell/pom.xml | 32 + .../src/it/beanshell/postbuild.bsh | 50 + .../src/it/beanshell/prebuild.bsh | 50 + .../src/it/groovy/pom.xml | 32 + .../src/it/groovy/postbuild.groovy | 51 + .../src/it/groovy/prebuild.groovy | 51 + .../src/test/java/org/MyUtils.java | 31 + .../it/script-classpath-duplicates/pom.xml | 81 + .../src/it/beanshell/pom.xml | 32 + .../src/it/beanshell/postbuild.bsh | 39 + .../src/it/beanshell/prebuild.bsh | 39 + .../src/it/groovy/pom.xml | 32 + .../src/it/groovy/postbuild.groovy | 39 + .../src/it/groovy/prebuild.groovy | 39 + .../it/script-classpath-duplicates/verify.bsh | 49 + .../src/src/it/script-context/pom.xml | 68 + .../script-context/src/it/beanshell/pom.xml | 32 + .../script-context/src/it/beanshell/setup.bsh | 26 + .../src/it/beanshell/verify.bsh | 29 + .../it/script-context/src/it/groovy/pom.xml | 32 + .../script-context/src/it/groovy/setup.groovy | 26 + .../src/it/groovy/verify.groovy | 29 + .../src/src/it/script-context/verify.bsh | 40 + .../src/src/it/script-errors/pom.xml | 71 + .../it/script-errors/src/it/beanshell/pom.xml | 32 + .../script-errors/src/it/beanshell/setup.bsh | 27 + .../it/script-errors/src/it/groovy/pom.xml | 32 + .../script-errors/src/it/groovy/setup.groovy | 27 + .../src/src/it/script-errors/verify.bsh | 41 + .../src/src/it/script-global-vars/pom.xml | 67 + .../src/it/beanshell/pom.xml | 32 + .../src/it/beanshell/setup.bsh | 56 + .../src/it/beanshell/verify.bsh | 56 + .../script-global-vars/src/it/groovy/pom.xml | 32 + .../src/it/groovy/setup.groovy | 56 + .../src/it/groovy/verify.groovy | 56 + .../it/script-interpreter-detection/pom.xml | 67 + .../src/it/beanshell/pom.xml | 32 + .../src/it/beanshell/postbuild.bsh | 39 + .../src/it/beanshell/prebuild.bsh | 39 + .../src/it/groovy/pom.xml | 32 + .../src/it/groovy/postbuild.groovy | 39 + .../src/it/groovy/prebuild.groovy | 39 + .../script-interpreter-detection/verify.bsh | 49 + .../src/src/it/script-verify-xml/pom.xml | 61 + .../src/it/minvoker-138/pom.xml | 32 + .../src/it/script-verify-xml/verify.groovy | 67 + .../src/src/it/selector-conditions/pom.xml | 67 + .../it/jre-version-match/invoker.properties | 18 + .../src/it/jre-version-match/pom.xml | 32 + .../src/it/jre-version-match/postbuild.bsh | 26 + .../jre-version-mismatch/invoker.properties | 18 + .../src/it/jre-version-mismatch/pom.xml | 32 + .../src/it/jre-version-mismatch/postbuild.bsh | 26 + .../it/maven-version-match/invoker.properties | 18 + .../src/it/maven-version-match/pom.xml | 32 + .../src/it/maven-version-match/postbuild.bsh | 26 + .../maven-version-mismatch/invoker.properties | 18 + .../src/it/maven-version-mismatch/pom.xml | 32 + .../it/maven-version-mismatch/postbuild.bsh | 26 + .../src/it/os-family-match/invoker.properties | 18 + .../src/it/os-family-match/pom.xml | 32 + .../src/it/os-family-match/postbuild.bsh | 26 + .../it/os-family-mismatch/invoker.properties | 18 + .../src/it/os-family-mismatch/pom.xml | 32 + .../src/it/os-family-mismatch/postbuild.bsh | 26 + .../it/toolchain-mismatch/invoker.properties | 18 + .../src/it/toolchain-mismatch/pom.xml | 32 + .../src/it/toolchain-mismatch/postbuild.bsh | 26 + .../src/it/selector-conditions/verify.groovy | 38 + .../src/src/it/selector-scripts/pom.xml | 68 + .../src/src/it/selector-scripts/setup.groovy | 27 + .../src/it/script-ret-false/pom.xml | 32 + .../src/it/script-ret-false/postbuild.bsh | 26 + .../src/it/script-ret-false/selector.bsh | 22 + .../src/it/script-ret-other/pom.xml | 32 + .../src/it/script-ret-other/postbuild.bsh | 26 + .../src/it/script-ret-other/selector.bsh | 22 + .../src/it/script-ret-quiet/pom.xml | 32 + .../src/it/script-ret-quiet/postbuild.bsh | 26 + .../src/it/script-ret-quiet/selector.bsh | 21 + .../src/it/script-ret-true/pom.xml | 32 + .../src/it/script-ret-true/postbuild.bsh | 27 + .../src/it/script-ret-true/selector.bsh | 22 + .../src/it/script-throw/pom.xml | 32 + .../src/it/script-throw/postbuild.bsh | 26 + .../src/it/script-throw/selector.bsh | 22 + .../src/src/it/selector-scripts/verify.bsh | 115 + .../src/src/it/settings-auto-exclude/pom.xml | 74 + .../src/it/project/pom.xml | 32 + .../settings-auto-exclude/src/it/settings.xml | 55 + .../it/settings-inherit/invoker.properties | 19 + .../src/src/it/settings-inherit/pom.xml | 63 + .../settings-inherit/src/it/project/pom.xml | 64 + .../invoker.properties | 19 + .../it/settings-merge-multiexecutions/pom.xml | 64 + .../src/it/minvoker-133/pom.xml | 28 + .../src/it/settings.xml | 55 + .../src/it/settings-merge/invoker.properties | 20 + .../src/src/it/settings-merge/pom.xml | 65 + .../it/settings-merge/src/it/project/pom.xml | 87 + .../src/it/settings-merge/src/it/settings.xml | 42 + .../settings-merge_jdk9+/invoker.properties | 19 + .../src/src/it/settings-merge_jdk9+/pom.xml | 65 + .../src/it/project/pom.xml | 84 + .../src/it/project/postbuild.groovy | 27 + .../settings-merge_jdk9+/src/it/settings.xml | 42 + .../it/settings-override/invoker.properties | 19 + .../src/src/it/settings-override/pom.xml | 63 + .../src/it/project/invoker.properties | 18 + .../settings-override/src/it/project/pom.xml | 58 + .../src/it/project/postbuild.groovy | 21 + .../src/it/settings-override.xml | 34 + .../it/settings-override/src/it/settings.xml | 34 + .../src/src/it/settings.xml | 94 + .../src/src/it/skip-install/pom.xml | 58 + .../src/src/it/skip-install/test.properties | 19 + .../src/src/it/skip-install/verify.bsh | 32 + .../src/src/it/skip-run/pom.xml | 66 + .../src/it/skip-run/src/it/project/pom.xml | 33 + .../it/skip-run/src/it/project/prebuild.bsh | 26 + .../src/src/it/skip-run/test.properties | 19 + .../src/src/it/skip-run/verify.bsh | 41 + .../invoker.properties | 19 + .../it/spaces-should-work_non-windows/pom.xml | 68 + .../setup.groovy | 32 + .../src/it/minvoker-test/invoker.properties | 19 + .../src/it/minvoker-test/pom.xml | 54 + .../src/it/minvoker-test/verify.groovy | 26 + .../invoker.properties | 20 + .../src/it/spaces-should-work_windows/pom.xml | 64 + .../spaces-should-work_windows/setup.groovy | 32 + .../src/it/minvoker-test/invoker.properties | 19 + .../src/it/minvoker-test/pom.xml | 54 + .../src/it/minvoker-test/verify.groovy | 26 + .../invoker.properties | 18 + .../it/special-characters-should-work/pom.xml | 68 + .../setup.groovy | 32 + .../src/it/minvoker-test/invoker.properties | 19 + .../src/it/minvoker-test/pom.xml | 54 + .../src/it/minvoker-test/verify.groovy | 20 + .../staging-dependencies/invoker.properties | 18 + .../src/src/it/staging-dependencies/pom.xml | 100 + .../maven/its/dep/1.0/dep-1.0-tests.jar | Bin 0 -> 345 bytes .../org/apache/maven/its/dep/1.0/dep-1.0.pom | 8 + .../org/apache/maven/its/dep/2.0/dep-2.0.jar | Bin 0 -> 345 bytes .../org/apache/maven/its/dep/2.0/dep-2.0.pom | 8 + .../apache/maven/its/dep/maven-metadata.xml | 34 + .../1.0-SNAPSHOT/maven-metadata.xml | 33 + .../minvoker-70-1.0-20081020.164906-1.jar | Bin 0 -> 345 bytes .../minvoker-70-1.0-20081020.164906-1.pom | 12 + .../maven/its/minvoker-70/maven-metadata.xml | 32 + .../parent-a/0.1-SNAPSHOT/maven-metadata.xml | 33 + .../parent-a-0.1-20081020.164906-1.pom | 8 + .../parent-b/0.1-SNAPSHOT/maven-metadata.xml | 33 + .../parent-b-0.1-20081020.164906-1.pom | 12 + .../its/pom/0.3-SNAPSHOT/maven-metadata.xml | 33 + .../pom-0.3-20081020.164906-1.pom | 8 + .../src/it/staging-dependencies/verify.bsh | 94 + .../src/src/it/staging-pom/invoker.properties | 18 + .../src/src/it/staging-pom/pom.xml | 59 + .../src/src/it/staging-pom/src/site/site.xml | 25 + .../src/src/it/staging-pom/verify.bsh | 54 + .../src/it/staging-reactor/invoker.properties | 18 + .../it/staging-reactor/mod1-parent/pom.xml | 47 + .../src/src/it/staging-reactor/mod1/pom.xml | 73 + .../src/src/it/staging-reactor/mod2/pom.xml | 59 + .../mod2/src/main/resources/main.properties | 17 + .../src/src/it/staging-reactor/pom.xml | 52 + .../src/it/staging-reactor/src/site/site.xml | 25 + .../src/src/it/staging-reactor/verify.bsh | 69 + .../invoker.properties | 18 + .../src/it/wrongPropertyInterpolation/pom.xml | 63 + .../src/it/project/invoker.properties | 19 + .../src/it/project/pom.xml | 54 + .../plugins/invoker/AbstractInvokerMojo.java | 2876 ++++++++++++++++ .../maven/plugins/invoker/CompositeMap.java | 258 ++ .../maven/plugins/invoker/FileLogger.java | 62 + .../maven/plugins/invoker/InstallMojo.java | 661 ++++ .../plugins/invoker/IntegrationTestMojo.java | 47 + .../maven/plugins/invoker/InvokerMojo.java | 94 + .../plugins/invoker/InvokerProperties.java | 484 +++ .../maven/plugins/invoker/InvokerReport.java | 359 ++ .../maven/plugins/invoker/InvokerSession.java | 342 ++ .../plugins/invoker/InvokerToolchain.java | 55 + .../maven/plugins/invoker/MetadataUtils.java | 168 + .../maven/plugins/invoker/PomUtils.java | 64 + .../maven/plugins/invoker/ReportUtils.java | 63 + .../maven/plugins/invoker/Selector.java | 131 + .../maven/plugins/invoker/SelectorUtils.java | 327 ++ .../invoker/SystemPropertyPrinter.java | 42 + .../maven/plugins/invoker/VerifyMojo.java | 156 + .../src/src/main/mdo/invocation.mdo | 226 ++ .../main/resources/invoker-report.properties | 35 + .../resources/invoker-report_de.properties | 35 + .../resources/invoker-report_en.properties | 23 + .../resources/invoker-report_fr.properties | 35 + .../apt/examples/access-test-classes.apt.vm | 64 + .../site/apt/examples/clone-projects.apt.vm | 72 + .../src/src/site/apt/examples/fast-use.apt.vm | 143 + .../src/site/apt/examples/filtering.apt.vm | 136 + .../apt/examples/install-artifacts.apt.vm | 66 + .../examples/integration-test-verify.apt.vm | 60 + .../apt/examples/invoker-properties.apt.vm | 93 + .../apt/examples/logs-for-failed-tests.apt.vm | 56 + .../apt/examples/post-build-script.apt.vm | 97 + .../apt/examples/prepare-build-env.apt.vm | 75 + .../apt/examples/selector-conditions.apt.vm | 67 + .../site/apt/examples/selector-scripts.apt.vm | 88 + .../src/src/site/apt/examples/skipping.apt.vm | 62 + .../src/src/site/apt/index.apt.vm | 105 + .../src/src/site/apt/usage.apt.vm | 137 + .../src/src/site/fml/faq.fml | 76 + .../src/src/site/resources/download.cgi | 22 + .../src/src/site/site.xml | 82 + .../src/src/site/xdoc/download.xml.vm | 126 + .../invoker/ExtendedMavenProjectStub.java | 57 + .../plugins/invoker/InterpolationTest.java | 126 + .../plugins/invoker/InvokerMojoTest.java | 120 + .../invoker/InvokerPropertiesTest.java | 441 +++ .../maven/plugins/invoker/SelectorTest.java | 81 + .../plugins/invoker/SelectorUtilsTest.java | 145 + .../src/src/test/resources/unit/dummy/pom.xml | 29 + .../resources/unit/goals-from-file/pom.xml | 26 + .../resources/unit/goals-from-file/verify.bsh | 48 + .../test/resources/unit/interpolation/pom.xml | 29 + .../unit/profiles-from-file/emptyProfiles.txt | 0 .../unit/profiles-from-file/profiles.txt | 1 + .../Dockerfile | 18 + .../buggy.java | 2880 +++++++++++++++++ .../metadata.json | 21 + .../npe.json | 7 + .../Dockerfile | 18 + .../buggy.java | 2880 +++++++++++++++++ .../metadata.json | 21 + .../npe.json | 7 + .../Dockerfile | 18 + .../buggy.java | 321 ++ .../metadata.json | 21 + .../npe.json | 7 + 514 files changed, 34186 insertions(+) create mode 100644 Java-base/maven-invoker-plugin/Dockerfile create mode 100644 Java-base/maven-invoker-plugin/src/Jenkinsfile create mode 100644 Java-base/maven-invoker-plugin/src/README.md create mode 100644 Java-base/maven-invoker-plugin/src/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-190-logDirectory/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-190-logDirectory/src/it/module/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-190-logDirectory/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-a/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-a/src/main/java/org/apache/maven/plugins/foo/Hello.java create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-a/src/test/java/org/apache/maven/plugins/foo/HelloTest.java create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-b/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-b/src/main/java/org/apache/maven/plugins/foo/Hello.java create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-b/src/test/java/org/apache/maven/plugins/foo/HelloTest.java create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/plugin/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/plugin/src/it/basic/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/plugin/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project_2/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project_2/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/module-a/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/module-b/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/plugin/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/clone-clean/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/clone-clean/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/clone-clean/setup.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/clone-clean/src/it/clone-clean/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/clone-clean/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/src/it/clone-clean/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/src/it/basic/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/src/it/basic/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java create mode 100644 Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/src/it/basic/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java create mode 100644 Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/src/it/project/prebuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build/src/it/project/prebuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-build/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-ignore-with-verify/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-ignore-with-verify/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-ignore/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-ignore/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_integration-test/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_run/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_run/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_verify/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_verify/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/src/it/project/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/src/it/project/prebuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/src/it/project/prebuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/src/it/project/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/src/it/project/src/main/java/Foo.java create mode 100644 Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/src/it/project/.mvn/extensions.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/install-extra-artifacts/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/install-extra-artifacts/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/src/it/project/prebuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-cmdline-exclude/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-cmdline-exclude/src/it/minvoker-140/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-cmdline-exclude/test.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-debug/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-debug/src/it/minvoker-142/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-debug/src/it/minvoker-142/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-debug/src/it/minvoker-142/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-emptyproperty/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-emptyproperty/src/it/minvoker-118/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-145/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-145/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-255/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-255/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-255/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/sub-1/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/sub-1/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/sub-2/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-2/sub-1/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-2/sub-1/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-2/sub-2/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/src/main/java/org/TestMojo.java create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/system1.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/system2.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-offline/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-offline/src/it/project/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-offline/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-offline/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-offline/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/setup.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/sub-1/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/sub-2/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/sub-3/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-project/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/itests/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/itests/src/it/basic/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/plugin/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/plugin/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/src/it projects/project/spacy pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/src/it projects/project/src/main/resources/test.txt create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/src/it projects/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-build/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-post/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-post/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-post/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-pre/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-pre/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-pre/setup.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-jre/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-jre/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-maven/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-maven/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-os/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-os/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/success/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/success/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/invoker-report/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-default/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-default/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-default/src/it/project/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-default/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-default/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-path/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-path/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-path/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-path/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-url/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-url/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-url/src/it/project/postbuild.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-url/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/local-repo-url/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/src/it/clone-clean/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/src/it/latin-1/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/src/it/utf-8/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1-parent/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1/src/it/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod2/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod3/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod3/src/it/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-filtering/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-less-invocation/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-less-invocation/src/it/no-pom/workaround.txt create mode 100644 Java-base/maven-invoker-plugin/src/src/it/pom-less-invocation/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/App.java create mode 100644 Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/AppTest.java create mode 100644 Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/system2.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/aggregator/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/module-a/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/module-b/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/parent/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-cloning/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-cloning/setup.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-cloning/src/it/module-1/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-cloning/src/it/module-1/sub-module/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-cloning/src/it/module/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-cloning/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-setup/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project1/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project1/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project2/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project3/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project3/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project4/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project5/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project6/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project6/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/project-setup/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-accessibility/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-accessibility/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/beanshell/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/beanshell/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/groovy/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/groovy/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/main/java/org/MyClass.java create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/prebuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/selector.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/postbuild.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/prebuild.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/selector.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-class-loading/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-class-loading/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/beanshell/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/beanshell/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/beanshell/prebuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/groovy/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/groovy/postbuild.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/groovy/prebuild.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/test/java/org/MyUtils.java create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/beanshell/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/beanshell/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/beanshell/prebuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/groovy/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/groovy/postbuild.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/groovy/prebuild.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-context/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/beanshell/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/beanshell/setup.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/beanshell/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/groovy/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/groovy/setup.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/groovy/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-context/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-errors/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/beanshell/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/beanshell/setup.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/groovy/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/groovy/setup.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-errors/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-global-vars/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/beanshell/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/beanshell/setup.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/beanshell/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/groovy/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/groovy/setup.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/groovy/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/beanshell/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/beanshell/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/beanshell/prebuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/groovy/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/groovy/postbuild.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/groovy/prebuild.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-verify-xml/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-verify-xml/src/it/minvoker-138/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/script-verify-xml/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-match/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-match/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-match/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-mismatch/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-mismatch/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-mismatch/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-match/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-match/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-match/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-mismatch/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-mismatch/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-mismatch/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-match/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-match/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-match/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-mismatch/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-mismatch/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-mismatch/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/toolchain-mismatch/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/toolchain-mismatch/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/toolchain-mismatch/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-conditions/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/setup.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-false/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-false/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-false/selector.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-other/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-other/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-other/selector.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-quiet/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-quiet/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-quiet/selector.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-true/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-true/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-true/selector.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-throw/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-throw/postbuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-throw/selector.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/selector-scripts/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-auto-exclude/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-auto-exclude/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-auto-exclude/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-inherit/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-inherit/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-inherit/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/src/it/minvoker-133/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-merge/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-merge/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-merge/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-merge/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/src/it/project/postbuild.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-override/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-override/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/project/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/project/postbuild.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/settings-override.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/settings.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/skip-install/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/skip-install/test.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/skip-install/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/skip-run/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/skip-run/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/skip-run/src/it/project/prebuild.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/skip-run/test.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/skip-run/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/setup.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/src/it/minvoker-test/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/src/it/minvoker-test/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/src/it/minvoker-test/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/setup.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/src/it/minvoker-test/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/src/it/minvoker-test/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/src/it/minvoker-test/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/setup.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/src/it/minvoker-test/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/src/it/minvoker-test/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/src/it/minvoker-test/verify.groovy create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/1.0/dep-1.0-tests.jar create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/1.0/dep-1.0.pom create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/2.0/dep-2.0.jar create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/2.0/dep-2.0.pom create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/maven-metadata.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/maven-metadata.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-20081020.164906-1.jar create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-20081020.164906-1.pom create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/maven-metadata.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-a/0.1-SNAPSHOT/maven-metadata.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-a/0.1-SNAPSHOT/parent-a-0.1-20081020.164906-1.pom create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-b/0.1-SNAPSHOT/maven-metadata.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-b/0.1-SNAPSHOT/parent-b-0.1-20081020.164906-1.pom create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/pom/0.3-SNAPSHOT/maven-metadata.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/pom/0.3-SNAPSHOT/pom-0.3-20081020.164906-1.pom create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-pom/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-pom/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-pom/src/site/site.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-pom/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-reactor/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod1-parent/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod1/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod2/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod2/src/main/resources/main.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-reactor/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-reactor/src/site/site.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/staging-reactor/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/src/it/project/invoker.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/src/it/project/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/CompositeMap.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/FileLogger.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/IntegrationTestMojo.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerMojo.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerProperties.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerToolchain.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/MetadataUtils.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/PomUtils.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/ReportUtils.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/Selector.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/SelectorUtils.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/SystemPropertyPrinter.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/VerifyMojo.java create mode 100644 Java-base/maven-invoker-plugin/src/src/main/mdo/invocation.mdo create mode 100644 Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report_de.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report_en.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report_fr.properties create mode 100644 Java-base/maven-invoker-plugin/src/src/site/apt/examples/access-test-classes.apt.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/site/apt/examples/clone-projects.apt.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/site/apt/examples/fast-use.apt.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/site/apt/examples/filtering.apt.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/site/apt/examples/install-artifacts.apt.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/site/apt/examples/integration-test-verify.apt.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/site/apt/examples/invoker-properties.apt.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/site/apt/examples/logs-for-failed-tests.apt.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/site/apt/examples/post-build-script.apt.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/site/apt/examples/prepare-build-env.apt.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/site/apt/examples/selector-conditions.apt.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/site/apt/examples/selector-scripts.apt.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/site/apt/examples/skipping.apt.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/site/apt/index.apt.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/site/apt/usage.apt.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/site/fml/faq.fml create mode 100644 Java-base/maven-invoker-plugin/src/src/site/resources/download.cgi create mode 100644 Java-base/maven-invoker-plugin/src/src/site/site.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/site/xdoc/download.xml.vm create mode 100644 Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/ExtendedMavenProjectStub.java create mode 100644 Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/InterpolationTest.java create mode 100644 Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/InvokerMojoTest.java create mode 100644 Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java create mode 100644 Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/SelectorTest.java create mode 100644 Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/SelectorUtilsTest.java create mode 100644 Java-base/maven-invoker-plugin/src/src/test/resources/unit/dummy/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/test/resources/unit/goals-from-file/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/test/resources/unit/goals-from-file/verify.bsh create mode 100644 Java-base/maven-invoker-plugin/src/src/test/resources/unit/interpolation/pom.xml create mode 100644 Java-base/maven-invoker-plugin/src/src/test/resources/unit/profiles-from-file/emptyProfiles.txt create mode 100644 Java-base/maven-invoker-plugin/src/src/test/resources/unit/profiles-from-file/profiles.txt create mode 100644 Java/maven-invoker-plugin-AbstractInvokerMojo_2646/Dockerfile create mode 100644 Java/maven-invoker-plugin-AbstractInvokerMojo_2646/buggy.java create mode 100644 Java/maven-invoker-plugin-AbstractInvokerMojo_2646/metadata.json create mode 100644 Java/maven-invoker-plugin-AbstractInvokerMojo_2646/npe.json create mode 100644 Java/maven-invoker-plugin-AbstractInvokerMojo_2652/Dockerfile create mode 100644 Java/maven-invoker-plugin-AbstractInvokerMojo_2652/buggy.java create mode 100644 Java/maven-invoker-plugin-AbstractInvokerMojo_2652/metadata.json create mode 100644 Java/maven-invoker-plugin-AbstractInvokerMojo_2652/npe.json create mode 100644 Java/maven-invoker-plugin-SelectorUtils_50/Dockerfile create mode 100644 Java/maven-invoker-plugin-SelectorUtils_50/buggy.java create mode 100644 Java/maven-invoker-plugin-SelectorUtils_50/metadata.json create mode 100644 Java/maven-invoker-plugin-SelectorUtils_50/npe.json diff --git a/Java-base/maven-invoker-plugin/Dockerfile b/Java-base/maven-invoker-plugin/Dockerfile new file mode 100644 index 000000000..e208c4890 --- /dev/null +++ b/Java-base/maven-invoker-plugin/Dockerfile @@ -0,0 +1,28 @@ +FROM ubuntu:22.04 + +RUN export DEBIAN_FRONTEND=noninteractive \ + && apt-get update \ + && apt-get install -y software-properties-common \ + && add-apt-repository ppa:deadsnakes/ppa \ + && apt-get update \ + && apt-get install -y \ + build-essential \ + git \ + vim \ + jq \ + && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/list/* + +RUN apt-get -y install sudo \ + openjdk-8-jdk \ + maven + +RUN bash -c "echo 2 | update-alternatives --config java" + +COPY src /workspace +WORKDIR /workspace + +RUN mvn install -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100 -DskipTests=true -DskipITs=true -Dtest=None -DfailIfNoTests=false + +RUN mvn test -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100 + +ENV TZ=Asia/Seoul diff --git a/Java-base/maven-invoker-plugin/src/Jenkinsfile b/Java-base/maven-invoker-plugin/src/Jenkinsfile new file mode 100644 index 000000000..e9f05f7d9 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/Jenkinsfile @@ -0,0 +1,20 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +asfMavenTlpPlgnBuild() diff --git a/Java-base/maven-invoker-plugin/src/README.md b/Java-base/maven-invoker-plugin/src/README.md new file mode 100644 index 000000000..bb8c0b369 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/README.md @@ -0,0 +1,99 @@ + +Contributing to [Apache Maven Invoker Plugin](https://maven.apache.org/plugins/maven-invoker-plugin/) +====================== + +[![ASF Jira](https://img.shields.io/endpoint?url=https%3A%2F%2Fmaven.apache.org%2Fbadges%2Fasf_jira-MINVOKER.json)][jira] +[![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/apache/maven.svg?label=License)][license] +[![Maven Central](https://img.shields.io/maven-central/v/org.apache.maven.plugins/maven-invoker-plugin.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.apache.maven.plugins/maven-invoker-plugin) +[![Jenkins Status](https://img.shields.io/jenkins/s/https/builds.apache.org/job/maven-box/job/maven-invoker-plugin/job/master.svg?)][build] +[![Jenkins tests](https://img.shields.io/jenkins/t/https/builds.apache.org/job/maven-box/job/maven-invoker-plugin/job/master.svg?)][test-results] + + +You have found a bug or you have an idea for a cool new feature? Contributing +code is a great way to give something back to the open source community. Before +you dig right into the code, there are a few guidelines that we need +contributors to follow so that we can have a chance of keeping on top of +things. + +Getting Started +--------------- + ++ Make sure you have a [JIRA account](https://issues.apache.org/jira/). ++ Make sure you have a [GitHub account](https://github.com/signup/free). ++ If you're planning to implement a new feature, it makes sense to discuss your changes + on the [dev list][ml-list] first. + This way you can make sure you're not wasting your time on something that isn't + considered to be in Apache Maven's scope. ++ Submit a ticket for your issue, assuming one does not already exist. + + Clearly describe the issue, including steps to reproduce when it is a bug. + + Make sure you fill in the earliest version that you know has the issue. ++ Fork the repository on GitHub. + +Making and Submitting Changes +-------------- + +We accept Pull Requests via GitHub. The [developer mailing list][ml-list] is the +main channel of communication for contributors. +There are some guidelines which will make applying PRs easier for us: ++ Create a topic branch from where you want to base your work (this is usually the master branch). + Push your changes to a topic branch in your fork of the repository. ++ Make commits of logical units. ++ Respect the original code style: by using the same [codestyle][code-style], + patches should only highlight the actual difference, not being disturbed by any formatting issues: + + Only use spaces for indentation. + + Create minimal diffs - disable on save actions like reformat source code or organize imports. + If you feel the source code should be reformatted, create a separate PR for this change. + + Check for unnecessary whitespace with `git diff --check` before committing. ++ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue. +``` +[MINVOKER-XXX] - Subject of the JIRA Ticket + Optional supplemental description. +``` ++ Make sure you have added the necessary tests (JUnit/IT) for your changes. ++ Run all the tests with `mvn -Prun-its verify` to assure nothing else was accidentally broken. ++ Submit a pull request to the repository in the Apache organization. ++ Update your JIRA ticket and include a link to the pull request in the ticket. + +If you plan to contribute on a regular basis, please consider filing a [contributor license agreement][cla]. + +Making Trivial Changes +---------------------- + +For changes of a trivial nature to comments and documentation, it is not always +necessary to create a new ticket in JIRA. In this case, it is appropriate to +start the first line of a commit with '(doc)' instead of a ticket number. + +Additional Resources +-------------------- + ++ [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch) ++ [Apache Maven Invoker Plugin JIRA project page][jira] ++ [Contributor License Agreement][cla] ++ [General GitHub documentation](https://help.github.com/) ++ [GitHub pull request documentation](https://help.github.com/send-pull-requests/) ++ [Apache Maven Twitter Account](https://twitter.com/ASFMavenProject) ++ #Maven IRC channel on freenode.org + +[jira]: https://issues.apache.org/jira/projects/MINVOKER/ +[license]: https://www.apache.org/licenses/LICENSE-2.0 +[ml-list]: https://maven.apache.org/mailing-lists.html +[code-style]: https://maven.apache.org/developers/conventions/code.html +[cla]: https://www.apache.org/licenses/#clas +[maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index +[test-results]: https://builds.apache.org/job/maven-box/job/maven-invoker-plugin/job/master/lastCompletedBuild/testReport/ +[build]: https://builds.apache.org/job/maven-box/job/maven-invoker-plugin/job/master/ diff --git a/Java-base/maven-invoker-plugin/src/pom.xml b/Java-base/maven-invoker-plugin/src/pom.xml new file mode 100644 index 000000000..7926ad5db --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/pom.xml @@ -0,0 +1,408 @@ + + + + + + 4.0.0 + + + maven-plugins + org.apache.maven.plugins + 34 + ../../pom/maven/maven-plugins/pom.xml + + + maven-invoker-plugin + 3.2.2-SNAPSHOT + maven-plugin + + Apache Maven Invoker Plugin + + The Maven Invoker Plugin is used to run a set of Maven projects. The plugin can determine whether each project + execution is successful, and optionally can verify the output generated from a given project execution. + + + + ${mavenVersion} + + + + scm:git:https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git + scm:git:https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git + https://github.com/apache/maven-invoker-plugin/tree/${project.scm.tag} + HEAD + + + jira + https://issues.apache.org/jira/browse/MINVOKER/issues + + + Jenkins + https://builds.apache.org/job/maven-box/job/maven-invoker-plugin/ + + + + apache.website + scm:svn:https://svn.apache.org/repos/asf/maven/website/components/${maven.site.path} + + + + + 7 + 3.0 + 1.9.1 + 1.9.2 + org.beanshell + bsh + 2.0b4 + org.codehaus.groovy + groovy-all + 2.4.19 + 2.22.2 + 2020-02-22T16:40:59Z + + + + + org.apache.maven.shared + maven-invoker + 3.0.1 + + + org.apache.maven + maven-core + ${mavenVersion} + + + org.apache.maven + maven-model + ${mavenVersion} + + + org.apache.maven + maven-plugin-api + ${mavenVersion} + + + org.apache.maven + maven-artifact + ${mavenVersion} + + + org.apache.maven + maven-settings + ${mavenVersion} + + + org.apache.maven.reporting + maven-reporting-api + 3.0 + + + org.apache.maven.reporting + maven-reporting-impl + 3.0.0 + + + + org.apache.maven.plugin-tools + maven-plugin-annotations + provided + + + + org.apache.maven.shared + maven-script-interpreter + 1.2 + + + + org.codehaus.groovy + groovy + + + + + + org.apache.maven.shared + maven-artifact-transfer + 0.11.0 + + + + + org.apache.maven.doxia + doxia-sink-api + ${doxiaVersion} + + + org.apache.maven.doxia + doxia-decoration-model + ${doxiaSitetoolsVersion} + + + org.apache.maven.doxia + doxia-core + ${doxiaVersion} + + + + + org.apache.maven.doxia + doxia-site-renderer + ${doxiaSitetoolsVersion} + + + org.codehaus.plexus + plexus-container-default + + + + + + ${beanshell-groupId} + ${beanshell-artifactId} + ${beanshell-version} + runtime + + + ${groovy-groupId} + ${groovy-artifactId} + ${groovy-version} + runtime + + + + org.codehaus.plexus + plexus-utils + 3.1.0 + + + commons-io + commons-io + 2.5 + + + org.codehaus.plexus + plexus-interpolation + 1.26 + + + org.codehaus.plexus + plexus-i18n + 1.0-beta-7 + + + org.codehaus.plexus + plexus-container-default + + + org.codehaus.plexus + plexus-component-api + + + + + org.apache.maven.shared + maven-shared-utils + 3.2.1 + + + + junit + junit + 4.13 + test + + + org.mockito + mockito-core + 2.28.2 + test + + + org.apache.maven.plugin-testing + maven-plugin-testing-harness + 2.1 + test + + + org.apache.maven + maven-compat + ${mavenVersion} + test + + + + + + + + + + org.apache.rat + apache-rat-plugin + + + src/it/staging-dependencies/repo/**/* + src/it/**/*.txt + src/test/**/*.txt + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + + + + maven-enforcer-plugin + 3.0.0-M3 + + + maven-project-info-reports-plugin + 3.1.0 + + + + + + + org.apache.rat + apache-rat-plugin + + + org.codehaus.modello + modello-maven-plugin + + + standard + + + xpp3-reader + + xpp3-writer + + java + + + + site-docs + pre-site + + xdoc + + + + + + src/main/mdo/invocation.mdo + + 1.0.0 + true + + + + + + + + run-its + + 3.7.1 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + 3.2.1 + + ${project.build.directory}/it + setup + verify + ${project.build.directory}/local-repo + src/it/settings.xml + -Djava.io.tmpdir=${project.build.directory} + + + ${https.protocols} + ${maven.compiler.source} + ${maven.compiler.target} + + + ${project.version} + + + clean + initialize + + + + + + + + + + + windows-its + + + windows + + + + + + + org.apache.maven.plugins + maven-invoker-plugin + + -Djava.io.tmpdir="${project.build.directory}" + + + + + + + + dev + + + + + org.apache.maven.plugins + maven-invoker-plugin + ${project.version} + + true + true + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-190-logDirectory/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-190-logDirectory/pom.xml new file mode 100644 index 000000000..46237d98c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-190-logDirectory/pom.xml @@ -0,0 +1,65 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + project-cloning + 1.0-SNAPSHOT + pom + + Test to check for proper project cloning + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + ${project.build.directory}/it + + **/pom.xml + + ${project.build.directory}/it-logs + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-190-logDirectory/src/it/module/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-190-logDirectory/src/it/module/pom.xml new file mode 100644 index 000000000..5badb327b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-190-logDirectory/src/it/module/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + org.apache.maven.test + unit + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-190-logDirectory/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-190-logDirectory/verify.groovy new file mode 100644 index 000000000..514b93df2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-190-logDirectory/verify.groovy @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +assert !(new File(basedir,'target/it/module/build.log').exists()) +assert new File(basedir,'target/it-logs/module/build.log').exists() diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/invoker.properties new file mode 100644 index 000000000..bf50e934a --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = verify -T3 diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-a/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-a/pom.xml new file mode 100644 index 000000000..942b5b3be --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-a/pom.xml @@ -0,0 +1,40 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + MINVOKER-191-parent + 1.0-SNAPSHOT + + MINVOKER-191-java-a + + + + junit + junit + 4.12 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-a/src/main/java/org/apache/maven/plugins/foo/Hello.java b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-a/src/main/java/org/apache/maven/plugins/foo/Hello.java new file mode 100644 index 000000000..b235be8af --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-a/src/main/java/org/apache/maven/plugins/foo/Hello.java @@ -0,0 +1,28 @@ +package org.apache.maven.plugins.foo; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 Hello { + + public static String sayHello(String who) throws Exception { + return "Hello " + who; + } + +} \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-a/src/test/java/org/apache/maven/plugins/foo/HelloTest.java b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-a/src/test/java/org/apache/maven/plugins/foo/HelloTest.java new file mode 100644 index 000000000..ea1e4ff63 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-a/src/test/java/org/apache/maven/plugins/foo/HelloTest.java @@ -0,0 +1,32 @@ +package org.apache.maven.plugins.foo; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.junit.Test; + +public class HelloTest { + + @Test + public void say_hello_test() throws Exception { + Hello.sayHello("foo"); + Thread.sleep(4000); + } + +} \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-b/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-b/pom.xml new file mode 100644 index 000000000..46cfd9257 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-b/pom.xml @@ -0,0 +1,40 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + MINVOKER-191-parent + 1.0-SNAPSHOT + + MINVOKER-191-java-b + + + + junit + junit + 4.12 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-b/src/main/java/org/apache/maven/plugins/foo/Hello.java b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-b/src/main/java/org/apache/maven/plugins/foo/Hello.java new file mode 100644 index 000000000..b235be8af --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-b/src/main/java/org/apache/maven/plugins/foo/Hello.java @@ -0,0 +1,28 @@ +package org.apache.maven.plugins.foo; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 Hello { + + public static String sayHello(String who) throws Exception { + return "Hello " + who; + } + +} \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-b/src/test/java/org/apache/maven/plugins/foo/HelloTest.java b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-b/src/test/java/org/apache/maven/plugins/foo/HelloTest.java new file mode 100644 index 000000000..f6c26db89 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/module-b/src/test/java/org/apache/maven/plugins/foo/HelloTest.java @@ -0,0 +1,32 @@ +package org.apache.maven.plugins.foo; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.junit.Test; + +public class HelloTest { + + @Test + public void say_hello_test() throws Exception { + Hello.sayHello("foo"); + Thread.sleep(2000); + } + +} \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/plugin/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/plugin/pom.xml new file mode 100644 index 000000000..cf5b9fce0 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/plugin/pom.xml @@ -0,0 +1,62 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + MINVOKER-191-parent + 1.0-SNAPSHOT + + MINVOKER-191-plugin + maven-plugin + + + + org.apache.maven + maven-plugin-api + 2.0 + + + + + + + org.apache.maven.plugins + maven-invoker-plugin + + ${project.build.directory}/it + ${project.build.directory}/local-repo + + + + itests + + install + run + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/plugin/src/it/basic/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/plugin/src/it/basic/pom.xml new file mode 100644 index 000000000..6d3c05a62 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/plugin/src/it/basic/pom.xml @@ -0,0 +1,47 @@ + + + + + + 4.0.0 + foo.it + basic + 1.0-SNAPSHOT + pom + + + + + org.apache.maven.plugins.invoker + MINVOKER-191-plugin + 1.0-SNAPSHOT + + + touch + + touch + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/plugin/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/plugin/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java new file mode 100644 index 000000000..c225e4b99 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/plugin/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java @@ -0,0 +1,78 @@ +package org.apache.maven.it.plugins.dummy; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +/** + * @goal touch + * @phase process-sources + */ +public class MyMojo + extends AbstractMojo +{ + /** + * Location of the file. + * @parameter expression="${project.build.directory}" + * @required + */ + private File outputDirectory; + + public void execute() + throws MojoExecutionException + { + File f = outputDirectory; + + if ( !f.exists() ) + { + f.mkdirs(); + } + + File touch = new File( f, "touch.txt" ); + + FileWriter w = null; + try + { + w = new FileWriter( touch ); + + w.write( "touch.txt" ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error creating file " + touch, e ); + } + finally + { + if ( w != null ) + { + try + { + w.close(); + } + catch ( IOException e ) + { + // ignore + } + } + } + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/pom.xml new file mode 100644 index 000000000..e556e9677 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-191/pom.xml @@ -0,0 +1,79 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + MINVOKER-191-parent + 1.0-SNAPSHOT + pom + + + Test of reported issue MINVOKER-191: install plugins try to install all reactors projects + even non dependendant projects which cause build using multi thread builds + + + + UTF-8 + + + + module-a + plugin + module-b + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.5.1 + + + org.apache.maven.plugins + maven-plugin-plugin + 2.9 + + + org.apache.maven.plugins + maven-resources-plugin + 2.6 + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + true + + + ${https.protocols} + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/pom.xml new file mode 100644 index 000000000..df2b064e6 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/pom.xml @@ -0,0 +1,73 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + junit-report-file + 1.0-SNAPSHOT + jar + + + Test to check for proper generation of junit report files + + + + UTF-8 + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 2.2 + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + true + verify + ${project.build.directory}/it-repo + src/it/settings.xml + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project/pom.xml new file mode 100644 index 000000000..0d15cde75 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test-junit-report + 0.1-SNAPSHOT + jar + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project/verify.groovy new file mode 100644 index 000000000..6b8ec7420 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project/verify.groovy @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ensure script context contains localRepositoryPath +assert new File( basedir, "../../../target/it-repo" ).canonicalFile.equals( localRepositoryPath ) + +File interpolatedSettings = new File( basedir, "../interpolated-settings.xml" ) +assert interpolatedSettings.isFile() + +def filename = new File( basedir, "../../../../../local-repo" ).canonicalPath +// Convert URL, see org.apache.maven.plugins.invoker.AbstractInvokerMojo.toUrl(String) +String url = "file://" + new File( filename ).toURI().path +if ( url.endsWith( "/" ) ) +{ + url = url.substring( 0, url.length() - 1 ) +} + +def settings = new XmlSlurper().parse( interpolatedSettings ) + +// ensure right settings and mirror are picked up +def sandboxMirror = settings.mirrors.mirror[0] +assert sandboxMirror.id.text() == "sandbox" +assert sandboxMirror.url.text() != "@localRepositoryUrl@" + +// sandboxMirror.url is NOT filled with localRepositoryPath, but with the localRepository of the parent Settings +assert sandboxMirror.url.text() == url diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project_2/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project_2/pom.xml new file mode 100644 index 000000000..7234f6556 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project_2/pom.xml @@ -0,0 +1,71 @@ + + + + + + 4.0.0 + test + pom-filtering-junit-report + 0.1-SNAPSHOT + jar + + + UTF-8 + + ${project.version} + + @project.version@ + @propertyFromPluginConfig@ + @propertyFromPropertiesSection@ + + @project-is-not-the-pom.version@ + + @project.name@ + @pom.name@ + + @itProperty@ + + @project.nonExistingPomValue@ + + @basedir@ + @baseurl@ + @localRepository@ + @localRepositoryUrl@ + + + + + + + ${basedir} + false + + *.xml + + + + + + maven-resources-plugin + 2.2 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project_2/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project_2/verify.groovy new file mode 100644 index 000000000..af6082a93 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/project_2/verify.groovy @@ -0,0 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +assert new File( basedir, "../../../target/it-repo_not_here" ).canonicalFile.equals( localRepositoryPath ) diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/settings.xml new file mode 100644 index 000000000..ca7b8ab93 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/src/it/settings.xml @@ -0,0 +1,31 @@ + + + + + + + + sandbox + A completely isolated repo to test the interpolation of "localRepositoryUrl" + @localRepositoryUrl@ + * + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/verify.groovy new file mode 100644 index 000000000..331b88481 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-196_junit_report_file/verify.groovy @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.text.contains( '[INFO] run post-build script verify.groovy' ) + +File invokerReports = new File( new File(basedir, "target"), 'invoker-reports' ) +assert invokerReports.exists() + +// test on first project +def testsuite = new XmlSlurper().parse( new File( invokerReports, "TEST-project.xml" ) ) + +assert testsuite.@name.text() != null +assert testsuite.@time.text() != null +assert testsuite.@tests.text() == "1" +assert testsuite.@errors.text() == "0" +assert testsuite.@skipped.text() == "0" +assert testsuite.@failures.text() == "0" + +assert testsuite.testcase.@name.text() == "project" +def systemOut = testsuite.testcase.'**'.findAll { node -> node.name() == 'system-out' }.get(0) +assert !systemOut.text().isEmpty() + + +// test on second project +testsuite = new XmlSlurper().parse( new File( invokerReports, "TEST-project_2.xml" ) ) + +assert testsuite.@name.text() != null +assert testsuite.@time.text() != null +assert testsuite.@tests.text() == "1" +assert testsuite.@errors.text() == "0" +assert testsuite.@skipped.text() == "0" +assert testsuite.@failures.text() == "1" + +assert testsuite.testcase.@name.text() == "project_2" +def failureMessage = testsuite.testcase.failure.@message +assert !failureMessage.text().isEmpty() diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/invoker.properties new file mode 100644 index 000000000..353946b69 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = verify diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/module-a/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/module-a/pom.xml new file mode 100644 index 000000000..6fbab1e09 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/module-a/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + minvoker251-parent + 1.0-SNAPSHOT + + minvoker251-a + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/module-b/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/module-b/pom.xml new file mode 100644 index 000000000..5eb478b3a --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/module-b/pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + minvoker251-parent + 1.0-SNAPSHOT + + minvoker251-b + + + + org.apache.maven.plugins.invoker + minvoker251-a + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/plugin/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/plugin/pom.xml new file mode 100644 index 000000000..66a42f384 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/plugin/pom.xml @@ -0,0 +1,59 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + minvoker251-parent + 1.0-SNAPSHOT + + minvoker251-plugin + + + + + org.apache.maven.plugins + maven-invoker-plugin + + ${project.build.directory}/it + ${project.build.directory}/local-repo + + + + itests + + install + + + + + + + + + + org.apache.maven.plugins.invoker + minvoker251-b + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/pom.xml new file mode 100644 index 000000000..21881e33a --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/pom.xml @@ -0,0 +1,80 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + minvoker251-parent + 1.0-SNAPSHOT + pom + + https://issues.apache.org/jira/browse/MINVOKER-243 + + + UTF-8 + + + + + + org.apache.maven.plugins.invoker + minvoker251-a + ${project.version} + + + org.apache.maven.plugins.invoker + minvoker251-b + ${project.version} + + + org.apache.maven.plugins.invoker + minvoker251-plugin + ${project.version} + + + + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + + + ${https.protocols} + + + + + + + + + module-a + module-b + plugin + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/verify.groovy new file mode 100644 index 000000000..3f0631527 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/MINVOKER-243_install-reactor/verify.groovy @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def localRepo = new File(basedir,'plugin/target/local-repo') + +assert new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker251-a/1.0-SNAPSHOT/minvoker251-a-1.0-SNAPSHOT.pom').exists() +assert new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker251-a/1.0-SNAPSHOT/minvoker251-a-1.0-SNAPSHOT.jar').exists() +assert new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker251-b/1.0-SNAPSHOT/minvoker251-b-1.0-SNAPSHOT.pom').exists() +assert new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker251-b/1.0-SNAPSHOT/minvoker251-b-1.0-SNAPSHOT.jar').exists() +assert new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker251-parent/1.0-SNAPSHOT/minvoker251-parent-1.0-SNAPSHOT.pom').exists() +assert new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker251-plugin/1.0-SNAPSHOT/minvoker251-plugin-1.0-SNAPSHOT.pom').exists() +assert new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker251-plugin/1.0-SNAPSHOT/minvoker251-plugin-1.0-SNAPSHOT.jar').exists() + diff --git a/Java-base/maven-invoker-plugin/src/src/it/clone-clean/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/clone-clean/invoker.properties new file mode 100644 index 000000000..f45dd01ad --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/clone-clean/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# NOTE: Don't clean here to be able to detect test failures +invoker.goals = initialize diff --git a/Java-base/maven-invoker-plugin/src/src/it/clone-clean/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/clone-clean/pom.xml new file mode 100644 index 000000000..c28592443 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/clone-clean/pom.xml @@ -0,0 +1,65 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + clone-clean-invocation + 1.0-SNAPSHOT + pom + + Test to check for cleaning of cloned project directories before execution. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + ${project.build.directory}/it + true + + */pom.xml + + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/clone-clean/setup.bsh b/Java-base/maven-invoker-plugin/src/src/it/clone-clean/setup.bsh new file mode 100644 index 000000000..b0296e205 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/clone-clean/setup.bsh @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +try +{ + File itRoot = new File( basedir, "target/it/clone-clean" ); + itRoot.mkdirs(); + return new File(itRoot, "foobar.log").createNewFile(); +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/clone-clean/src/it/clone-clean/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/clone-clean/src/it/clone-clean/pom.xml new file mode 100644 index 000000000..267fcdbbf --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/clone-clean/src/it/clone-clean/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + clone-clean + 0.1-SNAPSHOT + jar + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/clone-clean/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/clone-clean/verify.bsh new file mode 100644 index 000000000..f2ece44f2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/clone-clean/verify.bsh @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +try +{ + File itRoot = new File( basedir, "target/it/clone-clean" ); + return !new File( itRoot, "foobar.log" ).exists(); +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/invoker.properties new file mode 100644 index 000000000..f45dd01ad --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# NOTE: Don't clean here to be able to detect test failures +invoker.goals = initialize diff --git a/Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/pom.xml new file mode 100644 index 000000000..d3f9f85ff --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/pom.xml @@ -0,0 +1,65 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + clone-maven-plugin-packaging + 1.0-SNAPSHOT + maven-plugin + + Test to check for cloned project of packaging maven-plugin. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + ${project.build.directory}/it + true + + */pom.xml + + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/src/it/clone-clean/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/src/it/clone-clean/pom.xml new file mode 100644 index 000000000..267fcdbbf --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/src/it/clone-clean/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + clone-clean + 0.1-SNAPSHOT + jar + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/verify.bsh new file mode 100644 index 000000000..2ee728044 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/clone-maven-plugin-packaging/verify.bsh @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +try +{ + File itRoot = new File( basedir, "target/it/clone-clean" ); + return itRoot.exists(); +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/invoker.properties new file mode 100644 index 000000000..43618d417 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = verify +invoker.buildResult = failure diff --git a/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/pom.xml new file mode 100644 index 000000000..3bcb75c71 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/pom.xml @@ -0,0 +1,65 @@ + + + + + + 4.0.0 + org.apache.maven.plugins.invoker + exec-timeout-invoker-level + 1.0-SNAPSHOT + maven-plugin + + + + org.apache.maven + maven-plugin-api + 2.0 + + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + true + ${project.build.directory}/it + ${project.build.directory}/local-repo + + + ${https.protocols} + + + + + itests + + install + run + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/src/it/basic/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/src/it/basic/invoker.properties new file mode 100644 index 000000000..c049149c2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/src/it/basic/invoker.properties @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +invoker.timeoutInSeconds = 2 diff --git a/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/src/it/basic/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/src/it/basic/pom.xml new file mode 100644 index 000000000..eba22ebbe --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/src/it/basic/pom.xml @@ -0,0 +1,53 @@ + + + + + + 4.0.0 + foo.it + basic + 1.0-SNAPSHOT + pom + + + + + org.apache.maven.plugins.invoker + exec-timeout-invoker-level + 1.0-SNAPSHOT + + + + ${https.protocols} + + + + + touch + + touch + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java new file mode 100644 index 000000000..94971f0c5 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java @@ -0,0 +1,89 @@ +package org.apache.maven.it.plugins.dummy; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +/** + * @goal touch + * @phase process-sources + */ +public class MyMojo + extends AbstractMojo +{ + /** + * Location of the file. + * @parameter expression="${project.build.directory}" + * @required + */ + private File outputDirectory; + + public void execute() + throws MojoExecutionException + { + + try + { + Thread.sleep(5000); + } + catch ( java.lang.Exception exception ) + { + exception.printStackTrace(); + throw new MojoExecutionException(exception.getMessage(), exception); + } + + File f = outputDirectory; + + if ( !f.exists() ) + { + f.mkdirs(); + } + + File touch = new File( f, "touch.txt" ); + + FileWriter w = null; + try + { + w = new FileWriter( touch ); + + w.write( "touch.txt" ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error creating file " + touch, e ); + } + finally + { + if ( w != null ) + { + try + { + w.close(); + } + catch ( IOException e ) + { + // ignore + } + } + } + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/verify.groovy new file mode 100644 index 000000000..10a8d90d9 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-invoker-level/verify.groovy @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +def buildLog = new File( basedir, 'target/it/basic/build.log' ) + +assert !buildLog.text.contains('Total time: ') +assert !buildLog.text.contains('Finished at: ') \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/invoker.properties new file mode 100644 index 000000000..43618d417 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = verify +invoker.buildResult = failure diff --git a/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/pom.xml new file mode 100644 index 000000000..3f02a9a73 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/pom.xml @@ -0,0 +1,66 @@ + + + + + + 4.0.0 + org.apache.maven.plugins.invoker + exec-timeout-invoker-level + 1.0-SNAPSHOT + maven-plugin + + + + org.apache.maven + maven-plugin-api + 2.0 + + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + true + 2 + ${project.build.directory}/it + ${project.build.directory}/local-repo + + + ${https.protocols} + + + + + itests + + install + run + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/src/it/basic/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/src/it/basic/pom.xml new file mode 100644 index 000000000..eba22ebbe --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/src/it/basic/pom.xml @@ -0,0 +1,53 @@ + + + + + + 4.0.0 + foo.it + basic + 1.0-SNAPSHOT + pom + + + + + org.apache.maven.plugins.invoker + exec-timeout-invoker-level + 1.0-SNAPSHOT + + + + ${https.protocols} + + + + + touch + + touch + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java new file mode 100644 index 000000000..94971f0c5 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java @@ -0,0 +1,89 @@ +package org.apache.maven.it.plugins.dummy; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +/** + * @goal touch + * @phase process-sources + */ +public class MyMojo + extends AbstractMojo +{ + /** + * Location of the file. + * @parameter expression="${project.build.directory}" + * @required + */ + private File outputDirectory; + + public void execute() + throws MojoExecutionException + { + + try + { + Thread.sleep(5000); + } + catch ( java.lang.Exception exception ) + { + exception.printStackTrace(); + throw new MojoExecutionException(exception.getMessage(), exception); + } + + File f = outputDirectory; + + if ( !f.exists() ) + { + f.mkdirs(); + } + + File touch = new File( f, "touch.txt" ); + + FileWriter w = null; + try + { + w = new FileWriter( touch ); + + w.write( "touch.txt" ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error creating file " + touch, e ); + } + finally + { + if ( w != null ) + { + try + { + w.close(); + } + catch ( IOException e ) + { + // ignore + } + } + } + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/verify.groovy new file mode 100644 index 000000000..10a8d90d9 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/exec-timeout-mojo-level/verify.groovy @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +def buildLog = new File( basedir, 'target/it/basic/build.log' ) + +assert !buildLog.text.contains('Total time: ') +assert !buildLog.text.contains('Finished at: ') \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/invoker.properties new file mode 100644 index 000000000..e64d99e02 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.buildResult = failure diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/pom.xml new file mode 100644 index 000000000..49ec32d74 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/pom.xml @@ -0,0 +1,64 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + fail-build-streamLogsOnFailures + 1.0-SNAPSHOT + pom + + Test to check that a failure in the forked Maven build fails the parent build with streamed logs. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + false + ${project.build.directory}/it + + */pom.xml + + true + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/src/it/project/pom.xml new file mode 100644 index 000000000..cf9bbe951 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/src/it/project/pom.xml @@ -0,0 +1,35 @@ + + + + + + + 99.0.0 + test + fail-build + 0.1-SNAPSHOT + jar + + + UTF-8 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/verify.groovy new file mode 100644 index 000000000..06e686d54 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build-streamLogsOnFailures/verify.groovy @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def FS = File.separator +def buildLogOfProject = new File( basedir, 'target/it/project/build.log' ).text + +def buildLog = new File( basedir, 'build.log' ).text + +assert buildLog.contains( '*** begin build.log for: project' + FS + 'pom.xml ***' ) +assert buildLog.contains( buildLogOfProject ) +assert buildLog.contains( '*** end build.log for: project' + FS + 'pom.xml ***' ) + +assert buildLog.contains( 'ERROR] Failed to execute goal org.apache.maven.plugins:maven-invoker-plugin:' + projectVersion + ':run' ) diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/invoker.properties new file mode 100644 index 000000000..e64d99e02 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.buildResult = failure diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/pom.xml new file mode 100644 index 000000000..e366ff196 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/pom.xml @@ -0,0 +1,65 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + fail-build-with-verify-streamLogsOnFailures + 1.0-SNAPSHOT + pom + + Test to check that a failure in the forked Maven build fails the parent build with streamed logs. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + true + false + ${project.build.directory}/it + + */pom.xml + + true + + + + integration-test + initialize + + integration-test + verify + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/src/it/project/pom.xml new file mode 100644 index 000000000..cf9bbe951 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/src/it/project/pom.xml @@ -0,0 +1,35 @@ + + + + + + + 99.0.0 + test + fail-build + 0.1-SNAPSHOT + jar + + + UTF-8 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/verify.groovy new file mode 100644 index 000000000..7d5bdd154 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify-streamLogsOnFailures/verify.groovy @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def FS = File.separator +def buildLogOfProject = new File( basedir, 'target/it/project/build.log' ).text + +def buildLog = new File( basedir, 'build.log' ).text + +assert buildLog.contains( '*** begin build.log for: project' + FS + 'pom.xml ***' ) +assert buildLog.contains( buildLogOfProject ) +assert buildLog.contains( '*** end build.log for: project' + FS + 'pom.xml ***' ) + +assert buildLog.contains( 'maven-invoker-plugin:' + projectVersion + ':integration-test' ) +assert buildLog.contains( '[ERROR] Failed to execute goal org.apache.maven.plugins:maven-invoker-plugin:' + projectVersion + ':verify' ) + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/invoker.properties new file mode 100644 index 000000000..e64d99e02 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.buildResult = failure diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/pom.xml new file mode 100644 index 000000000..00ad86316 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/pom.xml @@ -0,0 +1,66 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + fail-build + 1.0-SNAPSHOT + pom + + Test to check that a failure in the forked Maven build fails the parent build, too. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + ${project.build.directory}/it + + */pom.xml + + + validate + + + + + integration-test + initialize + + integration-test + verify + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/src/it/project/pom.xml new file mode 100644 index 000000000..cf9bbe951 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/src/it/project/pom.xml @@ -0,0 +1,35 @@ + + + + + + + 99.0.0 + test + fail-build + 0.1-SNAPSHOT + jar + + + UTF-8 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/src/it/project/prebuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/src/it/project/prebuild.bsh new file mode 100644 index 000000000..3a93d1131 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/src/it/project/prebuild.bsh @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// marker for parent build that this sub build was indeed run +File touchFile = new File( basedir, "touch.txt" ); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/verify.bsh new file mode 100644 index 000000000..b7d9d2e27 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build-with-verify/verify.bsh @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else + File touchFile = new File( basedir, "target/it/project/touch.txt" ); + System.out.println( "Checking for existence of touch file: " + touchFile ); + if ( !touchFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/fail-build/invoker.properties new file mode 100644 index 000000000..e64d99e02 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.buildResult = failure diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-build/pom.xml new file mode 100644 index 000000000..10ec51d55 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build/pom.xml @@ -0,0 +1,66 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + fail-build + 1.0-SNAPSHOT + pom + + Test to check that a failure in the forked Maven build fails the parent build, too. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + true + ${project.build.directory}/it + + */pom.xml + + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-build/src/it/project/pom.xml new file mode 100644 index 000000000..cf9bbe951 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build/src/it/project/pom.xml @@ -0,0 +1,35 @@ + + + + + + + 99.0.0 + test + fail-build + 0.1-SNAPSHOT + jar + + + UTF-8 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build/src/it/project/prebuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/fail-build/src/it/project/prebuild.bsh new file mode 100644 index 000000000..3a93d1131 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build/src/it/project/prebuild.bsh @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// marker for parent build that this sub build was indeed run +File touchFile = new File( basedir, "touch.txt" ); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-build/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/fail-build/verify.bsh new file mode 100644 index 000000000..b7d9d2e27 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-build/verify.bsh @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else + File touchFile = new File( basedir, "target/it/project/touch.txt" ); + System.out.println( "Checking for existence of touch file: " + touchFile ); + if ( !touchFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-ignore-with-verify/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-ignore-with-verify/pom.xml new file mode 100644 index 000000000..c0e4c8d85 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-ignore-with-verify/pom.xml @@ -0,0 +1,67 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + fail-ignore + 1.0-SNAPSHOT + pom + + Test to check that a failure in the forked Maven builds is ignored. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + ${project.build.directory}/it + + */pom.xml + + + invalid-phase-to-fail-build + + true + + + + integration-test + initialize + + integration-test + verify + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-ignore-with-verify/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-ignore-with-verify/src/it/project/pom.xml new file mode 100644 index 000000000..b80df7601 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-ignore-with-verify/src/it/project/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + fail-ignore + 0.1-SNAPSHOT + jar + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-ignore/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-ignore/pom.xml new file mode 100644 index 000000000..c34ec5dac --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-ignore/pom.xml @@ -0,0 +1,66 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + fail-ignore + 1.0-SNAPSHOT + pom + + Test to check that a failure in the forked Maven builds is ignored. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + ${project.build.directory}/it + + */pom.xml + + + invalid-phase-to-fail-build + + true + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-ignore/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-ignore/src/it/project/pom.xml new file mode 100644 index 000000000..b80df7601 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-ignore/src/it/project/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + fail-ignore + 0.1-SNAPSHOT + jar + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_integration-test/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_integration-test/pom.xml new file mode 100644 index 000000000..5e4d9d99a --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_integration-test/pom.xml @@ -0,0 +1,61 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + fail-noprojects_integration-test + 1.0-SNAPSHOT + + Test to check that the build succeeds during integration-test even if there are no projects + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + ${project.build.directory}/it + + validate + + + + + integration-test + initialize + + integration-test + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_run/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_run/invoker.properties new file mode 100644 index 000000000..e64d99e02 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_run/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.buildResult = failure diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_run/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_run/pom.xml new file mode 100644 index 000000000..d4afd796a --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_run/pom.xml @@ -0,0 +1,61 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + fail-noprojects_run + 1.0-SNAPSHOT + + Test to check that the build fails if there are no projects + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + ${project.build.directory}/it + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_verify/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_verify/invoker.properties new file mode 100644 index 000000000..e64d99e02 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_verify/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.buildResult = failure diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_verify/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_verify/pom.xml new file mode 100644 index 000000000..b538f28b6 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-noprojects_verify/pom.xml @@ -0,0 +1,62 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + fail-noprojects_verify + 1.0-SNAPSHOT + + Test to check that the build fails if there are no projects + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + ${project.build.directory}/it + + validate + + + + + integration-test + initialize + + integration-test + verify + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/invoker.properties new file mode 100644 index 000000000..e64d99e02 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.buildResult = failure diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/pom.xml new file mode 100644 index 000000000..4f6722fca --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/pom.xml @@ -0,0 +1,65 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + fail-postbuild + 1.0-SNAPSHOT + pom + + Test to check that a failure of the post-build hook fails the parent build, too. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + ${project.build.directory}/it + + */pom.xml + + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/src/it/project/pom.xml new file mode 100644 index 000000000..8c5bb2c00 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/src/it/project/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + fail-prebuild + 0.1-SNAPSHOT + jar + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/src/it/project/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/src/it/project/postbuild.bsh new file mode 100644 index 000000000..9669e4bfe --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/src/it/project/postbuild.bsh @@ -0,0 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +return false; diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/src/it/project/prebuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/src/it/project/prebuild.bsh new file mode 100644 index 000000000..3a93d1131 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/src/it/project/prebuild.bsh @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// marker for parent build that this sub build was indeed run +File touchFile = new File( basedir, "touch.txt" ); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/verify.bsh new file mode 100644 index 000000000..b7d9d2e27 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-postbuild/verify.bsh @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else + File touchFile = new File( basedir, "target/it/project/touch.txt" ); + System.out.println( "Checking for existence of touch file: " + touchFile ); + if ( !touchFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/invoker.properties new file mode 100644 index 000000000..e64d99e02 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.buildResult = failure diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/pom.xml new file mode 100644 index 000000000..29e464b08 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/pom.xml @@ -0,0 +1,65 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + fail-prebuild + 1.0-SNAPSHOT + pom + + Test to check that a failure of the pre-build hook fails the parent build, too. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + ${project.build.directory}/it + + */pom.xml + + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/src/it/project/pom.xml new file mode 100644 index 000000000..8c5bb2c00 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/src/it/project/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + fail-prebuild + 0.1-SNAPSHOT + jar + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/src/it/project/prebuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/src/it/project/prebuild.bsh new file mode 100644 index 000000000..9c1a83bbe --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/src/it/project/prebuild.bsh @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// marker for parent build that this sub build was indeed run +File touchFile = new File( basedir, "touch.txt" ); +touchFile.createNewFile(); + +return false; diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/verify.bsh new file mode 100644 index 000000000..b7d9d2e27 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-prebuild/verify.bsh @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else + File touchFile = new File( basedir, "target/it/project/touch.txt" ); + System.out.println( "Checking for existence of touch file: " + touchFile ); + if ( !touchFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/invoker.properties new file mode 100644 index 000000000..c19c7116f --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.buildResult = failure \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/pom.xml new file mode 100644 index 000000000..474fa363b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/pom.xml @@ -0,0 +1,65 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + fail-run-postbuild + 1.0-SNAPSHOT + pom + + Test to check in case of failure the post-build hook is running. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + ${project.build.directory}/it + + */pom.xml + + + package + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/src/it/project/pom.xml new file mode 100644 index 000000000..2dd41bdc8 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/src/it/project/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + fail-run-postbuild + 0.1-SNAPSHOT + jar + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/src/it/project/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/src/it/project/postbuild.bsh new file mode 100644 index 000000000..3a93d1131 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/src/it/project/postbuild.bsh @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// marker for parent build that this sub build was indeed run +File touchFile = new File( basedir, "touch.txt" ); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/src/it/project/src/main/java/Foo.java b/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/src/it/project/src/main/java/Foo.java new file mode 100644 index 000000000..ae2e8a126 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/src/it/project/src/main/java/Foo.java @@ -0,0 +1,24 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + + +Foo beer Maven rocks \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/verify.bsh new file mode 100644 index 000000000..b7d9d2e27 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/fail-run-postbuild/verify.bsh @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else + File touchFile = new File( basedir, "target/it/project/touch.txt" ); + System.out.println( "Checking for existence of touch file: " + touchFile ); + if ( !touchFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/pom.xml new file mode 100644 index 000000000..2d72f148e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/pom.xml @@ -0,0 +1,70 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + pom-filtering + 1.0-SNAPSHOT + pom + + PASSED + Test to check for proper filtering of IT POMs + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + true + ${project.build.directory}/it + + */pom.xml + + + process-resources + + + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/src/it/project/.mvn/extensions.xml b/Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/src/it/project/.mvn/extensions.xml new file mode 100644 index 000000000..582c50816 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/src/it/project/.mvn/extensions.xml @@ -0,0 +1,27 @@ + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/src/it/project/pom.xml new file mode 100644 index 000000000..88e03dbf1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/src/it/project/pom.xml @@ -0,0 +1,71 @@ + + + + + + 4.0.0 + test + pom-filtering + 0.1-SNAPSHOT + jar + + + UTF-8 + + ${project.version} + + @project.version@ + @propertyFromPluginConfig@ + @propertyFromPropertiesSection@ + + @project-is-not-the-pom.version@ + + @project.name@ + @pom.name@ + + @itProperty@ + + @project.nonExistingPomValue@ + + @basedir@ + @baseurl@ + @localRepository@ + @localRepositoryUrl@ + + + + + + + ${basedir} + false + + *.xml + + + + + + maven-resources-plugin + 2.2 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/src/it/settings.xml new file mode 100644 index 000000000..79c5dc163 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/src/it/settings.xml @@ -0,0 +1,55 @@ + + + + + + + + it-repo + + true + + + + local.central + file://@localRepository@ + + true + + + true + + + + + + local.central + file://@localRepository@ + + true + + + true + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/verify.bsh new file mode 100644 index 000000000..da0c8a483 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/filtering-extensions/verify.bsh @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +import org.codehaus.plexus.util.*; + +try +{ + File extensionsFile = new File( basedir, "target/it/project/.mvn/extensions.xml" ); + System.out.println( "Checking for existence of filtered extensions.xml" ); + if ( !extensionsFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } + + String xml = FileUtils.fileRead( extensionsFile, "UTF-8" ); + + + String[] values = { + "org.apache.maven.plugins.invoker", + "pom-filtering", + "1.0-SNAPSHOT", + }; + for ( String value : values ) + { + System.out.println( "Checking for occurrence of: " + value ); + if ( xml.indexOf( value ) < 0 ) + { + System.out.println( "FAILED!" ); + return false; + } + } + + String[] badValues = { + "@project.groupId@", + "@project.artifactId@", + "@project.version@", + }; + for ( String value : badValues ) + { + System.out.println( "Checking for absence of: " + value ); + if ( xml.indexOf( value ) >= 0 ) + { + System.out.println( "FAILED!" ); + return false; + } + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/install-extra-artifacts/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/install-extra-artifacts/pom.xml new file mode 100644 index 000000000..55da1fa94 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/install-extra-artifacts/pom.xml @@ -0,0 +1,70 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + stage-extras + 1.0-SNAPSHOT + pom + + + Test to check for staging of external dependencies directly from local repository (MINVOKER-102). + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + ${project.build.directory}/it-repo + + + junit:junit:3.8.2 + + org.apache.maven.plugins:maven-clean-plugin:2.4:maven-plugin + + org.apache.maven.plugins:maven-clean-plugin:2.4:jar:javadoc + + jdom:jdom:1.1 + + + + + integration-test + initialize + + install + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/install-extra-artifacts/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/install-extra-artifacts/verify.bsh new file mode 100644 index 000000000..ba95e3639 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/install-extra-artifacts/verify.bsh @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + File itRepoDir = new File( basedir, "target/it-repo" ); + if ( !itRepoDir.isDirectory() ) + { + System.out.println( "IT local repository missing: " + itRepoDir ); + return false; + } + + String[] files = + { + "org/apache/maven/plugins/maven-clean-plugin/2.4/maven-clean-plugin-2.4.jar", + "org/apache/maven/plugins/maven-clean-plugin/2.4/maven-clean-plugin-2.4.pom", + "org/apache/maven/plugins/maven-clean-plugin/2.4/maven-clean-plugin-2.4-javadoc.jar", + "org/apache/maven/plugins/maven-plugins/16/maven-plugins-16.pom", + "org/apache/maven/maven-parent/15/maven-parent-15.pom", + "org/apache/apache/6/apache-6.pom", + "org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar", + "org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.pom", + "junit/junit/3.8.2/junit-3.8.2.jar", + "junit/junit/3.8.2/junit-3.8.2.pom", + "jdom/jdom/1.1/jdom-1.1.pom", + "org/jdom/jdom/1.1/jdom-1.1.pom", + "org/jdom/jdom/1.1/jdom-1.1.jar", + }; + for ( String file : files ) + { + File stagedFile = new File( itRepoDir, file ); + System.out.println( "Checking for existence of: " + stagedFile ); + if ( !stagedFile.isFile() ) + { + throw new IllegalStateException( "Missing: " + stagedFile ); + } + if ( file.endsWith( "jdom-1.1.jar" ) && stagedFile.length() < 1024 * 10 ) + { + throw new IllegalStateException( "Corrupt: " + stagedFile ); + } + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/pom.xml new file mode 100644 index 000000000..3d0a2a79f --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/pom.xml @@ -0,0 +1,65 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + integration-test-never-fails + 1.0-SNAPSHOT + pom + + Test to check that a failure in the forked Maven build does not fail the parent build. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + ${project.build.directory}/it + + */pom.xml + + + validate + + + + + integration-test + initialize + + integration-test + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/src/it/project/pom.xml new file mode 100644 index 000000000..125071873 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/src/it/project/pom.xml @@ -0,0 +1,33 @@ + + + + + + + 99.0.0 + test + fail-build + 0.1-SNAPSHOT + jar + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/src/it/project/prebuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/src/it/project/prebuild.bsh new file mode 100644 index 000000000..3a93d1131 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/src/it/project/prebuild.bsh @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// marker for parent build that this sub build was indeed run +File touchFile = new File( basedir, "touch.txt" ); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/verify.bsh new file mode 100644 index 000000000..b7d9d2e27 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/integration-test-never-fails/verify.bsh @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else + File touchFile = new File( basedir, "target/it/project/touch.txt" ); + System.out.println( "Checking for existence of touch file: " + touchFile ); + if ( !touchFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-cmdline-exclude/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-cmdline-exclude/pom.xml new file mode 100644 index 000000000..3a37ad2d0 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-cmdline-exclude/pom.xml @@ -0,0 +1,61 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker.its + invocation-cmdline-exclude + 1.0-SNAPSHOT + pom + + Test if the exclude can be used from commandline + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + true + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-cmdline-exclude/src/it/minvoker-140/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-cmdline-exclude/src/it/minvoker-140/pom.xml new file mode 100644 index 000000000..b01fa824b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-cmdline-exclude/src/it/minvoker-140/pom.xml @@ -0,0 +1,54 @@ + + + + + + 4.0.0 + org.apache.maven.plugins.invoker.its + minvoker-138 + 0.1-SNAPSHOT + pom + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.1.1 + + + + enforce + + + + + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-cmdline-exclude/test.properties b/Java-base/maven-invoker-plugin/src/src/it/invocation-cmdline-exclude/test.properties new file mode 100644 index 000000000..c27a0677d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-cmdline-exclude/test.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.test = !minvoker-140 diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-debug/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-debug/pom.xml new file mode 100644 index 000000000..4e89b8e11 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-debug/pom.xml @@ -0,0 +1,68 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker.its + invocation-debug + 1.0-SNAPSHOT + pom + + + Test to check for usage of debug mode. + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + + validate + + false + verify + + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-debug/src/it/minvoker-142/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invocation-debug/src/it/minvoker-142/invoker.properties new file mode 100644 index 000000000..3d383e9dd --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-debug/src/it/minvoker-142/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.debug = true diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-debug/src/it/minvoker-142/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-debug/src/it/minvoker-142/pom.xml new file mode 100644 index 000000000..87c71423e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-debug/src/it/minvoker-142/pom.xml @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + org.apache.maven.plugins.invoker.its + minvoker-142 + 0.1-SNAPSHOT + pom + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.1.1 + + + + enforce + + + + + ${https.protocols} + + + + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-debug/src/it/minvoker-142/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/invocation-debug/src/it/minvoker-142/verify.groovy new file mode 100644 index 000000000..417a89ef5 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-debug/src/it/minvoker-142/verify.groovy @@ -0,0 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.text.contains( '[DEBUG] Executing rule: org.apache.maven.plugins.enforcer.AlwaysPass' ) \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-emptyproperty/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-emptyproperty/pom.xml new file mode 100644 index 000000000..690cacaf9 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-emptyproperty/pom.xml @@ -0,0 +1,68 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker.its + invocation-emptyporperty + 1.0-SNAPSHOT + pom + + Test if the invocation succeeds even if there are empty/unresolved properties + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + true + + validate + + + value + ${example.property} + + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-emptyproperty/src/it/minvoker-118/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-emptyproperty/src/it/minvoker-118/pom.xml new file mode 100644 index 000000000..cd7234b5a --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-emptyproperty/src/it/minvoker-118/pom.xml @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + org.apache.maven.plugins.invoker.its + minvoker-118 + 0.1-SNAPSHOT + pom + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.1.1 + + + + enforce + + + + + ${https.protocols} + + + + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/pom.xml new file mode 100644 index 000000000..222982638 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/pom.xml @@ -0,0 +1,67 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker.its + invocation-environmentvariable + 1.0-SNAPSHOT + pom + + Test if the environmentvariable is applied + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + true + verify + + validate + + + foobar + minvoker255_pom + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-145/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-145/pom.xml new file mode 100644 index 000000000..1f506efaf --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-145/pom.xml @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + org.apache.maven.plugins.invoker.its + minvoker-145 + 0.1-SNAPSHOT + pom + + + UTF-8 + + + + + envTest + + + env.MINVOKER145 + !foobar + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.1.1 + + + + enforce + + + + + + + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-145/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-145/verify.groovy new file mode 100644 index 000000000..7cea0c180 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-145/verify.groovy @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +def buildLog = new File( basedir, 'build.log' ) + +// on this level we try find some substring, +// if not found it will be logged and cause parent verify script to find required text +assert buildLog.text.contains('] BUILD SUCCESS') + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-255/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-255/invoker.properties new file mode 100644 index 000000000..2be833f12 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-255/invoker.properties @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.name = Test Environment variable + +# override value from plugin config +invoker.environmentVariables.MINVOKER145 = minvoker_145 + +# add next value +invoker.environmentVariables.MINVOKER255_PROPERTIES = minvoker255_properties diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-255/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-255/pom.xml new file mode 100644 index 000000000..b67cef9e2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-255/pom.xml @@ -0,0 +1,61 @@ + + + + + + 4.0.0 + org.apache.maven.plugins.invoker.its + minvoker-145 + 0.1-SNAPSHOT + pom + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M3 + + + + enforce + + + + + + + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-255/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-255/verify.groovy new file mode 100644 index 000000000..7cea0c180 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/src/it/minvoker-255/verify.groovy @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +def buildLog = new File( basedir, 'build.log' ) + +// on this level we try find some substring, +// if not found it will be logged and cause parent verify script to find required text +assert buildLog.text.contains('] BUILD SUCCESS') + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/verify.groovy new file mode 100644 index 000000000..0ef60fd43 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-environmentvariable/verify.groovy @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +def buildLog = new File( basedir, 'build.log' ) +assert buildLog.text.contains('[INFO] BUILD SUCCESS') + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/pom.xml new file mode 100644 index 000000000..86b60d1eb --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/pom.xml @@ -0,0 +1,69 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + invocation-project + 1.0-SNAPSHOT + pom + + + Test to check that invocations can use a different POM than the one that was selected via the pomInclude + parameter. This allows fine-grained control over the build of a multi-module project where the modules are + (intentionally) not collectively build by the reactor. + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + ${project.build.directory}/it + src/it/projects + + */*/pom.xml + + + compile + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/invoker.properties new file mode 100644 index 000000000..c19c7116f --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.buildResult = failure \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/sub-1/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/sub-1/invoker.properties new file mode 100644 index 000000000..fe3dca200 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/sub-1/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = validate +invoker.buildResult = success \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/sub-1/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/sub-1/pom.xml new file mode 100644 index 000000000..a509339e6 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/sub-1/pom.xml @@ -0,0 +1,52 @@ + + + + + + 4.0.0 + + test + sub-1 + 0.1-SNAPSHOT + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M2 + + + enforce + initialize + + enforce + + + + + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/sub-2/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/sub-2/pom.xml new file mode 100644 index 000000000..faebe940f --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-1/sub-2/pom.xml @@ -0,0 +1,52 @@ + + + + + + 4.0.0 + + test + sub-2 + 0.1-SNAPSHOT + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M2 + + + enforce + initialize + + enforce + + + + + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-2/sub-1/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-2/sub-1/invoker.properties new file mode 100644 index 000000000..c19c7116f --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-2/sub-1/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.buildResult = failure \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-2/sub-1/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-2/sub-1/pom.xml new file mode 100644 index 000000000..a509339e6 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-2/sub-1/pom.xml @@ -0,0 +1,52 @@ + + + + + + 4.0.0 + + test + sub-1 + 0.1-SNAPSHOT + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M2 + + + enforce + initialize + + enforce + + + + + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-2/sub-2/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-2/sub-2/pom.xml new file mode 100644 index 000000000..0424a64ec --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/group-2/sub-2/pom.xml @@ -0,0 +1,52 @@ + + + + + + 4.0.0 + + test + sub-2 + 0.1-SNAPSHOT + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M2 + + + enforce + compile + + enforce + + + + + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/invoker.properties new file mode 100644 index 000000000..d16306984 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/src/it/projects/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = initialize \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/verify.groovy new file mode 100644 index 000000000..7ba59ce6e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-group-properties/verify.groovy @@ -0,0 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +return true \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/pom.xml new file mode 100644 index 000000000..67d1caa29 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/pom.xml @@ -0,0 +1,75 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + invocation-multiple + 1.0-SNAPSHOT + pom + + Test to check for proper support of multiple Maven invocations per project. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + ${project.build.directory}/it + + */pom.xml + + src/it/settings.xml + + validate + + + ${invoker.repo.local} + + + ${maven.compiler.source} + ${maven.compiler.target} + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/invoker.properties new file mode 100644 index 000000000..89ca0884c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/invoker.properties @@ -0,0 +1,43 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +####################################### +# Default build +####################################### +invoker.goals = install +invoker.profiles = plugin,profile0 +invoker.systemPropertiesFile = system1.properties + +####################################### +# First build +####################################### +# goals should fall back to invoker.goals +invoker.profiles.1 = + +####################################### +# Second build +####################################### +invoker.goals.2 = test:test-maven-plugin:0.1-SNAPSHOT:test +invoker.profiles.2 = plugin,profile1 +# system properties file should fall back to invoker.systemPropertiesFile + +####################################### +# Third build +####################################### +invoker.goals.3 = test:test-maven-plugin:0.1-SNAPSHOT:test +# profiles should fall back to invoker.profiles +invoker.systemPropertiesFile.3 = system2.properties diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/pom.xml new file mode 100644 index 000000000..c313c74c5 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/pom.xml @@ -0,0 +1,107 @@ + + + + + + 4.0.0 + test + test-maven-plugin + 0.1-SNAPSHOT + maven-plugin + + + 2.0 + + + + UTF-8 + + + + + org.apache.maven + maven-plugin-api + 2.0 + + + + + + + maven-compiler-plugin + 2.0.2 + + ${maven.compiler.source} + ${maven.compiler.target} + + + + maven-install-plugin + 2.2 + + + maven-jar-plugin + 2.2 + + + maven-plugin-plugin + 2.4.2 + + + maven-resources-plugin + 2.2 + + + maven-surefire-plugin + 2.4.3 + + + + + + + plugin + + + + ${project.groupId} + ${project.artifactId} + ${project.version} + + ${project.build.directory}/${testProperty}.txt + + + + + + + profile0 + + test0 + + + + profile1 + + test1 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/src/main/java/org/TestMojo.java b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/src/main/java/org/TestMojo.java new file mode 100644 index 000000000..ef83c5ad9 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/src/main/java/org/TestMojo.java @@ -0,0 +1,69 @@ +package org; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; + +import org.apache.maven.plugin.*; + +/** + * @goal test + */ +public class TestMojo extends AbstractMojo { + + /** + * @parameter default-value="${project.build.directory}/test.txt" + */ + private File outputFile; + + /** + * @see org.apache.maven.plugin.AbstractMojo#execute() + */ + public void execute() throws MojoExecutionException, MojoFailureException { + outputFile.getParentFile().mkdirs(); + Writer writer = null; + try + { + writer = new OutputStreamWriter( new FileOutputStream( outputFile ), "UTF-8" ); + writer.write( System.getProperty( "maven.invoker.test", "null" ) ); + } + catch (IOException e) + { + throw new MojoExecutionException( "Failed", e ); + } + finally + { + if ( writer != null ) + { + try + { + writer.close(); + } + catch (IOException e) + { + // ignore + } + } + } + } + +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/system1.properties b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/system1.properties new file mode 100644 index 000000000..40defe0e2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/system1.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +maven.invoker.test = UTF-8 diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/system2.properties b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/system2.properties new file mode 100644 index 000000000..efffc37e1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/project/system2.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +maven.invoker.test = ISO-8859-1 diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/settings.xml new file mode 100644 index 000000000..febb63261 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/src/it/settings.xml @@ -0,0 +1,60 @@ + + + + + + + + it-repo + + true + + + + + local.central + file://@invoker.repo.local@ + + true + + + true + + + + + + local.central + file://@invoker.repo.local@ + + true + + + true + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/verify.bsh new file mode 100644 index 000000000..75237e92e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-multiple/verify.bsh @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +import org.codehaus.plexus.util.*; + +try +{ + File test0File = new File( basedir, "target/it/project/target/test0.txt" ); + System.out.println( "Checking for existence of first test file: " + test0File ); + if ( !test0File.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } + + String test0 = FileUtils.fileRead( test0File, "UTF-8" ).trim(); + System.out.println( "Checking contents of first test file: " + test0 ); + if ( !"ISO-8859-1".equals( test0 ) ) + { + System.out.println( "FAILED!" ); + return false; + } + + File test1File = new File( basedir, "target/it/project/target/test1.txt" ); + System.out.println( "Checking for existence of second test file: " + test1File ); + if ( !test1File.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } + + String test1 = FileUtils.fileRead( test1File, "UTF-8" ).trim(); + System.out.println( "Checking contents of second test file: " + test1 ); + if ( !"UTF-8".equals( test1 ) ) + { + System.out.println( "FAILED!" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-offline/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-offline/pom.xml new file mode 100644 index 000000000..bb9efaf55 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-offline/pom.xml @@ -0,0 +1,71 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + invocation-offline + 1.0-SNAPSHOT + pom + + + Test to check for usage of offline mode. + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + ${project.build.directory}/it-repo + + */pom.xml + + src/it/settings.xml + + validate + + + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-offline/src/it/project/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invocation-offline/src/it/project/invoker.properties new file mode 100644 index 000000000..5742a032d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-offline/src/it/project/invoker.properties @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# First run if offline mode which should fail to download the Clean Plugin +invoker.goals.1 = clean +invoker.offline.1 = true +invoker.buildResult.1 = failure + +# Now again in online mode +invoker.goals.2 = clean diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-offline/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-offline/src/it/project/pom.xml new file mode 100644 index 000000000..c639174a2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-offline/src/it/project/pom.xml @@ -0,0 +1,41 @@ + + + + + + 4.0.0 + test + invocation-offline + 0.1-SNAPSHOT + jar + + + UTF-8 + + + + + junit + junit + 3.8.2 + test + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-offline/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-offline/src/it/settings.xml new file mode 100644 index 000000000..febb63261 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-offline/src/it/settings.xml @@ -0,0 +1,60 @@ + + + + + + + + it-repo + + true + + + + + local.central + file://@invoker.repo.local@ + + true + + + true + + + + + + local.central + file://@invoker.repo.local@ + + true + + + true + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-offline/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/invocation-offline/verify.bsh new file mode 100644 index 000000000..00ac1d02a --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-offline/verify.bsh @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +// sanity check to make sure the builds were actually run +File repoDir = new File( basedir, "target/it-repo" ); +System.out.println( "Checking for existence of test repo: " + repoDir ); +if ( !repoDir.exists() ) +{ + throw new FileNotFoundException( "Missing repository directory: " + repoDir ); +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/pom.xml new file mode 100644 index 000000000..4d09be0c9 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/pom.xml @@ -0,0 +1,70 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + invocation-project + 1.0-SNAPSHOT + pom + + + Test to check that invocations can use a different POM than the one that was selected via the pomInclude + parameter. This allows fine-grained control over the build of a multi-module project where the modules are + (intentionally) not collectively build by the reactor. + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + ${project.build.directory}/it + + */pom.xml + + src/it/settings.xml + setup.bsh + + clean + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/invoker.properties new file mode 100644 index 000000000..c4e026583 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/invoker.properties @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# path to POM +invoker.project.1 = sub-1/pom.xml + +# path to base directory +invoker.project.2 = sub-3 diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/pom.xml new file mode 100644 index 000000000..27c514aaa --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/pom.xml @@ -0,0 +1,35 @@ + + + + + + 4.0.0 + + test + aggregator + 0.1-SNAPSHOT + pom + + + sub-1 + sub-2 + sub-3 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/setup.bsh b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/setup.bsh new file mode 100644 index 000000000..5e6d0f07e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/setup.bsh @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +String[] paths = +{ + "target", + "sub-1/target", + "sub-2/target", + "sub-3/target", +}; + +for ( String path : paths ) +{ + File dir = new File( basedir, path); + System.out.println( "Creating directory: " + dir ); + if ( !dir.mkdirs() ) + { + throw new IOException( "Failed to create directory: " + dir ); + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/sub-1/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/sub-1/pom.xml new file mode 100644 index 000000000..b56e1993f --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/sub-1/pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + test + sub-1 + 0.1-SNAPSHOT + jar + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/sub-2/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/sub-2/pom.xml new file mode 100644 index 000000000..0f31f97ae --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/sub-2/pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + test + sub-2 + 0.1-SNAPSHOT + jar + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/sub-3/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/sub-3/pom.xml new file mode 100644 index 000000000..8dff9474f --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/project/sub-3/pom.xml @@ -0,0 +1,29 @@ + + + + + + 4.0.0 + + test + sub-3 + 0.1-SNAPSHOT + jar + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/settings.xml new file mode 100644 index 000000000..febb63261 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/src/it/settings.xml @@ -0,0 +1,60 @@ + + + + + + + + it-repo + + true + + + + + local.central + file://@invoker.repo.local@ + + true + + + true + + + + + + local.central + file://@invoker.repo.local@ + + true + + + true + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-project/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/verify.bsh new file mode 100644 index 000000000..b080a6c2f --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-project/verify.bsh @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +String[] unexpectedPaths = +{ + "sub-1/target", + "sub-3/target", +}; + +for ( String path : unexpectedPaths ) +{ + File file = new File( new File( basedir, "target/it/project" ), path); + System.out.println( "Checking for absence of: " + file ); + if ( file.exists() ) + { + throw new IOException( "Unexpected path found: " + file ); + } +} + +String[] expectedPaths = +{ + "target", + "sub-2/target", +}; + +for ( String path : expectedPaths ) +{ + File file = new File( new File( basedir, "target/it/project" ), path); + System.out.println( "Checking for existence of: " + file ); + if ( !file.exists() ) + { + throw new IOException( "Expected path not found: " + file ); + } +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/invoker.properties new file mode 100644 index 000000000..353946b69 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = verify diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/itests/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/itests/pom.xml new file mode 100644 index 000000000..cf5858b45 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/itests/pom.xml @@ -0,0 +1,62 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + MINVOKER-115-parent + 1.0-SNAPSHOT + + MINVOKER-115-itests + pom + + + + org.apache.maven.plugins.invoker + MINVOKER-115-plugin + 1.0-SNAPSHOT + + + + + + + org.apache.maven.plugins + maven-invoker-plugin + + ${project.build.directory}/it + ${project.build.directory}/local-repo + + + + itests + + install + run + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/itests/src/it/basic/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/itests/src/it/basic/pom.xml new file mode 100644 index 000000000..e6c088688 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/itests/src/it/basic/pom.xml @@ -0,0 +1,47 @@ + + + + + + 4.0.0 + foo.it + basic + 1.0-SNAPSHOT + pom + + + + + org.apache.maven.plugins.invoker + MINVOKER-115-plugin + 1.0-SNAPSHOT + + + touch + + touch + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/plugin/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/plugin/pom.xml new file mode 100644 index 000000000..f443bffee --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/plugin/pom.xml @@ -0,0 +1,40 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + MINVOKER-115-parent + 1.0-SNAPSHOT + + MINVOKER-115-plugin + maven-plugin + + + + org.apache.maven + maven-plugin-api + 2.0 + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/plugin/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java b/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/plugin/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java new file mode 100644 index 000000000..c225e4b99 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/plugin/src/main/java/org/apache/maven/it/plugins/dummy/MyMojo.java @@ -0,0 +1,78 @@ +package org.apache.maven.it.plugins.dummy; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +/** + * @goal touch + * @phase process-sources + */ +public class MyMojo + extends AbstractMojo +{ + /** + * Location of the file. + * @parameter expression="${project.build.directory}" + * @required + */ + private File outputDirectory; + + public void execute() + throws MojoExecutionException + { + File f = outputDirectory; + + if ( !f.exists() ) + { + f.mkdirs(); + } + + File touch = new File( f, "touch.txt" ); + + FileWriter w = null; + try + { + w = new FileWriter( touch ); + + w.write( "touch.txt" ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error creating file " + touch, e ); + } + finally + { + if ( w != null ) + { + try + { + w.close(); + } + catch ( IOException e ) + { + // ignore + } + } + } + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/pom.xml new file mode 100644 index 000000000..6986e4d17 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-reactor-indirect/pom.xml @@ -0,0 +1,77 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + MINVOKER-115-parent + 1.0-SNAPSHOT + pom + + + Test of reported issue MINVOKER-115: install goal doesn't install plugins from the reactor + build to the local repo. + + + + UTF-8 + + + + plugin + itests + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.5.1 + + + org.apache.maven.plugins + maven-plugin-plugin + 2.9 + + + org.apache.maven.plugins + maven-resources-plugin + 2.6 + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + + + ${https.protocols} + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/pom.xml new file mode 100644 index 000000000..7bfede6b4 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + invocation-spaces + 1.0-SNAPSHOT + pom + + Test to check for proper handling of Maven invocations that involve spaces on the command line. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + src/it projects + ${project.build.directory}/it projects + + */*pom.xml + + ${project.build.directory}/it repo + src/it projects/settings.xml + + install + + + + ${https.protocols} + value with spaces from cli + + + ${invoker.repo.local} + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/src/it projects/project/spacy pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/src/it projects/project/spacy pom.xml new file mode 100644 index 000000000..530d19a83 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/src/it projects/project/spacy pom.xml @@ -0,0 +1,70 @@ + + + + + + 4.0.0 + test + spacy-pom + 0.1-SNAPSHOT + jar + + + UTF-8 + + + + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + + org.apache.maven.plugins + maven-install-plugin + 2.2 + + + maven-jar-plugin + 2.2 + + + org.apache.maven.plugins + maven-resources-plugin + 2.2 + + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.4.3 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/src/it projects/project/src/main/resources/test.txt b/Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/src/it projects/project/src/main/resources/test.txt new file mode 100644 index 000000000..755f558be --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/src/it projects/project/src/main/resources/test.txt @@ -0,0 +1,2 @@ +${propertyFromSettings} +${propertyFromCommandLine} diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/src/it projects/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/src/it projects/settings.xml new file mode 100644 index 000000000..2e77464fa --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/src/it projects/settings.xml @@ -0,0 +1,63 @@ + + + + + + + + it-repo + + true + + + value with spaces from settings + + + + + local.central + file://@invoker.repo.local@ + + true + + + true + + + + + + local.central + file://@invoker.repo.local@ + + true + + + true + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/verify.bsh new file mode 100644 index 000000000..118fa20b2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invocation-spaces/verify.bsh @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +import org.codehaus.plexus.util.*; + +try +{ + File testFile = new File( basedir, "target/it projects/project/target/classes/test.txt" ); + System.out.println( "Checking for existence of test file: " + testFile ); + if ( !testFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } + + String[] values = { + "value with spaces from settings", + "value with spaces from cli", + }; + + BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream( testFile ), "UTF-8" ) ); + try + { + for ( String value : values ) + { + String line = reader.readLine(); + System.out.println( "Checking for occurrence of: " + value ); + if ( !value.equals( line ) ) + { + System.out.println( "FAILED!" ); + return false; + } + } + } + finally + { + reader.close(); + } + + File installedFile = new File( basedir, "target/it repo/test/spacy-pom/0.1-SNAPSHOT/spacy-pom-0.1-SNAPSHOT.jar" ); + System.out.println( "Checking for existence of installed file: " + installedFile ); + if ( !installedFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/invoker.properties new file mode 100644 index 000000000..09f3c90bc --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = integration-test site diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/pom.xml new file mode 100644 index 000000000..dbc99085a --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/pom.xml @@ -0,0 +1,81 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + invoker-report + 1.0-SNAPSHOT + pom + + Test + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + + */pom.xml + + setup + verify + true + + validate + + + + + integration-test + initialize + + run + + + + + + org.apache.maven.plugins + maven-site-plugin + @sitePluginVersion@ + + + + + + true + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-build/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-build/pom.xml new file mode 100644 index 000000000..4f60e1aa1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-build/pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + + + + foo + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-post/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-post/invoker.properties new file mode 100644 index 000000000..ec7081832 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-post/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.description = A build job without name. diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-post/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-post/pom.xml new file mode 100644 index 000000000..ea5c00f33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-post/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-post/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-post/verify.bsh new file mode 100644 index 000000000..4720926b5 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-post/verify.bsh @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +throw new IllegalStateException( "The post-build script failed as expected." ); + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-pre/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-pre/invoker.properties new file mode 100644 index 000000000..62558a3a7 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-pre/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.name = No Description diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-pre/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-pre/pom.xml new file mode 100644 index 000000000..ea5c00f33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-pre/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-pre/setup.bsh b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-pre/setup.bsh new file mode 100644 index 000000000..363e42611 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/failure-pre/setup.bsh @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +throw new IllegalStateException( "The pre-build script failed as expected." ); + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-jre/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-jre/invoker.properties new file mode 100644 index 000000000..db44ad51d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-jre/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.description = A build job skipped due to JRE version. +invoker.java.version = 1.0 diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-jre/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-jre/pom.xml new file mode 100644 index 000000000..cd7ec5d49 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-jre/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-maven/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-maven/invoker.properties new file mode 100644 index 000000000..79b5deea9 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-maven/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.description = A build job skipped due to Maven version. +invoker.maven.version = 2.1.5 diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-maven/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-maven/pom.xml new file mode 100644 index 000000000..cd7ec5d49 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-maven/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-os/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-os/invoker.properties new file mode 100644 index 000000000..cc00c9bce --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-os/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.description = A build job skipped due to Operation System. +invoker.os.family = ties diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-os/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-os/pom.xml new file mode 100644 index 000000000..cd7ec5d49 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/skip-os/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/success/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/success/invoker.properties new file mode 100644 index 000000000..0a7e4f9ed --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/success/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.name = Success +invoker.description = A build job that should succeed. diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/success/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/success/pom.xml new file mode 100644 index 000000000..ea5c00f33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/src/it/success/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/invoker-report/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/verify.bsh new file mode 100644 index 000000000..745613ecb --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/invoker-report/verify.bsh @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; + +File reportFile = new File( basedir, "target/site/invoker-report.html"); + +System.out.println( "Checking for existence of report file: " + reportFile ); +if ( !reportFile.exists() ) +{ + System.out.println( "FAILED!" ); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-default/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/local-repo-default/pom.xml new file mode 100644 index 000000000..ce1c1cffa --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-default/pom.xml @@ -0,0 +1,72 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + local-repo-default + 1.0-SNAPSHOT + pom + + + Test to check for MINVOKER-47, i.e. local repo path given by IT settings.xml must be ignored even if + plugin configuration does not specify a custom location. + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + ${project.build.directory}/its + + */pom.xml + + src/it/settings.xml + + install + + + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-default/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/local-repo-default/src/it/project/pom.xml new file mode 100644 index 000000000..1a122979a --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-default/src/it/project/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + local-repo-default + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-default/src/it/project/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/local-repo-default/src/it/project/postbuild.bsh new file mode 100644 index 000000000..5be5e7b3b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-default/src/it/project/postbuild.bsh @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + // just dump our local repo path for verification by the parent build + File textFile = new File( basedir, "target/local-repo-path.txt" ); + textFile.getParentFile().mkdirs(); + Writer writer = new OutputStreamWriter( new FileOutputStream( textFile ), "UTF-8" ); + writer.write( localRepositoryPath.getAbsolutePath() ); + writer.close(); +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-default/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/local-repo-default/src/it/settings.xml new file mode 100644 index 000000000..a75e365fd --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-default/src/it/settings.xml @@ -0,0 +1,57 @@ + + + + + + + @project.build.directory@/bad-repo + + + it-repo + + true + + + + local.central + file://@localRepository@ + + true + + + true + + + + + + local.central + file://@localRepository@ + + true + + + true + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-default/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/local-repo-default/verify.bsh new file mode 100644 index 000000000..249c645b1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-default/verify.bsh @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + File badRepoDir = new File( basedir, "target/bad-repo" ); + if ( badRepoDir.exists() ) + { + System.out.println( "Sub build used wrong local repository (from its settings.xml): " + badRepoDir ); + return false; + } + + /* + * NOTE: This relies heavily on the Invoker Plugin's configuration of our parent build, not nice but until MINVOKER-49 + * is available here, we have no other way of getting the path. + */ + File localRepoPathOfThisBuild = new File( basedir.getParentFile().getParentFile(), "local-repo" ); + System.out.println("Local repository of this build: " + localRepoPathOfThisBuild); + + File textFile = new File( basedir, "target/its/project/target/local-repo-path.txt" ); + BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream( textFile ), "UTF-8" ) ); + File localRepoPathOfSubBuild = new File( reader.readLine() ); + reader.close(); + System.out.println("Local repository of sub build: " + localRepoPathOfSubBuild); + + /* + * This is partly a sanity check of the Maven core (i.e. its MavenSettingsBuilder) which should ensure + * ${settings.localRepository} == ${maven.repo.local} + * This IT is run with maven.repo.local but the Invoker Plugin passes settings.localRepository down to the sub build + * so these paths must match. + */ + if ( !localRepoPathOfThisBuild.getCanonicalPath().equals( localRepoPathOfSubBuild.getCanonicalPath() ) ) + { + System.out.println( "Sub build used wrong local repository: " + localRepoPathOfSubBuild ); + return false; + } + + File installedFile = new File( localRepoPathOfThisBuild, "test/local-repo-default/0.1-SNAPSHOT/local-repo-default-0.1-SNAPSHOT.pom" ); + if ( !installedFile.isFile() ) + { + System.out.println( "Installed file missing in local repo: " + installedFile ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/pom.xml new file mode 100644 index 000000000..06a16ef84 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/pom.xml @@ -0,0 +1,71 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + local-repo-isolated + 1.0-SNAPSHOT + pom + + + Test to check for usage of an isolated local repository. + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + ${project.build.directory}/it-repo + + */pom.xml + + src/it/settings.xml + + install + + + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/src/it/project/pom.xml new file mode 100644 index 000000000..52a7b5d25 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/src/it/project/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + local-repo-isolated + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/src/it/settings.xml new file mode 100644 index 000000000..a75e365fd --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/src/it/settings.xml @@ -0,0 +1,57 @@ + + + + + + + @project.build.directory@/bad-repo + + + it-repo + + true + + + + local.central + file://@localRepository@ + + true + + + true + + + + + + local.central + file://@localRepository@ + + true + + + true + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/verify.bsh new file mode 100644 index 000000000..1593cff79 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-isolated/verify.bsh @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + File badRepoDir = new File( basedir, "target/bad-repo" ); + if ( badRepoDir.exists() ) + { + System.out.println( "IT used wrong local repository: " + badRepoDir ); + return false; + } + + File itRepoDir = new File( basedir, "target/it-repo" ); + if ( !itRepoDir.isDirectory() ) + { + System.out.println( "IT local repository missing: " + itRepoDir ); + return false; + } + + File installedFile = new File( itRepoDir, "test/local-repo-isolated/0.1-SNAPSHOT/local-repo-isolated-0.1-SNAPSHOT.pom" ); + if ( !installedFile.isFile() ) + { + System.out.println( "Installed file missing in local repo: " + installedFile ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-path/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/local-repo-path/pom.xml new file mode 100644 index 000000000..85a773903 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-path/pom.xml @@ -0,0 +1,77 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + local-repo-path + 1.0-SNAPSHOT + jar + + + Test to check for proper filtering of "localRepository" token. + + + + UTF-8 + + + + + + + org.apache.maven.plugins + maven-clean-plugin + 2.2 + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + ${project.build.directory}/it-repo + + */pom.xml + + src/it/settings.xml + + org.apache.maven.plugins:maven-clean-plugin:2.2:clean + + + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-path/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/local-repo-path/src/it/project/pom.xml new file mode 100644 index 000000000..63be41e21 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-path/src/it/project/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + jar + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-path/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/local-repo-path/src/it/settings.xml new file mode 100644 index 000000000..0150ddca1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-path/src/it/settings.xml @@ -0,0 +1,31 @@ + + + + + + + + sandbox + A completely isolated repo to test the interpolation of "localRepository" + file://@localRepository@ + * + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-path/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/local-repo-path/verify.bsh new file mode 100644 index 000000000..00ac1d02a --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-path/verify.bsh @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +// sanity check to make sure the builds were actually run +File repoDir = new File( basedir, "target/it-repo" ); +System.out.println( "Checking for existence of test repo: " + repoDir ); +if ( !repoDir.exists() ) +{ + throw new FileNotFoundException( "Missing repository directory: " + repoDir ); +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-url/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/local-repo-url/pom.xml new file mode 100644 index 000000000..1e3914937 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-url/pom.xml @@ -0,0 +1,70 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + local-repo-url + 1.0-SNAPSHOT + jar + + + Test to check for proper filtering of "localRepositoryUrl" token. + + + + UTF-8 + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 2.2 + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + ${project.build.directory}/it-repo + src/it/settings.xml + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-url/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/local-repo-url/src/it/project/pom.xml new file mode 100644 index 000000000..63be41e21 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-url/src/it/project/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + jar + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-url/src/it/project/postbuild.groovy b/Java-base/maven-invoker-plugin/src/src/it/local-repo-url/src/it/project/postbuild.groovy new file mode 100644 index 000000000..6b8ec7420 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-url/src/it/project/postbuild.groovy @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ensure script context contains localRepositoryPath +assert new File( basedir, "../../../target/it-repo" ).canonicalFile.equals( localRepositoryPath ) + +File interpolatedSettings = new File( basedir, "../interpolated-settings.xml" ) +assert interpolatedSettings.isFile() + +def filename = new File( basedir, "../../../../../local-repo" ).canonicalPath +// Convert URL, see org.apache.maven.plugins.invoker.AbstractInvokerMojo.toUrl(String) +String url = "file://" + new File( filename ).toURI().path +if ( url.endsWith( "/" ) ) +{ + url = url.substring( 0, url.length() - 1 ) +} + +def settings = new XmlSlurper().parse( interpolatedSettings ) + +// ensure right settings and mirror are picked up +def sandboxMirror = settings.mirrors.mirror[0] +assert sandboxMirror.id.text() == "sandbox" +assert sandboxMirror.url.text() != "@localRepositoryUrl@" + +// sandboxMirror.url is NOT filled with localRepositoryPath, but with the localRepository of the parent Settings +assert sandboxMirror.url.text() == url diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-url/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/local-repo-url/src/it/settings.xml new file mode 100644 index 000000000..ca7b8ab93 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-url/src/it/settings.xml @@ -0,0 +1,31 @@ + + + + + + + + sandbox + A completely isolated repo to test the interpolation of "localRepositoryUrl" + @localRepositoryUrl@ + * + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/local-repo-url/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/local-repo-url/verify.groovy new file mode 100644 index 000000000..4e4f77455 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/local-repo-url/verify.groovy @@ -0,0 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.text.contains( '[INFO] run post-build script postbuild.groovy' ) \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/invoker.properties new file mode 100644 index 000000000..f45dd01ad --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# NOTE: Don't clean here to be able to detect test failures +invoker.goals = initialize diff --git a/Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/pom.xml new file mode 100644 index 000000000..4cf525c63 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/pom.xml @@ -0,0 +1,64 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + not-clone-not-a-plugin-invocation + 1.0-SNAPSHOT + pom + + Test to check for not cloning non maven plugin project. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + + + */pom.xml + + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/src/it/clone-clean/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/src/it/clone-clean/pom.xml new file mode 100644 index 000000000..267fcdbbf --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/src/it/clone-clean/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + clone-clean + 0.1-SNAPSHOT + jar + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/verify.bsh new file mode 100644 index 000000000..b219ae535 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/not-clone-not-plugin/verify.bsh @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +try +{ + File itRoot = new File( basedir, "target/it/clone-clean" ); + return !itRoot.exists(); +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/pom.xml new file mode 100644 index 000000000..72331d4ec --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/pom.xml @@ -0,0 +1,68 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + pom-filtering-encoding + 1.0-SNAPSHOT + pom + + Test to check for proper handling of file encoding during POM filtering. + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + ${project.build.directory}/it + + */pom.xml + + + process-resources + + + ©®ÄÖÜäöüß + + + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/src/it/latin-1/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/src/it/latin-1/pom.xml new file mode 100644 index 000000000..be84a791d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/src/it/latin-1/pom.xml @@ -0,0 +1,54 @@ + + + + + + 4.0.0 + test + pom-filtering-encoding-latin1 + 0.1-SNAPSHOT + jar + + + + UTF-8 + ©®ÄÖÜäöüß + @latin1Chars@ + + + + + + + ${basedir} + false + + *.xml + + + + + + maven-resources-plugin + 2.2 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/src/it/utf-8/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/src/it/utf-8/pom.xml new file mode 100644 index 000000000..de59fae00 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/src/it/utf-8/pom.xml @@ -0,0 +1,54 @@ + + + + + + 4.0.0 + test + pom-filtering-encoding-utf8 + 0.1-SNAPSHOT + jar + + + + UTF-8 + ©®ÄÖÜäöüß + @latin1Chars@ + + + + + + + ${basedir} + false + + *.xml + + + + + + maven-resources-plugin + 2.2 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/verify.bsh new file mode 100644 index 000000000..db3c58da1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-encoding/verify.bsh @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +import org.codehaus.plexus.util.*; + +boolean check( String project, String encoding ) +{ + File pomFile = new File( basedir, "target/it/" + project + "/pom.xml" ); + System.out.println( "Checking for existence of original IT POM: " + pomFile ); + if ( !pomFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } + + pomFile = new File( basedir, "target/it/" + project + "/target/classes/pom.xml" ); + System.out.println( "Checking for existence of interpolated IT POM: " + pomFile ); + if ( !pomFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } + + String xml = FileUtils.fileRead( pomFile, encoding ); + + String[] values = { + "", + "\u00A9\u00AE\u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF", + "\u00A9\u00AE\u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF", + }; + for ( String value : values ) + { + System.out.println( "Checking for occurrence of: " + value ); + if ( xml.indexOf( value ) < 0 ) + { + System.out.println( "FAILED!" ); + return false; + } + } + return true; +} + +try +{ + return check( "latin-1", "ISO-8859-1" ) && check( "utf-8", "UTF-8" ); +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/pom.xml new file mode 100644 index 000000000..79dac5f11 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/pom.xml @@ -0,0 +1,65 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + pom-filtering-reactor + 1.0-SNAPSHOT + pom + + Test to check that POM filtering includes all parents/modules of the invoked project and not only the execution root. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + ${project.build.directory}/it + + */pom.xml + + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1-parent/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1-parent/pom.xml new file mode 100644 index 000000000..c43096ed9 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1-parent/pom.xml @@ -0,0 +1,33 @@ + + + + + + 4.0.0 + test + mod1-parent + 0.1-SNAPSHOT + pom + + + UTF-8 + @pom.artifactId@ + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1/pom.xml new file mode 100644 index 000000000..d3a07bdd4 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1/pom.xml @@ -0,0 +1,40 @@ + + + + + + 4.0.0 + + + test + mod1-parent + 0.1-SNAPSHOT + ../mod1-parent + + + mod1 + 0.1-SNAPSHOT + pom + + + UTF-8 + @pom.artifactId@ + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1/src/it/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1/src/it/pom.xml new file mode 100644 index 000000000..2421ebe1d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1/src/it/pom.xml @@ -0,0 +1,35 @@ + + + + + + 4.0.0 + + test + unfiltered + 0.1-SNAPSHOT + pom + + + UTF-8 + + @pom.artifactId@ + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod2/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod2/pom.xml new file mode 100644 index 000000000..f24cf40ed --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod2/pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + + + test + mod2-parent + 0.1-SNAPSHOT + + + mod2 + 0.1-SNAPSHOT + pom + + + UTF-8 + @pom.artifactId@ + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod3/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod3/pom.xml new file mode 100644 index 000000000..99f9183df --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod3/pom.xml @@ -0,0 +1,40 @@ + + + + + + 4.0.0 + + + test + mod1-parent + 0.1-SNAPSHOT + ../mod1-parent + + + mod3 + 0.1-SNAPSHOT + pom + + + UTF-8 + @pom.artifactId@ + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod3/src/it/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod3/src/it/pom.xml new file mode 100644 index 000000000..2421ebe1d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/mod3/src/it/pom.xml @@ -0,0 +1,35 @@ + + + + + + 4.0.0 + + test + unfiltered + 0.1-SNAPSHOT + pom + + + UTF-8 + + @pom.artifactId@ + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/pom.xml new file mode 100644 index 000000000..58b18cac0 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/src/it/mod2-parent/pom.xml @@ -0,0 +1,49 @@ + + + + + + 4.0.0 + + test + mod2-parent + 0.1-SNAPSHOT + pom + + + mod1 + mod2 + + + + UTF-8 + @pom.artifactId@ + + + + + minvoker-93 + + mod3 + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/verify.bsh new file mode 100644 index 000000000..d75e06d40 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering-reactor/verify.bsh @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +import org.codehaus.plexus.util.*; + +boolean check( String project, boolean filtered ) +{ + File pomFile = new File( basedir, "target/it/" + project + "/pom.xml" ); + System.out.println( "Checking for existence of " + ( filtered ? "" : "un" ) + "filtered POM: " + pomFile ); + if ( !pomFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } + + String xml = FileUtils.fileRead( pomFile, "UTF-8" ); + + String[] values = { + "pom-filtering-reactor", + }; + for ( String value : values ) + { + System.out.println( "Checking for " + ( filtered ? "occurrence" : "absence" ) + " of: " + value ); + if ( ( filtered && xml.indexOf( value ) < 0 ) || ( !filtered && xml.indexOf( value ) >= 0 ) ) + { + System.out.println( "FAILED!" ); + return false; + } + } + return true; +} + +try +{ + return check( "mod2-parent", true ) && check( "mod2-parent/mod2", true ) && check( "mod2-parent/mod1-parent", true ) + && check( "mod2-parent/mod1", true ) && check( "mod2-parent/mod3", true) + && check( "mod2-parent/mod1/src/it", false ); +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering/pom.xml new file mode 100644 index 000000000..b43fd1d48 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering/pom.xml @@ -0,0 +1,81 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + pom-filtering + 1.0-SNAPSHOT + pom + + PASSED + Test to check for proper filtering of IT POMs + + + UTF-8 + PROPERTY-FROM-PROPERTIES-SECTION + FAILED + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + true + ${project.build.directory}/it + + */pom.xml + + + process-resources + + + PROPERTY-FROM-PLUGIN-CONFIG + PASSED + FAILED + PASSED + PASSED + FAILED + FAILED + + + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering/src/it/project/pom.xml new file mode 100644 index 000000000..88e03dbf1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering/src/it/project/pom.xml @@ -0,0 +1,71 @@ + + + + + + 4.0.0 + test + pom-filtering + 0.1-SNAPSHOT + jar + + + UTF-8 + + ${project.version} + + @project.version@ + @propertyFromPluginConfig@ + @propertyFromPropertiesSection@ + + @project-is-not-the-pom.version@ + + @project.name@ + @pom.name@ + + @itProperty@ + + @project.nonExistingPomValue@ + + @basedir@ + @baseurl@ + @localRepository@ + @localRepositoryUrl@ + + + + + + + ${basedir} + false + + *.xml + + + + + + maven-resources-plugin + 2.2 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering/src/it/settings.xml new file mode 100644 index 000000000..79c5dc163 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering/src/it/settings.xml @@ -0,0 +1,55 @@ + + + + + + + + it-repo + + true + + + + local.central + file://@localRepository@ + + true + + + true + + + + + + local.central + file://@localRepository@ + + true + + + true + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-filtering/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering/verify.bsh new file mode 100644 index 000000000..a014c8acf --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-filtering/verify.bsh @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +import org.codehaus.plexus.util.*; + +try +{ + File pomFile = new File( basedir, "target/it/project/pom.xml" ); + System.out.println( "Checking for existence of original IT POM: " + pomFile ); + if ( !pomFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } + + pomFile = new File( basedir, "target/it/project/target/classes/pom.xml" ); + System.out.println( "Checking for existence of interpolated IT POM: " + pomFile ); + if ( !pomFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } + + String xml = FileUtils.fileRead( pomFile, "UTF-8" ); + + String[] values = { + "${project.version}", + "1.0-SNAPSHOT", + "PROPERTY-FROM-PLUGIN-CONFIG", + "PROPERTY-FROM-PROPERTIES-SECTION", + "PASSED", + "PASSED", + "PASSED", + "PASSED", + "PASSED", + "file:///", + "file:///", + }; + for ( String value : values ) + { + System.out.println( "Checking for occurrence of: " + value ); + if ( xml.indexOf( value ) < 0 ) + { + System.out.println( "FAILED!" ); + return false; + } + } + + String[] badValues = { + "@basedir@", + "FAILED", + "@baseurl@", + "FAILED", + "@localRepository@", + "@localRepositoryUrl@", + }; + for ( String value : badValues ) + { + System.out.println( "Checking for absence of: " + value ); + if ( xml.indexOf( value ) >= 0 ) + { + System.out.println( "FAILED!" ); + return false; + } + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-less-invocation/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/pom-less-invocation/pom.xml new file mode 100644 index 000000000..a9458c49c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-less-invocation/pom.xml @@ -0,0 +1,64 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + pom-less-invocation + 1.0-SNAPSHOT + pom + + Test to check for support to launch Maven on a mere directory, i.e. without a POM + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + ${project.build.directory}/it + + no-pom + + + --version + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-less-invocation/src/it/no-pom/workaround.txt b/Java-base/maven-invoker-plugin/src/src/it/pom-less-invocation/src/it/no-pom/workaround.txt new file mode 100644 index 000000000..8b04f6c31 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-less-invocation/src/it/no-pom/workaround.txt @@ -0,0 +1 @@ +This file ensures the directory is cloned, to be deleted once MINVOKER-48 is released. diff --git a/Java-base/maven-invoker-plugin/src/src/it/pom-less-invocation/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/pom-less-invocation/verify.bsh new file mode 100644 index 000000000..c471382e3 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/pom-less-invocation/verify.bsh @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + File itDir = new File( basedir, "target/it" ); + if ( !itDir.isDirectory() ) + { + System.out.println( "IT directory not existent: " + itDir ); + return false; + } + + String[] paths = { + "no-pom", + "no-pom/build.log", + }; + for ( String path : paths ) + { + File file = new File( itDir, path ); + if ( !file.exists() ) + { + System.out.println( "Expected file/directory not existent: " + file ); + return false; + } + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/pom.xml new file mode 100644 index 000000000..0a9faa981 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/pom.xml @@ -0,0 +1,71 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + fail-postbuild + 1.0-SNAPSHOT + pom + + Test to check that a failure of the post-build hook fails the parent build, too. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + true + ${project.build.directory}/it + + */pom.xml + + + validate + + + ${maven.compiler.source} + ${maven.compiler.target} + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/invoker.properties new file mode 100644 index 000000000..307ca97af --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/invoker.properties @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals.1 = test +invoker.goals.2 = test +invoker.systemPropertiesFile.2 = system2.properties diff --git a/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/pom.xml new file mode 100644 index 000000000..01b4e1e76 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/pom.xml @@ -0,0 +1,69 @@ + + + + 4.0.0 + + org.apache.maven.plugins.invoker.it.post_executed_only_once + post_executed_only_once + 1.0-SNAPSHOT + jar + + post_executed_only_once + http://maven.apache.org + + + UTF-8 + false + + + + + junit + junit + 4.12 + test + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.7.0 + + + org.apache.maven.plugins + maven-surefire-plugin + 2.21.0 + + + ${create_touch_file} + ${project.build.directory} + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/postbuild.bsh new file mode 100644 index 000000000..5cbc03eb2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/postbuild.bsh @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + File touchFile = new File( basedir, "target/touch.txt" ); + System.out.println( "Checking for existence of touch file: " + touchFile ); + if ( !touchFile.exists() ) + { + System.out.println( "touch.txt not exists FAILED!" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/App.java b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/App.java new file mode 100644 index 000000000..79bcfc535 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/App.java @@ -0,0 +1,36 @@ +package org.apache.maven.plugins.invoker.it.post_executed_only_once; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +public class App +{ + public boolean createFile() + throws Exception + { + if ( Boolean.getBoolean( "create_touch_file" ) ) + { + File touch = new File( System.getProperty( "touch_file_path" ), "touch.txt" ); + return touch.createNewFile(); + } + return false; + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/AppTest.java b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/AppTest.java new file mode 100644 index 000000000..e388290b4 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/AppTest.java @@ -0,0 +1,35 @@ +package org.apache.maven.plugins.invoker.it.post_executed_only_once; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.junit.Test; + +public class AppTest + extends TestCase +{ + @Test + public void testApp() + throws Exception + { + new App().createFile(); + assertTrue( true ); + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/system2.properties b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/system2.properties new file mode 100644 index 000000000..bcd7772de --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/src/it/project/system2.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +create_touch_file = true diff --git a/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/verify.bsh new file mode 100644 index 000000000..e05fbff38 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/postbuild-executed-only-once/verify.bsh @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else + File touchFile = new File( basedir, "target/it/project/target/touch.txt" ); + System.out.println( "Checking for existence of touch file: " + touchFile ); + if ( !touchFile.exists() ) + { + System.out.println( "FAILED! no touchFile " + touchFile.toString() ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/pom.xml new file mode 100644 index 000000000..7da94c98c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/pom.xml @@ -0,0 +1,65 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + project-cloning-reactor + 1.0-SNAPSHOT + pom + + Test to check that project cloning includes all parents/modules of the invoked project and not only sub directories. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + ${project.build.directory}/it + + + aggregator/pom.xml + + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/aggregator/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/aggregator/pom.xml new file mode 100644 index 000000000..34bed7d5e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/aggregator/pom.xml @@ -0,0 +1,38 @@ + + + + + + 4.0.0 + + test + aggregator + 0.1-SNAPSHOT + pom + + + ../module-a + ../module-b/pom.xml + + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/module-a/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/module-a/pom.xml new file mode 100644 index 000000000..05b90a7ce --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/module-a/pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + + + test + parent + 0.1-SNAPSHOT + ../parent + + + module-a + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/module-b/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/module-b/pom.xml new file mode 100644 index 000000000..73f423c81 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/module-b/pom.xml @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + + + test + parent + 0.1-SNAPSHOT + ../parent + + + module-b + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/parent/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/parent/pom.xml new file mode 100644 index 000000000..ef023f12a --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/src/it/parent/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + parent + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/verify.bsh new file mode 100644 index 000000000..22358c9fd --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-cloning-reactor/verify.bsh @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +// sanity check to make sure the builds were actually run +File itDir = new File( basedir, "target/it" ); +System.out.println( "Checking for existence of clones: " + itDir ); +if ( !itDir.exists() ) +{ + throw new FileNotFoundException( "Missing IT directory: " + itDir ); +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-cloning/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-cloning/pom.xml new file mode 100644 index 000000000..1b7e9081c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-cloning/pom.xml @@ -0,0 +1,64 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + project-cloning + 1.0-SNAPSHOT + pom + + Test to check for proper project cloning + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + ${project.build.directory}/it + + **/pom.xml + + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-cloning/setup.bsh b/Java-base/maven-invoker-plugin/src/src/it/project-cloning/setup.bsh new file mode 100644 index 000000000..ca4c31a51 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-cloning/setup.bsh @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + File emptyDir = new File( basedir, "src/it/module-1/empty-dir" ); + emptyDir.mkdirs(); +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-cloning/src/it/module-1/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-cloning/src/it/module-1/pom.xml new file mode 100644 index 000000000..5badb327b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-cloning/src/it/module-1/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + org.apache.maven.test + unit + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-cloning/src/it/module-1/sub-module/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-cloning/src/it/module-1/sub-module/pom.xml new file mode 100644 index 000000000..5badb327b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-cloning/src/it/module-1/sub-module/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + org.apache.maven.test + unit + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-cloning/src/it/module/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-cloning/src/it/module/pom.xml new file mode 100644 index 000000000..5badb327b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-cloning/src/it/module/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + org.apache.maven.test + unit + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-cloning/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/project-cloning/verify.bsh new file mode 100644 index 000000000..63b495a53 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-cloning/verify.bsh @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + File itDir = new File( basedir, "target/it" ); + if ( !itDir.isDirectory() ) + { + System.out.println( "IT directory not existent: " + itDir ); + return false; + } + + // NOTE: It is part of the test design that "module" is a prefix of "module-1" + String[] paths = { + "module", + "module/pom.xml", + "module-1", + "module-1/pom.xml", + "module-1/empty-dir", + "module-1/sub-module", + "module-1/sub-module/pom.xml", + }; + for ( String path : paths ) + { + File file = new File( itDir, path ); + if ( !file.exists() ) + { + System.out.println( "Cloned file/directory not existent: " + file ); + return false; + } + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-setup/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-setup/pom.xml new file mode 100644 index 000000000..0922bba0d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-setup/pom.xml @@ -0,0 +1,68 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + project-setup + 1.0-SNAPSHOT + pom + + Test to check that setup projects are run ahead of the other ones. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + ${project.build.directory}/it + + project3 + project6 + + + */pom.xml + + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project1/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project1/invoker.properties new file mode 100644 index 000000000..d81ec8ff8 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project1/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.name = Foo +invoker.description = good foo diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project1/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project1/pom.xml new file mode 100644 index 000000000..f01b9156e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project1/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + project1 + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project2/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project2/pom.xml new file mode 100644 index 000000000..a747a1ee2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project2/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + project2 + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project3/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project3/invoker.properties new file mode 100644 index 000000000..be57c2e4c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project3/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.ordinal=100 diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project3/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project3/pom.xml new file mode 100644 index 000000000..d1090ccce --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project3/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + project3 + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project4/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project4/pom.xml new file mode 100644 index 000000000..f5735d02c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project4/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + project4 + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project5/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project5/pom.xml new file mode 100644 index 000000000..cc725c8d1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project5/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + project5 + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project6/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project6/invoker.properties new file mode 100644 index 000000000..081215ba3 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project6/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.ordinal=2 diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project6/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project6/pom.xml new file mode 100644 index 000000000..4be587409 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-setup/src/it/project6/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + project6 + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/project-setup/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/project-setup/verify.bsh new file mode 100644 index 000000000..59a985d48 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/project-setup/verify.bsh @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +import org.codehaus.plexus.util.*; + +try +{ + File logFile = new File( basedir, "build.log" ); + System.out.println( "Checking for existence of build log: " + logFile ); + if ( !logFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } + + String log = FileUtils.fileRead( logFile ); + + System.out.println( "Checking for first build" ); + int index = log.indexOf( "Building: project" ); + if ( !log.substring( index, index + 18 ).equals( "Building: project3" ) ) + { + System.out.println( "FAILED!\n" + log.substring( index, index + 18 ) ); + return false; + } + + System.out.println( "Checking for duplicate build" ); + index = log.indexOf( "Building: project3", index + 1 ); + if ( index >= 0 ) + { + System.out.println( "FAILED!" ); + return false; + } + + int indexProject3 = log.indexOf( "Building: project3" ); + int indexProject6 = log.indexOf( "Building: project6" ); + if(indexProject3 > indexProject6) + { + System.out.println( "FAILED! project3 should be build before project6" ); + return false; + } + + File reportFile = new File( basedir, "target/invoker-reports/BUILD-project1.xml" ); + if ( !reportFile.exists() ) + { + System.out.println( "reportFile not exists FAILED!" ); + return false; + } + String report = FileUtils.fileRead( reportFile, "UTF-8" ); + index = report.indexOf("name=\"Foo\""); + if ( index < 0 ) + { + System.out.println( "name missing in the report FAILED!" ); + return false; + } + index = report.indexOf("description=\"good foo\""); + if ( index < 0 ) + { + System.out.println( "description missing in the report FAILED!" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/invoker.properties new file mode 100644 index 000000000..0659ac55b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = compile diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/pom.xml new file mode 100644 index 000000000..808cf00e0 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/pom.xml @@ -0,0 +1,68 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + script-accessibility + 1.0-SNAPSHOT + jar + + + Test to check for accessibility of non-public fields/methods in hook scripts. + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + + */pom.xml + + setup + verify + + validate + + true + + + + integration-test + compile + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/beanshell/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/beanshell/pom.xml new file mode 100644 index 000000000..f8a5c6aeb --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/beanshell/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + beanshell + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/beanshell/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/beanshell/verify.bsh new file mode 100644 index 000000000..7dede1931 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/beanshell/verify.bsh @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.MyClass; + +System.out.println( MyClass.PUBLIC ); +System.out.println( MyClass.PROTECTED ); +System.out.println( MyClass.PACKAGE ); +System.out.println( MyClass.PRIVATE ); diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/groovy/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/groovy/pom.xml new file mode 100644 index 000000000..b1ba49ede --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/groovy/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + groovy + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/groovy/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/groovy/verify.groovy new file mode 100644 index 000000000..9cfcac93b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/it/groovy/verify.groovy @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.MyClass; + +println MyClass.PUBLIC +println MyClass.PROTECTED +println MyClass.PACKAGE +println MyClass.PRIVATE diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/main/java/org/MyClass.java b/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/main/java/org/MyClass.java new file mode 100644 index 000000000..010ec3434 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-accessibility/src/main/java/org/MyClass.java @@ -0,0 +1,34 @@ +package org; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 MyClass +{ + + public static final String PUBLIC = "public"; + + protected static final String PROTECTED = "protected"; + + static final String PACKAGE = "package"; + + private static final String PRIVATE = "private"; + +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/pom.xml new file mode 100644 index 000000000..fbafe4feb --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/pom.xml @@ -0,0 +1,68 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + script-additional-vars + 1.0-SNAPSHOT + pom + + + Test to check for usage of additional hook script variables. + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + + */pom.xml + + + world + ${project.version} + + + validate + + + + + integration-test + initialize + + run + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/pom.xml new file mode 100644 index 000000000..f8a5c6aeb --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + beanshell + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/postbuild.bsh new file mode 100644 index 000000000..87a5c1383 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/postbuild.bsh @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; + +try +{ + System.out.println( hello ); + if ( !hello.equals( "world" ) ) + { + System.out.println( "Additional script variable declared in mojo configuration not defined: hello" ); + return false; + } + + System.out.println( version ); + if ( !version.equals( "1.0-SNAPSHOT" ) ) + { + System.out.println( "Additional script variable declared in mojo configuration not defined: version" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/prebuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/prebuild.bsh new file mode 100644 index 000000000..87a5c1383 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/prebuild.bsh @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; + +try +{ + System.out.println( hello ); + if ( !hello.equals( "world" ) ) + { + System.out.println( "Additional script variable declared in mojo configuration not defined: hello" ); + return false; + } + + System.out.println( version ); + if ( !version.equals( "1.0-SNAPSHOT" ) ) + { + System.out.println( "Additional script variable declared in mojo configuration not defined: version" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/selector.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/selector.bsh new file mode 100644 index 000000000..4feb153ae --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/beanshell/selector.bsh @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; + +try +{ + System.out.println( hello ); + if ( !hello.equals( "world" ) ) + { + throw new Exception( "Additional script variable declared in mojo configuration not defined: hello" ); + } + + System.out.println( version ); + if ( !version.equals( "1.0-SNAPSHOT" ) ) + { + throw new Exception( "Additional script variable declared in mojo configuration not defined: version" ); + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + throw t; +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/pom.xml new file mode 100644 index 000000000..f8a5c6aeb --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + beanshell + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/postbuild.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/postbuild.groovy new file mode 100644 index 000000000..cdef4bc70 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/postbuild.groovy @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.util.* + +try +{ + println hello + if ( !hello.equals( "world" ) ) + { + println "Additional script variable declared in mojo configuration not defined: hello" + return false + } + + println version + if ( !version.equals( "1.0-SNAPSHOT" ) ) + { + println "Additional script variable declared in mojo configuration not defined: version" + return false + } +} +catch( Throwable t ) +{ + t.printStackTrace() + return false +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/prebuild.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/prebuild.groovy new file mode 100644 index 000000000..cdef4bc70 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/prebuild.groovy @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.util.* + +try +{ + println hello + if ( !hello.equals( "world" ) ) + { + println "Additional script variable declared in mojo configuration not defined: hello" + return false + } + + println version + if ( !version.equals( "1.0-SNAPSHOT" ) ) + { + println "Additional script variable declared in mojo configuration not defined: version" + return false + } +} +catch( Throwable t ) +{ + t.printStackTrace() + return false +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/selector.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/selector.groovy new file mode 100644 index 000000000..5ae43b31d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-additional-vars/src/it/groovy/selector.groovy @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.util.* + +try +{ + println hello + if ( !hello.equals( "world" ) ) + { + throw new Exception( "Additional script variable declared in mojo configuration not defined: hello" ) + } + + println version + if ( !version.equals( "1.0-SNAPSHOT" ) ) + { + throw new Exception( "Additional script variable declared in mojo configuration not defined: version" ) + } +} +catch( Throwable t ) +{ + t.printStackTrace() + throw t +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/invoker.properties new file mode 100644 index 000000000..70fab92e1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = test-compile diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/pom.xml new file mode 100644 index 000000000..d3c3c11c5 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/pom.xml @@ -0,0 +1,77 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + script-class-loading + 1.0-SNAPSHOT + jar + + Test to check for proper class loading in hook scripts (i.e. project test class path before plugin class path) + + + UTF-8 + + + + + org.codehaus.plexus + plexus-utils + + 1.1 + test + + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + + */pom.xml + + prebuild + postbuild + + validate + + true + + + + integration-test + test-compile + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/beanshell/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/beanshell/pom.xml new file mode 100644 index 000000000..f8a5c6aeb --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/beanshell/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + beanshell + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/beanshell/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/beanshell/postbuild.bsh new file mode 100644 index 000000000..08415b33b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/beanshell/postbuild.bsh @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.lang.reflect.*; +import java.util.*; +import java.util.regex.*; + +import org.codehaus.plexus.util.*; + +try +{ + System.out.println( "Invoking class from project's test class path" ); + System.out.println( org.MyUtils.getNothing() ); + + System.out.println( "Trying to access method which is unavaible in old plexus-utils" ); + try + { + System.out.println( FileUtils.class.getMethod( "copyFileIfModified", new Class[] { File.class, File.class } ) ); + System.out.println( "FAILED!" ); + return false; + } + catch( NoSuchMethodException e ) + { + // expected + e.printStackTrace(); + } + +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/beanshell/prebuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/beanshell/prebuild.bsh new file mode 100644 index 000000000..08415b33b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/beanshell/prebuild.bsh @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.lang.reflect.*; +import java.util.*; +import java.util.regex.*; + +import org.codehaus.plexus.util.*; + +try +{ + System.out.println( "Invoking class from project's test class path" ); + System.out.println( org.MyUtils.getNothing() ); + + System.out.println( "Trying to access method which is unavaible in old plexus-utils" ); + try + { + System.out.println( FileUtils.class.getMethod( "copyFileIfModified", new Class[] { File.class, File.class } ) ); + System.out.println( "FAILED!" ); + return false; + } + catch( NoSuchMethodException e ) + { + // expected + e.printStackTrace(); + } + +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/groovy/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/groovy/pom.xml new file mode 100644 index 000000000..b1ba49ede --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/groovy/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + groovy + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/groovy/postbuild.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/groovy/postbuild.groovy new file mode 100644 index 000000000..b25d789d6 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/groovy/postbuild.groovy @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.lang.reflect.* +import java.util.* +import java.util.regex.* + +import org.codehaus.plexus.util.* + +try +{ + println "Invoking class from project's test class path" + println org.MyUtils.getNothing() + + println "Trying to access method which is unavaible in old plexus-utils" + try + { + Class[] types = [ File.class, File.class ]; + println FileUtils.class.getMethod( "copyFileIfModified", types ) + println "FAILED!" + return false + } + catch( NoSuchMethodException e ) + { + // expected + e.printStackTrace() + } + +} +catch( Throwable t ) +{ + t.printStackTrace() + return false +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/groovy/prebuild.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/groovy/prebuild.groovy new file mode 100644 index 000000000..b25d789d6 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/it/groovy/prebuild.groovy @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.lang.reflect.* +import java.util.* +import java.util.regex.* + +import org.codehaus.plexus.util.* + +try +{ + println "Invoking class from project's test class path" + println org.MyUtils.getNothing() + + println "Trying to access method which is unavaible in old plexus-utils" + try + { + Class[] types = [ File.class, File.class ]; + println FileUtils.class.getMethod( "copyFileIfModified", types ) + println "FAILED!" + return false + } + catch( NoSuchMethodException e ) + { + // expected + e.printStackTrace() + } + +} +catch( Throwable t ) +{ + t.printStackTrace() + return false +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/test/java/org/MyUtils.java b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/test/java/org/MyUtils.java new file mode 100644 index 000000000..14364b2c7 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-class-loading/src/test/java/org/MyUtils.java @@ -0,0 +1,31 @@ +package org; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 MyUtils +{ + + public static String getNothing() + { + return "nothing"; + } + +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/pom.xml new file mode 100644 index 000000000..3ae925029 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/pom.xml @@ -0,0 +1,81 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + script-classpath-duplicates + 1.0-SNAPSHOT + pom + + Test to check that script classpath entries duplicated between ${project.testClasspathElements} and ${plugin.artifacts} are removed + + + UTF-8 + + + + + @beanshell-groupId@ + @beanshell-artifactId@ + @beanshell-version@ + test + + + @groovy-groupId@ + @groovy-artifactId@ + @groovy-version@ + test + + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + true + ${project.build.directory}/it + + * + + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/beanshell/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/beanshell/pom.xml new file mode 100644 index 000000000..f8a5c6aeb --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/beanshell/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + beanshell + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/beanshell/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/beanshell/postbuild.bsh new file mode 100644 index 000000000..c7acb758b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/beanshell/postbuild.bsh @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.lang.reflect.*; +import java.util.*; +import java.util.regex.*; + +try +{ + // create touch file so that the parent build can verify whether this script was called + File touchFile = new File( basedir, "target/created-by-postbuild.bsh" ); + System.out.println( "Creating touch file: " + touchFile ); + touchFile.getParentFile().mkdirs(); + touchFile.createNewFile(); +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/beanshell/prebuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/beanshell/prebuild.bsh new file mode 100644 index 000000000..0c679ab56 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/beanshell/prebuild.bsh @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.lang.reflect.*; +import java.util.*; +import java.util.regex.*; + +try +{ + // create touch file so that the parent build can verify whether this script was called + File touchFile = new File( basedir, "target/created-by-prebuild.bsh" ); + System.out.println( "Creating touch file: " + touchFile ); + touchFile.getParentFile().mkdirs(); + touchFile.createNewFile(); +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/groovy/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/groovy/pom.xml new file mode 100644 index 000000000..b1ba49ede --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/groovy/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + groovy + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/groovy/postbuild.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/groovy/postbuild.groovy new file mode 100644 index 000000000..d9fc6d8e5 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/groovy/postbuild.groovy @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.lang.reflect.* +import java.util.* +import java.util.regex.* + +try +{ + // create touch file so that the parent build can verify whether this script was called + File touchFile = new File( basedir, "target/created-by-postbuild.groovy" ) + println "Creating touch file: " + touchFile + touchFile.getParentFile().mkdirs() + touchFile.createNewFile() +} +catch( Throwable t ) +{ + t.printStackTrace() + return false +} + +return true diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/groovy/prebuild.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/groovy/prebuild.groovy new file mode 100644 index 000000000..677737751 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/src/it/groovy/prebuild.groovy @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.lang.reflect.* +import java.util.* +import java.util.regex.* + +try +{ + // create touch file so that the parent build can verify whether this script was called + File touchFile = new File( basedir, "target/created-by-prebuild.groovy" ) + println "Creating touch file: " + touchFile + touchFile.getParentFile().mkdirs() + touchFile.createNewFile() +} +catch( Throwable t ) +{ + t.printStackTrace() + return false +} + +return true diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/verify.bsh new file mode 100644 index 000000000..e7a35e5d4 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-classpath-duplicates/verify.bsh @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + String[] files = { + "target/it/beanshell/target/created-by-prebuild.bsh", + "target/it/beanshell/target/created-by-postbuild.bsh", + "target/it/groovy/target/created-by-prebuild.groovy", + "target/it/groovy/target/created-by-postbuild.groovy", + }; + for ( String file : files ) + { + File touchFile = new File( basedir, file ); + System.out.println( "Checking for existence of: " + touchFile ); + if ( !touchFile.isFile() ) + { + System.out.println( "FAILED!" ); + return false; + } + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-context/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-context/pom.xml new file mode 100644 index 000000000..6d35a68c6 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-context/pom.xml @@ -0,0 +1,68 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + script-context + 1.0-SNAPSHOT + pom + + + Test that the hook scripts can share information via a map in the global variable "context" (MINVOKER-79). + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + ${project.build.directory}/its + + */pom.xml + + setup + verify + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/beanshell/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/beanshell/pom.xml new file mode 100644 index 000000000..f8a5c6aeb --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/beanshell/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + beanshell + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/beanshell/setup.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/beanshell/setup.bsh new file mode 100644 index 000000000..572328ce2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/beanshell/setup.bsh @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +context.put( "touchFile", new File( basedir, "touch.txt" ) ); + +System.out.println( context ); diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/beanshell/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/beanshell/verify.bsh new file mode 100644 index 000000000..452ac9ae9 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/beanshell/verify.bsh @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +System.out.println( context ); + +File touchFile = context.get( "touchFile" ); +touchFile.createNewFile(); + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/groovy/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/groovy/pom.xml new file mode 100644 index 000000000..b1ba49ede --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/groovy/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + groovy + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/groovy/setup.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/groovy/setup.groovy new file mode 100644 index 000000000..945674998 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/groovy/setup.groovy @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.util.* +import java.util.regex.* + +context.put( "touchFile", new File( basedir, "touch.txt" ) ) + +println context diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/groovy/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/groovy/verify.groovy new file mode 100644 index 000000000..d11c416c3 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-context/src/it/groovy/verify.groovy @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.util.* +import java.util.regex.* + +println context + +File touchFile = context.get( "touchFile" ) +touchFile.createNewFile() + +return true diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-context/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-context/verify.bsh new file mode 100644 index 000000000..c4c51498c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-context/verify.bsh @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +File touchFile; + +touchFile = new File( basedir, "target/its/beanshell/touch.txt" ); +System.out.println( "Checking for existence of touch file: " + touchFile ); +if ( !touchFile.exists() ) +{ + throw new FileNotFoundException( "Did not find marker file: " + touchFile ); +} + +touchFile = new File( basedir, "target/its/groovy/touch.txt" ); +System.out.println( "Checking for existence of touch file: " + touchFile ); +if ( !touchFile.exists() ) +{ + throw new FileNotFoundException( "Did not find marker file: " + touchFile ); +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-errors/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-errors/pom.xml new file mode 100644 index 000000000..3d600d43b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-errors/pom.xml @@ -0,0 +1,71 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + script-errors + 1.0-SNAPSHOT + pom + + + Test to check that any kind of error from the script, i.e. both java.lang.Exception and java.lang.Error, + is caught by the interpreter facade and does not go up to the main build (MINVOKER-78). + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + true + ${project.build.directory}/its + + */pom.xml + + setup + verify + + validate + + true + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/beanshell/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/beanshell/pom.xml new file mode 100644 index 000000000..f8a5c6aeb --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/beanshell/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + beanshell + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/beanshell/setup.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/beanshell/setup.bsh new file mode 100644 index 000000000..59f8a6d11 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/beanshell/setup.bsh @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// marker for parent build that this sub build was indeed run +File touchFile = new File( basedir, "touch.txt" ); +touchFile.createNewFile(); + +// BeanShell does not allow us to simply throw an error, so will we try to trigger an OutOfMemoryError... +long[] arr = new long[ Integer.MAX_VALUE ]; diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/groovy/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/groovy/pom.xml new file mode 100644 index 000000000..b1ba49ede --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/groovy/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + groovy + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/groovy/setup.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/groovy/setup.groovy new file mode 100644 index 000000000..7ab7535c1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-errors/src/it/groovy/setup.groovy @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// marker for parent build that this sub build was indeed run +File touchFile = new File( basedir, "touch.txt" ) +touchFile.createNewFile() + +if ( true ) throw new AssertionError( "This should not cause the main build to fail" ) + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-errors/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-errors/verify.bsh new file mode 100644 index 000000000..81ac2c8e1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-errors/verify.bsh @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +// make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else +File touchFile; + +touchFile = new File( basedir, "target/its/beanshell/touch.txt" ); +System.out.println( "Checking for existence of touch file: " + touchFile ); +if ( !touchFile.exists() ) +{ + throw new FileNotFoundException( "Did not find marker file: " + touchFile ); +} + +touchFile = new File( basedir, "target/its/groovy/touch.txt" ); +System.out.println( "Checking for existence of touch file: " + touchFile ); +if ( !touchFile.exists() ) +{ + throw new FileNotFoundException( "Did not find marker file: " + touchFile ); +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/pom.xml new file mode 100644 index 000000000..585b5b1bc --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/pom.xml @@ -0,0 +1,67 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + script-global-vars + 1.0-SNAPSHOT + pom + + + Test to check for existence of supported global script variables. + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + + */pom.xml + + setup + verify + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/beanshell/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/beanshell/pom.xml new file mode 100644 index 000000000..f8a5c6aeb --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/beanshell/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + beanshell + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/beanshell/setup.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/beanshell/setup.bsh new file mode 100644 index 000000000..2106fcca7 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/beanshell/setup.bsh @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + System.out.println( basedir ); + if ( !( basedir instanceof File ) ) + { + System.out.println( "Global script variable not defined: basedir" ); + return false; + } + + System.out.println( localRepositoryPath ); + if ( !( localRepositoryPath instanceof File ) ) + { + System.out.println( "Global script variable not defined: localRepositoryPath" ); + return false; + } + + System.out.println( mavenVersion ); + if ( mavenVersion == null ) + { + System.out.println( "Global script variable not defined: mavenVersion" ); + return false; + } + if ( mavenVersion.trim().equals( "" ) ) + { + System.out.println( "Global script variable empty: mavenVersion" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/beanshell/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/beanshell/verify.bsh new file mode 100644 index 000000000..2106fcca7 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/beanshell/verify.bsh @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + System.out.println( basedir ); + if ( !( basedir instanceof File ) ) + { + System.out.println( "Global script variable not defined: basedir" ); + return false; + } + + System.out.println( localRepositoryPath ); + if ( !( localRepositoryPath instanceof File ) ) + { + System.out.println( "Global script variable not defined: localRepositoryPath" ); + return false; + } + + System.out.println( mavenVersion ); + if ( mavenVersion == null ) + { + System.out.println( "Global script variable not defined: mavenVersion" ); + return false; + } + if ( mavenVersion.trim().equals( "" ) ) + { + System.out.println( "Global script variable empty: mavenVersion" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/groovy/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/groovy/pom.xml new file mode 100644 index 000000000..b1ba49ede --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/groovy/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + groovy + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/groovy/setup.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/groovy/setup.groovy new file mode 100644 index 000000000..d7c3171dd --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/groovy/setup.groovy @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.util.* +import java.util.regex.* + +try +{ + println basedir + if ( !( basedir instanceof File ) ) + { + println "Global script variable not defined: basedir" + return false + } + + println localRepositoryPath + if ( !( localRepositoryPath instanceof File ) ) + { + println "Global script variable not defined: localRepositoryPath" + return false + } + + println mavenVersion + if ( !mavenVersion ) + { + println "Global script variable not defined: mavenVersion" + return false + } + if ( !mavenVersion?.trim() ) + { + println "Global script variable empty: mavenVersion" + return false + } +} +catch( Throwable t ) +{ + t.printStackTrace() + return false +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/groovy/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/groovy/verify.groovy new file mode 100644 index 000000000..d7c3171dd --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-global-vars/src/it/groovy/verify.groovy @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.util.* +import java.util.regex.* + +try +{ + println basedir + if ( !( basedir instanceof File ) ) + { + println "Global script variable not defined: basedir" + return false + } + + println localRepositoryPath + if ( !( localRepositoryPath instanceof File ) ) + { + println "Global script variable not defined: localRepositoryPath" + return false + } + + println mavenVersion + if ( !mavenVersion ) + { + println "Global script variable not defined: mavenVersion" + return false + } + if ( !mavenVersion?.trim() ) + { + println "Global script variable empty: mavenVersion" + return false + } +} +catch( Throwable t ) +{ + t.printStackTrace() + return false +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/pom.xml new file mode 100644 index 000000000..b5d5ee1e2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/pom.xml @@ -0,0 +1,67 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + script-interpreter-detection + 1.0-SNAPSHOT + jar + + Test to check for detection of script interpreter from file extension. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + ${project.build.directory}/its + true + + */pom.xml + + prebuild + postbuild + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/beanshell/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/beanshell/pom.xml new file mode 100644 index 000000000..f8a5c6aeb --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/beanshell/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + beanshell + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/beanshell/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/beanshell/postbuild.bsh new file mode 100644 index 000000000..be542798f --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/beanshell/postbuild.bsh @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.lang.reflect.*; +import java.util.*; +import java.util.regex.*; + +try +{ + // create touch file so that the parent build can verify whether this script was called + File touchFile = new File( basedir, "target/postbuild.bsh" ); + System.out.println( "Creating touch file: " + touchFile ); + touchFile.getParentFile().mkdirs(); + touchFile.createNewFile(); +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/beanshell/prebuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/beanshell/prebuild.bsh new file mode 100644 index 000000000..4b687a6b1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/beanshell/prebuild.bsh @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.lang.reflect.*; +import java.util.*; +import java.util.regex.*; + +try +{ + // create touch file so that the parent build can verify whether this script was called + File touchFile = new File( basedir, "target/prebuild.bsh" ); + System.out.println( "Creating touch file: " + touchFile ); + touchFile.getParentFile().mkdirs(); + touchFile.createNewFile(); +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/groovy/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/groovy/pom.xml new file mode 100644 index 000000000..b1ba49ede --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/groovy/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + groovy + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/groovy/postbuild.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/groovy/postbuild.groovy new file mode 100644 index 000000000..d4e1c69ef --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/groovy/postbuild.groovy @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.lang.reflect.* +import java.util.* +import java.util.regex.* + +try +{ + // create touch file so that the parent build can verify whether this script was called + File touchFile = new File( basedir, "target/postbuild.groovy" ) + println "Creating touch file: " + touchFile + touchFile.getParentFile().mkdirs() + touchFile.createNewFile() +} +catch( Throwable t ) +{ + t.printStackTrace() + return false +} + +return true diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/groovy/prebuild.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/groovy/prebuild.groovy new file mode 100644 index 000000000..5b3ba9ce6 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/src/it/groovy/prebuild.groovy @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.lang.reflect.* +import java.util.* +import java.util.regex.* + +try +{ + // create touch file so that the parent build can verify whether this script was called + File touchFile = new File( basedir, "target/prebuild.groovy" ) + println "Creating touch file: " + touchFile + touchFile.getParentFile().mkdirs() + touchFile.createNewFile() +} +catch( Throwable t ) +{ + t.printStackTrace() + return false +} + +return true diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/verify.bsh new file mode 100644 index 000000000..8baef9fca --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-interpreter-detection/verify.bsh @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + String[] files = { + "target/its/beanshell/target/prebuild.bsh", + "target/its/beanshell/target/postbuild.bsh", + "target/its/groovy/target/prebuild.groovy", + "target/its/groovy/target/postbuild.groovy", + }; + for ( String file : files ) + { + File touchFile = new File( basedir, file ); + System.out.println( "Checking for existence of: " + touchFile ); + if ( !touchFile.isFile() ) + { + System.out.println( "FAILED!" ); + return false; + } + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-verify-xml/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-verify-xml/pom.xml new file mode 100644 index 000000000..db94d2996 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-verify-xml/pom.xml @@ -0,0 +1,61 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker.its + script-verify-xml + 1.0-SNAPSHOT + pom + + Test if the XmlSlurper is still on the classpath. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + true + + validate + + + + + integration-test + initialize + + verify + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-verify-xml/src/it/minvoker-138/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/script-verify-xml/src/it/minvoker-138/pom.xml new file mode 100644 index 000000000..634dc5e23 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-verify-xml/src/it/minvoker-138/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + org.apache.maven.plugins.invoker.its + minvoker-138 + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/script-verify-xml/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/script-verify-xml/verify.groovy new file mode 100644 index 000000000..c1409bf6c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/script-verify-xml/verify.groovy @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// from http://groovy-lang.org/processing-xml.html +// A lot of examples covering xml assertions + +class XmlExamples { + static def CAR_RECORDS = ''' + + + Australia + Production Pickup Truck with speed of 271kph + + + Isle of Man + Smallest Street-Legal Car at 99cm wide and 59 kg in weight + + + France + Most Valuable Car at $15 million + + + ''' +} +def records = new XmlSlurper().parseText(XmlExamples.CAR_RECORDS) +def allRecords = records.car +assert 3 == allRecords.size() +def allNodes = records.depthFirst().collect{ it } +assert 10 == allNodes.size() +def firstRecord = records.car[0] +assert 'car' == firstRecord.name() +assert 'Holden' == firstRecord.@make.text() +assert 'Australia' == firstRecord.country.text() +def carsWith_e_InMake = records.car.findAll{ it.@make.text().contains('e') } +assert carsWith_e_InMake.size() == 2 +// alternative way to find cars with 'e' in make +assert 2 == records.car.findAll{ it.@make =~ '.*e.*' }.size() +// makes of cars that have an 's' followed by an 'a' in the country +assert ['Holden', 'Peel'] == records.car.findAll{ it.country =~ '.*s.*a.*' }.@make.collect{ it.text() } +def expectedRecordTypes = ['speed', 'size', 'price'] +assert expectedRecordTypes == records.depthFirst().grep{ it.@type != '' }.'@type'*.text() +assert expectedRecordTypes == records.'**'.grep{ it.@type != '' }.'@type'*.text() +def countryOne = records.car[1].country +assert 'Peel' == countryOne.parent().@make.text() +assert 'Peel' == countryOne.'..'.@make.text() +// names of cars with records sorted by year +def sortedNames = records.car.list().sort{ it.@year.toInteger() }.'@name'*.text() +assert ['Royale', 'P50', 'HSV Maloo'] == sortedNames +assert ['Australia', 'Isle of Man'] == records.'**'.grep{ it.@type =~ 's.*' }*.parent().country*.text() +assert 'co-re-co-re-co-re' == records.car.children().collect{ it.name()[0..1] }.join('-') +assert 'co-re-co-re-co-re' == records.car.'*'.collect{ it.name()[0..1] }.join('-') diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/pom.xml new file mode 100644 index 000000000..c73a245be --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/pom.xml @@ -0,0 +1,67 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + selector-conditions + 1.0-SNAPSHOT + maven-plugin + + Test to check for selection of builds based on OS and/or JRE. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + true + + + */pom.xml + + prebuild + postbuild + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-match/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-match/invoker.properties new file mode 100644 index 000000000..4156517ee --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-match/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.java.version = 1.4-, 1.4, 1.5+ diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-match/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-match/pom.xml new file mode 100644 index 000000000..ea5c00f33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-match/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-match/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-match/postbuild.bsh new file mode 100644 index 000000000..d2e394e1d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-match/postbuild.bsh @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// create touch file so that the parent build can verify whether this build was executed +File touchFile = new File( basedir, "target/touch.txt" ); +System.out.println( "Creating touch file: " + touchFile ); +touchFile.getParentFile().mkdirs(); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-mismatch/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-mismatch/invoker.properties new file mode 100644 index 000000000..fff42af24 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-mismatch/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.java.version = 1.2 diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-mismatch/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-mismatch/pom.xml new file mode 100644 index 000000000..ea5c00f33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-mismatch/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-mismatch/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-mismatch/postbuild.bsh new file mode 100644 index 000000000..d2e394e1d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/jre-version-mismatch/postbuild.bsh @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// create touch file so that the parent build can verify whether this build was executed +File touchFile = new File( basedir, "target/touch.txt" ); +System.out.println( "Creating touch file: " + touchFile ); +touchFile.getParentFile().mkdirs(); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-match/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-match/invoker.properties new file mode 100644 index 000000000..cd7465e1e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-match/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.maven.version = 2.0+ diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-match/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-match/pom.xml new file mode 100644 index 000000000..ea5c00f33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-match/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-match/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-match/postbuild.bsh new file mode 100644 index 000000000..d2e394e1d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-match/postbuild.bsh @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// create touch file so that the parent build can verify whether this build was executed +File touchFile = new File( basedir, "target/touch.txt" ); +System.out.println( "Creating touch file: " + touchFile ); +touchFile.getParentFile().mkdirs(); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-mismatch/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-mismatch/invoker.properties new file mode 100644 index 000000000..8e0939639 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-mismatch/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.maven.version = 1.2 diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-mismatch/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-mismatch/pom.xml new file mode 100644 index 000000000..ea5c00f33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-mismatch/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-mismatch/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-mismatch/postbuild.bsh new file mode 100644 index 000000000..d2e394e1d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/maven-version-mismatch/postbuild.bsh @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// create touch file so that the parent build can verify whether this build was executed +File touchFile = new File( basedir, "target/touch.txt" ); +System.out.println( "Creating touch file: " + touchFile ); +touchFile.getParentFile().mkdirs(); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-match/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-match/invoker.properties new file mode 100644 index 000000000..7b53a3b7c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-match/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.os.family = !nowhere diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-match/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-match/pom.xml new file mode 100644 index 000000000..ea5c00f33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-match/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-match/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-match/postbuild.bsh new file mode 100644 index 000000000..d2e394e1d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-match/postbuild.bsh @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// create touch file so that the parent build can verify whether this build was executed +File touchFile = new File( basedir, "target/touch.txt" ); +System.out.println( "Creating touch file: " + touchFile ); +touchFile.getParentFile().mkdirs(); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-mismatch/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-mismatch/invoker.properties new file mode 100644 index 000000000..d25f3a4cc --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-mismatch/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.os.family = nowhere diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-mismatch/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-mismatch/pom.xml new file mode 100644 index 000000000..ea5c00f33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-mismatch/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-mismatch/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-mismatch/postbuild.bsh new file mode 100644 index 000000000..d2e394e1d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/os-family-mismatch/postbuild.bsh @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// create touch file so that the parent build can verify whether this build was executed +File touchFile = new File( basedir, "target/touch.txt" ); +System.out.println( "Creating touch file: " + touchFile ); +touchFile.getParentFile().mkdirs(); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/toolchain-mismatch/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/toolchain-mismatch/invoker.properties new file mode 100644 index 000000000..b22a42507 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/toolchain-mismatch/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.toolchain.jdk.vendor = mycomp diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/toolchain-mismatch/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/toolchain-mismatch/pom.xml new file mode 100644 index 000000000..ea5c00f33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/toolchain-mismatch/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/toolchain-mismatch/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/toolchain-mismatch/postbuild.bsh new file mode 100644 index 000000000..d2e394e1d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/src/it/toolchain-mismatch/postbuild.bsh @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// create touch file so that the parent build can verify whether this build was executed +File touchFile = new File( basedir, "target/touch.txt" ); +System.out.println( "Creating touch file: " + touchFile ); +touchFile.getParentFile().mkdirs(); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/verify.groovy new file mode 100644 index 000000000..68eb51e86 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-conditions/verify.groovy @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def FS = System.getProperty('file.separator') + +assert new File(basedir, 'target/its/jre-version-match/build.log').exists() +assert !(new File(basedir, 'target/its/jre-version-mismatch/build.log').exists()) +assert new File(basedir, 'target/its/maven-version-match/build.log').exists() +assert !(new File(basedir, 'target/its/maven-version-mismatch/build.log').exists()) +assert new File(basedir, 'target/its/os-family-match/build.log').exists() +assert !(new File(basedir, 'target/its/os-family-mismatch/build.log').exists()) +assert !(new File(basedir, 'target/its/toolchain-mismatch/build.log').exists()) + +def log = new File( basedir, 'build.log').text + +assert log.contains("jre-version-match${FS}pom.xml ........................ SUCCESS") +assert log.contains("jre-version-mismatch${FS}pom.xml ..................... SKIPPED due to JRE version") +assert log.contains("maven-version-match${FS}pom.xml ...................... SUCCESS") +assert log.contains("maven-version-mismatch${FS}pom.xml ................... SKIPPED due to Maven version") +assert log.contains("os-family-match${FS}pom.xml .......................... SUCCESS") +assert log.contains("os-family-mismatch${FS}pom.xml ....................... SKIPPED due to OS") +assert log.contains("toolchain-mismatch${FS}pom.xml ....................... SKIPPED due to Toolchain") \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/pom.xml new file mode 100644 index 000000000..c3be520d8 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/pom.xml @@ -0,0 +1,68 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + selector-scripts + 1.0-SNAPSHOT + jar + + Test to check for selection of builds based on scripted conditions. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + ${project.build.directory}/its + true + + */pom.xml + + selector + true + postbuild + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/setup.groovy b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/setup.groovy new file mode 100644 index 000000000..ac7811587 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/setup.groovy @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.commons.io.FileUtils + +// Previous potential target 'content' has impact on IT execution +// (Some new file should be created by verify.sh) +FileUtils.deleteQuietly( new File( basedir, "target/invoker-reports" ) ); +FileUtils.deleteQuietly( new File( basedir, "src/it/script-ret-quiet/target" ) ); +FileUtils.deleteQuietly( new File( basedir, "src/it/script-ret-true/target" ) ); +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-false/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-false/pom.xml new file mode 100644 index 000000000..ea5c00f33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-false/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-false/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-false/postbuild.bsh new file mode 100644 index 000000000..d2e394e1d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-false/postbuild.bsh @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// create touch file so that the parent build can verify whether this build was executed +File touchFile = new File( basedir, "target/touch.txt" ); +System.out.println( "Creating touch file: " + touchFile ); +touchFile.getParentFile().mkdirs(); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-false/selector.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-false/selector.bsh new file mode 100644 index 000000000..6244a5179 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-false/selector.bsh @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +return false; diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-other/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-other/pom.xml new file mode 100644 index 000000000..ea5c00f33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-other/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-other/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-other/postbuild.bsh new file mode 100644 index 000000000..d2e394e1d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-other/postbuild.bsh @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// create touch file so that the parent build can verify whether this build was executed +File touchFile = new File( basedir, "target/touch.txt" ); +System.out.println( "Creating touch file: " + touchFile ); +touchFile.getParentFile().mkdirs(); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-other/selector.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-other/selector.bsh new file mode 100644 index 000000000..7c7b48730 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-other/selector.bsh @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +return "Some thing"; diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-quiet/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-quiet/pom.xml new file mode 100644 index 000000000..ea5c00f33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-quiet/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-quiet/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-quiet/postbuild.bsh new file mode 100644 index 000000000..d2e394e1d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-quiet/postbuild.bsh @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// create touch file so that the parent build can verify whether this build was executed +File touchFile = new File( basedir, "target/touch.txt" ); +System.out.println( "Creating touch file: " + touchFile ); +touchFile.getParentFile().mkdirs(); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-quiet/selector.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-quiet/selector.bsh new file mode 100644 index 000000000..d239ceaaa --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-quiet/selector.bsh @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-true/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-true/pom.xml new file mode 100644 index 000000000..ea5c00f33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-true/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-true/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-true/postbuild.bsh new file mode 100644 index 000000000..feffcae60 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-true/postbuild.bsh @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// create touch file so that the parent build can verify whether this build was executed +File touchFile = new File( basedir, "target/touch.txt" ); +System.out.println( "Creating touch file: " + touchFile ); +touchFile.getParentFile().mkdirs(); +touchFile.createNewFile(); +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-true/selector.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-true/selector.bsh new file mode 100644 index 000000000..5c1254a96 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-ret-true/selector.bsh @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-throw/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-throw/pom.xml new file mode 100644 index 000000000..ea5c00f33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-throw/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + test + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-throw/postbuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-throw/postbuild.bsh new file mode 100644 index 000000000..d2e394e1d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-throw/postbuild.bsh @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// create touch file so that the parent build can verify whether this build was executed +File touchFile = new File( basedir, "target/touch.txt" ); +System.out.println( "Creating touch file: " + touchFile ); +touchFile.getParentFile().mkdirs(); +touchFile.createNewFile(); diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-throw/selector.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-throw/selector.bsh new file mode 100644 index 000000000..9ee8f9fd2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/src/it/script-throw/selector.bsh @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +throw new NullPointerException( "Bite me" ); diff --git a/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/verify.bsh new file mode 100644 index 000000000..422b5d926 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/selector-scripts/verify.bsh @@ -0,0 +1,115 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +import org.codehaus.plexus.util.*; + +try +{ + String[] expected = { + "target/its/script-ret-true/target/touch.txt", + "target/its/script-ret-quiet/target/touch.txt", + }; + for ( String file : expected ) + { + File touchFile = new File( basedir, file ); + System.out.println( "Checking for existence of: " + touchFile ); + if ( !touchFile.isFile() ) + { + System.out.println( "FAILED!" ); + return false; + } + } + + String[] unexpected = { + "target/its/script-ret-false/target/touch.txt", + "target/its/script-ret-other/target/touch.txt", + "target/its/script-throws/target/touch.txt", + }; + for ( String file : unexpected ) + { + File touchFile = new File( basedir, file ); + System.out.println( "Checking for absence of: " + touchFile ); + if ( touchFile.exists() ) + { + System.out.println( file + " should not be here -> FAILED!" ); + return false; + } + } + + String[] success = { + "target/invoker-reports/BUILD-script-ret-true.xml", + "target/invoker-reports/BUILD-script-ret-quiet.xml", + }; + for ( String file : success ) + { + File resultFile = new File( basedir, file ); + System.out.println( "Checking build result: " + resultFile ); + String xml = FileUtils.fileRead( resultFile, "UTF-8" ); + if ( xml.indexOf("result=\"success\"") < 0 && xml.indexOf("result='success'") < 0 ) + { + System.out.println( resultFile + " not success -> FAILED!" ); + return false; + } + } + + String[] skipped = { + "target/invoker-reports/BUILD-script-ret-false.xml", + "target/invoker-reports/BUILD-script-ret-other.xml", + }; + for ( String file : skipped ) + { + File resultFile = new File( basedir, file ); + System.out.println( "Checking build result: " + resultFile ); + String xml = FileUtils.fileRead( resultFile, "UTF-8" ); + if ( xml.indexOf("result=\"skipped\"") < 0 && xml.indexOf("result='skipped'") < 0 ) + { + System.out.println( resultFile + " not skipped -> FAILED!" ); + return false; + } + } + + + String[] inerror = { + "target/invoker-reports/BUILD-script-throw.xml", + }; + for ( String file : inerror ) + { + File resultFile = new File( basedir, file ); + System.out.println( "Checking build result: " + resultFile ); + String xml = FileUtils.fileRead( resultFile, "UTF-8" ); + if ( xml.indexOf("result=\"error\"") < 0 && xml.indexOf("result='error'") < 0 ) + { + System.out.println( resultFile + " not failed -> FAILED!" ); + return false; + } + } + + +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-auto-exclude/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-auto-exclude/pom.xml new file mode 100644 index 000000000..c3491c687 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-auto-exclude/pom.xml @@ -0,0 +1,74 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + settings-auto-exclude + 1.0-SNAPSHOT + pom + + + Test to check that the custom settings.xml is automatically excluded from the project scanner. This is a convenience + feature to support the following common directory layout + src/it/ + project1/ + project2/ + settings.xml + in combination with the POM include pattern "*" required to select POM-less directories. Without excluding settings.xml, + it would be considered a POM and cause a build failure. + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + + + * + + src/it/settings.xml + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-auto-exclude/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-auto-exclude/src/it/project/pom.xml new file mode 100644 index 000000000..dfa58edf5 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-auto-exclude/src/it/project/pom.xml @@ -0,0 +1,32 @@ + + + + + + 4.0.0 + test + project + 0.1-SNAPSHOT + pom + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-auto-exclude/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-auto-exclude/src/it/settings.xml new file mode 100644 index 000000000..79c5dc163 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-auto-exclude/src/it/settings.xml @@ -0,0 +1,55 @@ + + + + + + + + it-repo + + true + + + + local.central + file://@localRepository@ + + true + + + true + + + + + + local.central + file://@localRepository@ + + true + + + true + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-inherit/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/settings-inherit/invoker.properties new file mode 100644 index 000000000..08b641652 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-inherit/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# See https://issues.apache.org/jira/browse/MNG-5224 +invoker.maven.version = 3.0-,3.0.4+ diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-inherit/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-inherit/pom.xml new file mode 100644 index 000000000..068063d1b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-inherit/pom.xml @@ -0,0 +1,63 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + settings-inherit + 1.0-SNAPSHOT + pom + + Test to check that the settings.xml from the calling process is inherited. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + ${project.build.directory}/it + true + true + + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-inherit/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-inherit/src/it/project/pom.xml new file mode 100644 index 000000000..a367a642c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-inherit/src/it/project/pom.xml @@ -0,0 +1,64 @@ + + + + + + 4.0.0 + test + project + 0.1-SNAPSHOT + pom + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.0.1 + + + enforce-property + + enforce + + + + + it.settings-inherit + Property not present - settings.xml from calling process not inherited! + (exists)$ + + + true + + + ${https.protocols} + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/invoker.properties new file mode 100644 index 000000000..08b641652 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# See https://issues.apache.org/jira/browse/MNG-5224 +invoker.maven.version = 3.0-,3.0.4+ diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/pom.xml new file mode 100644 index 000000000..fe7c2aec6 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/pom.xml @@ -0,0 +1,64 @@ + + + + + + 4.0.0 + org.apache.maven.plugins.invoker.its + settings-merge-multiexecutions + 1.0-SNAPSHOT + pom + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + ${project.build.directory}/it + src/it/settings.xml + true + + + ${https.protocols} + + + + + first-run + initialize + + run + + + + second-run + initialize + + run + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/src/it/minvoker-133/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/src/it/minvoker-133/pom.xml new file mode 100644 index 000000000..b5c29179d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/src/it/minvoker-133/pom.xml @@ -0,0 +1,28 @@ + + + + + + 4.0.0 + test + minvoker-133 + 1.0-SNAPSHOT + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/src/it/settings.xml new file mode 100644 index 000000000..d403dfe20 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-merge-multiexecutions/src/it/settings.xml @@ -0,0 +1,55 @@ + + + + + + + + it-repo + + true + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-merge/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/settings-merge/invoker.properties new file mode 100644 index 000000000..95855c7b1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-merge/invoker.properties @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# See https://issues.apache.org/jira/browse/MNG-5224 +invoker.maven.version = 3.0-,3.0.4+ +invoker.java.version = 9- \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-merge/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-merge/pom.xml new file mode 100644 index 000000000..c7b89c6ad --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-merge/pom.xml @@ -0,0 +1,65 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + settings-merge + 1.0-SNAPSHOT + pom + + Test to check that the settings.xml from the calling process is merged with the + one specified for m-invoker-p. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + ${project.build.directory}/it + true + src/it/settings.xml + true + + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-merge/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-merge/src/it/project/pom.xml new file mode 100644 index 000000000..d82048e71 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-merge/src/it/project/pom.xml @@ -0,0 +1,87 @@ + + + + + + 4.0.0 + test + project + 0.1-SNAPSHOT + pom + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.0.1 + + + verify-properties + + enforce + + + + + it.settings-merge.1 + Property not present - settings.xml from calling process not merged! + (exists)$ + + + it.settings-merge.2 + Property not present - specified settings.xml not merged! + (exists)$ + + + true + + + + + + org.codehaus.gmaven + gmaven-plugin + 1.4 + + + verify-server + validate + + execute + + + + def server = settings.servers.find{ it.id.equals('dummy-it-settings-merge') } + if( !server.password.equals('overridden') ) + throw new org.apache.maven.plugin.MojoExecutionException("Incorrect server password - specified settings.xml not merged/dominant") + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-merge/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-merge/src/it/settings.xml new file mode 100644 index 000000000..13266270e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-merge/src/it/settings.xml @@ -0,0 +1,42 @@ + + + + + + + + dummy-it-settings-merge + user + overridden + + + + + + it-properties + + true + + + exists + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/invoker.properties new file mode 100644 index 000000000..08b641652 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# See https://issues.apache.org/jira/browse/MNG-5224 +invoker.maven.version = 3.0-,3.0.4+ diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/pom.xml new file mode 100644 index 000000000..9bc0316bf --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/pom.xml @@ -0,0 +1,65 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + settings-merge + 1.0-SNAPSHOT + pom + + Test to check that the settings.xml from the calling process is merged with the + one specified for m-invoker-p. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + ${project.build.directory}/it + true + src/it/settings.xml + true + + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/src/it/project/pom.xml new file mode 100644 index 000000000..da45fb5e0 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/src/it/project/pom.xml @@ -0,0 +1,84 @@ + + + + + + 4.0.0 + test + project + 0.1-SNAPSHOT + pom + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.0.1 + + + verify-properties + + enforce + + + + + it.settings-merge.1 + Property not present - settings.xml from calling process not merged! + (exists)$ + + + it.settings-merge.2 + Property not present - specified settings.xml not merged! + (exists)$ + + + true + + + + + + org.apache.maven.plugins + maven-help-plugin + 2.2 + + + effective-settings + validate + + effective-settings + + + effective-settings.xml + true + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/src/it/project/postbuild.groovy b/Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/src/it/project/postbuild.groovy new file mode 100644 index 000000000..19f538510 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/src/it/project/postbuild.groovy @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File effectiveSettings = new File( basedir, "effective-settings.xml" ) +assert effectiveSettings.isFile() + +def settings = new XmlSlurper().parse( effectiveSettings ) +def server = settings.servers.server.find{ it.id.equals('dummy-it-settings-merge') } + +if( !server.password.equals('overridden') ) + throw new org.apache.maven.plugin.MojoExecutionException("Incorrect server password - specified settings.xml not merged/dominant " + server.password) diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/src/it/settings.xml new file mode 100644 index 000000000..00aee93e2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-merge_jdk9+/src/it/settings.xml @@ -0,0 +1,42 @@ + + + + + + + + dummy-it-settings-merge + user + overridden + + + + + + it-properties + + true + + + exists + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-override/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/settings-override/invoker.properties new file mode 100644 index 000000000..08b641652 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-override/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# See https://issues.apache.org/jira/browse/MNG-5224 +invoker.maven.version = 3.0-,3.0.4+ diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-override/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-override/pom.xml new file mode 100644 index 000000000..b082fa088 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-override/pom.xml @@ -0,0 +1,63 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + settings-merge + 1.0-SNAPSHOT + pom + + Test to check that the settings.xml from the calling process is merged with the + one specified for m-invoker-p. + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + src/it/settings.xml + true + + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/project/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/project/invoker.properties new file mode 100644 index 000000000..6ec72bdcd --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/project/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.settingsFile =src/it/settings-override.xml \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/project/pom.xml new file mode 100644 index 000000000..d21857d3b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/project/pom.xml @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + test + project + 0.1-SNAPSHOT + pom + + + UTF-8 + true + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.0.1 + + + verify-properties + + enforce + + + + + + ${enforcer.fail} + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/project/postbuild.groovy b/Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/project/postbuild.groovy new file mode 100644 index 000000000..4b30e4644 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/project/postbuild.groovy @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File interpolatedCustomSettings = new File( basedir, "../interpolated-settings-override.xml" ) +assert interpolatedCustomSettings.isFile() diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/settings-override.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/settings-override.xml new file mode 100644 index 000000000..6c916e42f --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/settings-override.xml @@ -0,0 +1,34 @@ + + + + + + + + it-properties + + true + + + false + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/settings.xml new file mode 100644 index 000000000..a2d26c432 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings-override/src/it/settings.xml @@ -0,0 +1,34 @@ + + + + + + + + it-properties + + true + + + true + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/settings.xml b/Java-base/maven-invoker-plugin/src/src/it/settings.xml new file mode 100644 index 000000000..842301e5c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/settings.xml @@ -0,0 +1,94 @@ + + + + + + + + + dummy-it-settings-merge + user + password + + + + + + it-repo + + true + + + + @localRepository@ + + exists + + exists + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + apache.snapshots + Apache Snapshot Repository + http://repository.apache.org/content/groups/snapshots-group/ + + false + + + true + + + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + apache.snapshots + Apache Snapshot Repository + http://repository.apache.org/content/groups/snapshots-group/ + + false + + + true + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/skip-install/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/skip-install/pom.xml new file mode 100644 index 000000000..f82147e2b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/skip-install/pom.xml @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + skip-install + 1.0-SNAPSHOT + pom + + Test to check that invoker.skip=true will skip all installations + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + ${project.build.directory}/it-repo + + + + integration-test + initialize + + install + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/skip-install/test.properties b/Java-base/maven-invoker-plugin/src/src/it/skip-install/test.properties new file mode 100644 index 000000000..55c971273 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/skip-install/test.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# NOTE: Skipping from the CLI is the primary use case so we prefer the system property over the direct POM configuration +invoker.skip = true diff --git a/Java-base/maven-invoker-plugin/src/src/it/skip-install/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/skip-install/verify.bsh new file mode 100644 index 000000000..6e7049b7f --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/skip-install/verify.bsh @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +File itRepoDir = new File( basedir, "target/it-repo" ); +System.out.println( "Checking for absence of: " + itRepoDir ); +if ( itRepoDir.isDirectory() ) +{ + throw new IllegalStateException( "Creation of staging repository was not skipped: " + itRepoDir ); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/skip-run/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/skip-run/pom.xml new file mode 100644 index 000000000..c09f1802c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/skip-run/pom.xml @@ -0,0 +1,66 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker + skip-run + 1.0-SNAPSHOT + pom + + Test to check that invoker.skip=true will skip all invocations + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + true + true + ${project.build.directory}/it + + */pom.xml + + + validate + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/skip-run/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/skip-run/src/it/project/pom.xml new file mode 100644 index 000000000..584300c98 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/skip-run/src/it/project/pom.xml @@ -0,0 +1,33 @@ + + + + + + + 99.0.0 + test + skip-invoker + 0.1-SNAPSHOT + jar + + + UTF-8 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/skip-run/src/it/project/prebuild.bsh b/Java-base/maven-invoker-plugin/src/src/it/skip-run/src/it/project/prebuild.bsh new file mode 100644 index 000000000..7391f5a33 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/skip-run/src/it/project/prebuild.bsh @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; + +// marker for parent build that this sub build was indeed run +File touchFile = new File( basedir, "touch.txt" ); +touchFile.createNewFile(); + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/skip-run/test.properties b/Java-base/maven-invoker-plugin/src/src/it/skip-run/test.properties new file mode 100644 index 000000000..55c971273 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/skip-run/test.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# NOTE: Skipping from the CLI is the primary use case so we prefer the system property over the direct POM configuration +invoker.skip = true diff --git a/Java-base/maven-invoker-plugin/src/src/it/skip-run/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/skip-run/verify.bsh new file mode 100644 index 000000000..718cf1f71 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/skip-run/verify.bsh @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + // make sure the Invoker Plugin was indeed NOT run and the build didn't fail somewhere else + File touchFile = new File( basedir, "target/it/project/touch.txt" ); + System.out.println( "Checking for non-existence of touch file: " + touchFile ); + if ( touchFile.exists() ) + { + System.out.println( "FAILED!" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/invoker.properties new file mode 100644 index 000000000..800365493 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = verify +invoker.os.family = !windows \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/pom.xml new file mode 100644 index 000000000..03e816359 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/pom.xml @@ -0,0 +1,68 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker.its + basedir-with-spaces + 1.0-SNAPSHOT + pom + + + + Test to check for usage of spaces in folder names. + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + + validate + + verify + + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/setup.groovy b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/setup.groovy new file mode 100644 index 000000000..829476f77 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/setup.groovy @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.util.* +import java.util.regex.* +import org.apache.commons.io.FileUtils + +File srcIt = new File (basedir, "src/it"); +File originalFolder = new File (srcIt, "minvoker-test"); +File destinationFolder = new File(srcIt, "test-\u00c9\u00e9\u00ea- & -\u00c9\u00e9\u00ea-test"); +FileUtils.deleteQuietly(destinationFolder); +// rename old one into new one with special characters. +if (!originalFolder.renameTo(destinationFolder)) { + throw new IOException("Rename didn't work.") +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/src/it/minvoker-test/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/src/it/minvoker-test/invoker.properties new file mode 100644 index 000000000..ccf4abf3e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/src/it/minvoker-test/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.debug = true +invoker.goals = verify diff --git a/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/src/it/minvoker-test/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/src/it/minvoker-test/pom.xml new file mode 100644 index 000000000..fc1577ca2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/src/it/minvoker-test/pom.xml @@ -0,0 +1,54 @@ + + + + + + 4.0.0 + org.apache.maven.plugins.invoker.its + minvoker-142 + 0.1-SNAPSHOT + pom + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.1.1 + + + + enforce + + + + + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/src/it/minvoker-test/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/src/it/minvoker-test/verify.groovy new file mode 100644 index 000000000..066f05d26 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_non-windows/src/it/minvoker-test/verify.groovy @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +File buildLog = new File( basedir, 'build.log' ) + +// if one of criteria matches +if( buildLog.exists() ) +{ + assert buildLog.text.contains( '[DEBUG] Executing rule: org.apache.maven.plugins.enforcer.AlwaysPass' ) +} + diff --git a/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/invoker.properties new file mode 100644 index 000000000..a7333d4ad --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/invoker.properties @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = verify +invoker.os.family = windows +invoker.maven.version = 3.5.0+ \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/pom.xml new file mode 100644 index 000000000..e111e1e3e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/pom.xml @@ -0,0 +1,64 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker.its + basedir-with-spaces + 1.0-SNAPSHOT + pom + + + + Test to check for usage of spaces in folder names. + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + + validate + + verify + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/setup.groovy b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/setup.groovy new file mode 100644 index 000000000..829476f77 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/setup.groovy @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.util.* +import java.util.regex.* +import org.apache.commons.io.FileUtils + +File srcIt = new File (basedir, "src/it"); +File originalFolder = new File (srcIt, "minvoker-test"); +File destinationFolder = new File(srcIt, "test-\u00c9\u00e9\u00ea- & -\u00c9\u00e9\u00ea-test"); +FileUtils.deleteQuietly(destinationFolder); +// rename old one into new one with special characters. +if (!originalFolder.renameTo(destinationFolder)) { + throw new IOException("Rename didn't work.") +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/src/it/minvoker-test/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/src/it/minvoker-test/invoker.properties new file mode 100644 index 000000000..ccf4abf3e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/src/it/minvoker-test/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.debug = true +invoker.goals = verify diff --git a/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/src/it/minvoker-test/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/src/it/minvoker-test/pom.xml new file mode 100644 index 000000000..fc1577ca2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/src/it/minvoker-test/pom.xml @@ -0,0 +1,54 @@ + + + + + + 4.0.0 + org.apache.maven.plugins.invoker.its + minvoker-142 + 0.1-SNAPSHOT + pom + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.1.1 + + + + enforce + + + + + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/src/it/minvoker-test/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/src/it/minvoker-test/verify.groovy new file mode 100644 index 000000000..066f05d26 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/spaces-should-work_windows/src/it/minvoker-test/verify.groovy @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +File buildLog = new File( basedir, 'build.log' ) + +// if one of criteria matches +if( buildLog.exists() ) +{ + assert buildLog.text.contains( '[DEBUG] Executing rule: org.apache.maven.plugins.enforcer.AlwaysPass' ) +} + diff --git a/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/invoker.properties new file mode 100644 index 000000000..353946b69 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = verify diff --git a/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/pom.xml new file mode 100644 index 000000000..b5ecd4679 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/pom.xml @@ -0,0 +1,68 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker.its + accents-debug + 1.0-SNAPSHOT + pom + + + Test to check for usage of accents in folder names. + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + + validate + + false + verify + + + ${https.protocols} + + + + + integration-test + initialize + + run + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/setup.groovy b/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/setup.groovy new file mode 100644 index 000000000..85f8a9826 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/setup.groovy @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.* +import java.util.* +import java.util.regex.* +import org.apache.commons.io.FileUtils + +File srcIt = new File (basedir, "src/it"); +File originalFolder = new File (srcIt, "minvoker-test"); +File destinationFolder = new File(srcIt, "test-\u00c9\u00e9\u00ea-more-\u00c9\u00e9\u00ea-test"); +FileUtils.deleteQuietly(destinationFolder); +// rename old one into new one with special characters. +if (!originalFolder.renameTo(destinationFolder)) { + throw new IOException("Rename didn't work.") +} diff --git a/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/src/it/minvoker-test/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/src/it/minvoker-test/invoker.properties new file mode 100644 index 000000000..ccf4abf3e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/src/it/minvoker-test/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.debug = true +invoker.goals = verify diff --git a/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/src/it/minvoker-test/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/src/it/minvoker-test/pom.xml new file mode 100644 index 000000000..fc1577ca2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/src/it/minvoker-test/pom.xml @@ -0,0 +1,54 @@ + + + + + + 4.0.0 + org.apache.maven.plugins.invoker.its + minvoker-142 + 0.1-SNAPSHOT + pom + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.1.1 + + + + enforce + + + + + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/src/it/minvoker-test/verify.groovy b/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/src/it/minvoker-test/verify.groovy new file mode 100644 index 000000000..417a89ef5 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/special-characters-should-work/src/it/minvoker-test/verify.groovy @@ -0,0 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.text.contains( '[DEBUG] Executing rule: org.apache.maven.plugins.enforcer.AlwaysPass' ) \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/invoker.properties new file mode 100644 index 000000000..353946b69 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = verify diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/pom.xml new file mode 100644 index 000000000..0c4a272d1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/pom.xml @@ -0,0 +1,100 @@ + + + + + + 4.0.0 + + test + staging-dependencies + 1.0-SNAPSHOT + + + Test to check for staging of (runtime) dependencies directly from local repository (MINVOKER-64, MINVOKER-70). + + + + + + junit + junit + 3.8.2 + + + + org.apache.maven.its + minvoker-70 + 1.0-SNAPSHOT + + + + org.apache.maven.its + pom + 0.3-SNAPSHOT + pom + + + + org.apache.maven.its + dep + 1.0 + tests + + + org.apache.maven.its + dep + 2.0 + + + + + + maven-invoker-plugin-it + file:///${basedir}/repo + + ignore + + + ignore + + + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + ${project.build.directory}/it-repo + + + + integration-test + + install + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/1.0/dep-1.0-tests.jar b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/1.0/dep-1.0-tests.jar new file mode 100644 index 0000000000000000000000000000000000000000..264c8805469a509ede6464e14d00d1317c5e7ee5 GIT binary patch literal 345 zcmWIWW@Zs#-~d9`ogtPCNPv@pg~8V~#8KDN&rSc|DFy~+h5&DN4v-2asImZ@nni#r z;F^6M{XE@VgG2Ou-9G!CIql=Et9OytTUYDcne&^246YbIcv__A<*VcAd$DvC3+IfN zl1HRxXlJlYf2R2(O-=l%c(~Z~CC|jPE1s#o&iqvLv4|1u5aB7&H{5~NfN+2}Ba;XN vsy|?k1o;CMz#Rti6}nbrV?n+^09zmvt`*5o0p6@^AXQ92SPP_&fjA5RpHf9Q literal 0 HcmV?d00001 diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/1.0/dep-1.0.pom b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/1.0/dep-1.0.pom new file mode 100644 index 000000000..f14ec2704 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/1.0/dep-1.0.pom @@ -0,0 +1,8 @@ + + + 4.0.0 + org.apache.maven.its + dep + jar + 1.0 + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/2.0/dep-2.0.jar b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/2.0/dep-2.0.jar new file mode 100644 index 0000000000000000000000000000000000000000..264c8805469a509ede6464e14d00d1317c5e7ee5 GIT binary patch literal 345 zcmWIWW@Zs#-~d9`ogtPCNPv@pg~8V~#8KDN&rSc|DFy~+h5&DN4v-2asImZ@nni#r z;F^6M{XE@VgG2Ou-9G!CIql=Et9OytTUYDcne&^246YbIcv__A<*VcAd$DvC3+IfN zl1HRxXlJlYf2R2(O-=l%c(~Z~CC|jPE1s#o&iqvLv4|1u5aB7&H{5~NfN+2}Ba;XN vsy|?k1o;CMz#Rti6}nbrV?n+^09zmvt`*5o0p6@^AXQ92SPP_&fjA5RpHf9Q literal 0 HcmV?d00001 diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/2.0/dep-2.0.pom b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/2.0/dep-2.0.pom new file mode 100644 index 000000000..f49790185 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/2.0/dep-2.0.pom @@ -0,0 +1,8 @@ + + + 4.0.0 + org.apache.maven.its + dep + jar + 2.0 + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/maven-metadata.xml b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/maven-metadata.xml new file mode 100644 index 000000000..c4c0303f6 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/dep/maven-metadata.xml @@ -0,0 +1,34 @@ + + + + + + org.apache.maven.its + dep + + 2.0 + 2.0 + + 1.0 + 2.0 + + 20081020164906 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/maven-metadata.xml b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/maven-metadata.xml new file mode 100644 index 000000000..ed2257db3 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,33 @@ + + + + + + org.apache.maven.its + minvoker-70 + 1.0-SNAPSHOT + + + 20081020.164906 + 1 + + 20081020164906 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-20081020.164906-1.jar b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-20081020.164906-1.jar new file mode 100644 index 0000000000000000000000000000000000000000..264c8805469a509ede6464e14d00d1317c5e7ee5 GIT binary patch literal 345 zcmWIWW@Zs#-~d9`ogtPCNPv@pg~8V~#8KDN&rSc|DFy~+h5&DN4v-2asImZ@nni#r z;F^6M{XE@VgG2Ou-9G!CIql=Et9OytTUYDcne&^246YbIcv__A<*VcAd$DvC3+IfN zl1HRxXlJlYf2R2(O-=l%c(~Z~CC|jPE1s#o&iqvLv4|1u5aB7&H{5~NfN+2}Ba;XN vsy|?k1o;CMz#Rti6}nbrV?n+^09zmvt`*5o0p6@^AXQ92SPP_&fjA5RpHf9Q literal 0 HcmV?d00001 diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-20081020.164906-1.pom b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-20081020.164906-1.pom new file mode 100644 index 000000000..61bbf6d4e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-20081020.164906-1.pom @@ -0,0 +1,12 @@ + + + 4.0.0 + + org.apache.maven.its + parent-b + 0.1-SNAPSHOT + + minvoker-70 + jar + 1.0-SNAPSHOT + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/maven-metadata.xml b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/maven-metadata.xml new file mode 100644 index 000000000..88d46d19e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/maven-metadata.xml @@ -0,0 +1,32 @@ + + + + + + org.apache.maven.its + minvoker-70 + 1.0-SNAPSHOT + + + 1.0-SNAPSHOT + + 20081020164906 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-a/0.1-SNAPSHOT/maven-metadata.xml b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-a/0.1-SNAPSHOT/maven-metadata.xml new file mode 100644 index 000000000..53d8c322c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-a/0.1-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,33 @@ + + + + + + org.apache.maven.its + parent-a + 0.1-SNAPSHOT + + + 20081020.164906 + 1 + + 20081020164906 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-a/0.1-SNAPSHOT/parent-a-0.1-20081020.164906-1.pom b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-a/0.1-SNAPSHOT/parent-a-0.1-20081020.164906-1.pom new file mode 100644 index 000000000..c74bf4f2c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-a/0.1-SNAPSHOT/parent-a-0.1-20081020.164906-1.pom @@ -0,0 +1,8 @@ + + + 4.0.0 + org.apache.maven.its + parent-a + pom + 0.1-SNAPSHOT + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-b/0.1-SNAPSHOT/maven-metadata.xml b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-b/0.1-SNAPSHOT/maven-metadata.xml new file mode 100644 index 000000000..854ca1c22 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-b/0.1-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,33 @@ + + + + + + org.apache.maven.its + parent-b + 0.1-SNAPSHOT + + + 20081020.164906 + 1 + + 20081020164906 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-b/0.1-SNAPSHOT/parent-b-0.1-20081020.164906-1.pom b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-b/0.1-SNAPSHOT/parent-b-0.1-20081020.164906-1.pom new file mode 100644 index 000000000..78fd42453 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/parent-b/0.1-SNAPSHOT/parent-b-0.1-20081020.164906-1.pom @@ -0,0 +1,12 @@ + + + 4.0.0 + + org.apache.maven.its + parent-a + 0.1-SNAPSHOT + + parent-b + pom + 0.1-SNAPSHOT + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/pom/0.3-SNAPSHOT/maven-metadata.xml b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/pom/0.3-SNAPSHOT/maven-metadata.xml new file mode 100644 index 000000000..066d9e84c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/pom/0.3-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,33 @@ + + + + + + org.apache.maven.its + pom + 0.3-SNAPSHOT + + + 20081020.164906 + 1 + + 20081020164906 + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/pom/0.3-SNAPSHOT/pom-0.3-20081020.164906-1.pom b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/pom/0.3-SNAPSHOT/pom-0.3-20081020.164906-1.pom new file mode 100644 index 000000000..3404c35b0 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/repo/org/apache/maven/its/pom/0.3-SNAPSHOT/pom-0.3-20081020.164906-1.pom @@ -0,0 +1,8 @@ + + + 4.0.0 + org.apache.maven.its + pom + pom + 0.3-SNAPSHOT + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/verify.bsh new file mode 100644 index 000000000..3495e4809 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-dependencies/verify.bsh @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +import org.codehaus.plexus.util.*; +import org.codehaus.plexus.util.xml.*; + +try +{ + File itRepoDir = new File( basedir, "target/it-repo" ); + System.out.println( "Checking for existence of: " + itRepoDir ); + if ( !itRepoDir.isDirectory() ) + { + System.out.println( "FAILED!" ); + return false; + } + + String[] files = { + "junit/junit/3.8.2/junit-3.8.2.pom", + "junit/junit/3.8.2/junit-3.8.2.jar", + "junit/junit/maven-metadata-local.xml", + "org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-SNAPSHOT.pom", + "org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-SNAPSHOT.jar", + "org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/maven-metadata-local.xml", + "org/apache/maven/its/minvoker-70/maven-metadata-local.xml", + "org/apache/maven/its/parent-b/0.1-SNAPSHOT/parent-b-0.1-SNAPSHOT.pom", + "org/apache/maven/its/parent-b/0.1-SNAPSHOT/maven-metadata-local.xml", + "org/apache/maven/its/parent-b/maven-metadata-local.xml", + "org/apache/maven/its/parent-a/0.1-SNAPSHOT/parent-a-0.1-SNAPSHOT.pom", + "org/apache/maven/its/parent-a/0.1-SNAPSHOT/maven-metadata-local.xml", + "org/apache/maven/its/parent-a/maven-metadata-local.xml", + "org/apache/maven/its/pom/0.3-SNAPSHOT/pom-0.3-SNAPSHOT.pom", + "org/apache/maven/its/pom/0.3-SNAPSHOT/maven-metadata-local.xml", + "org/apache/maven/its/pom/maven-metadata-local.xml", + "org/apache/maven/its/dep/1.0/dep-1.0.pom", + "org/apache/maven/its/dep/1.0/dep-1.0-tests.jar", + "org/apache/maven/its/dep/2.0/dep-2.0.pom", + "org/apache/maven/its/dep/2.0/dep-2.0.jar", + "org/apache/maven/its/dep/maven-metadata-local.xml", + }; + for ( String file : files ) + { + File stagedFile = new File( itRepoDir, file ); + System.out.println( "Checking for existence of: " + stagedFile ); + if ( !stagedFile.isFile() ) + { + throw new IllegalStateException( "Missing: " + stagedFile ); + } + } + + Reader reader = ReaderFactory.newXmlReader( new File( itRepoDir, "org/apache/maven/its/dep/maven-metadata-local.xml" ) ); + Xpp3Dom dom = Xpp3DomBuilder.build( reader ); + IOUtil.close( reader ); + + if ( dom.getChild( "versioning" ).getChild( "versions" ).getChildCount() != 2 ) + { + throw new IllegalStateException( "Invalid version number count in metadata" ); + } + + List versions = new ArrayList(); + versions.add( dom.getChild( "versioning" ).getChild( "versions" ).getChild( 0 ).getValue() ); + versions.add( dom.getChild( "versioning" ).getChild( "versions" ).getChild( 1 ).getValue() ); + Collections.sort( versions ); + if ( !versions.equals( Arrays.asList( new String[] { "1.0", "2.0" } ) ) ) + { + throw new IllegalStateException( "Invalid version numbers in metadata: " + versions ); + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-pom/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/staging-pom/invoker.properties new file mode 100644 index 000000000..353946b69 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-pom/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = verify diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-pom/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/staging-pom/pom.xml new file mode 100644 index 000000000..cf39252bc --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-pom/pom.xml @@ -0,0 +1,59 @@ + + + + + + 4.0.0 + + test + pom-packaging + 1.0-SNAPSHOT + pom + + + Test to check for MINVOKER-51, i.e. NPE when packaging is pom. + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @pom.version@ + + ${project.build.directory}/it-repo + + + + integration-test + + install + + + + + + org.apache.maven.plugins + maven-site-plugin + 2.0-beta-7 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-pom/src/site/site.xml b/Java-base/maven-invoker-plugin/src/src/it/staging-pom/src/site/site.xml new file mode 100644 index 000000000..e4c4c48cc --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-pom/src/site/site.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-pom/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/staging-pom/verify.bsh new file mode 100644 index 000000000..8565933f6 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-pom/verify.bsh @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + File itRepoDir = new File( basedir, "target/it-repo" ); + System.out.println( "Checking for existence of: " + itRepoDir ); + if ( !itRepoDir.isDirectory() ) + { + System.out.println( "FAILED!" ); + return false; + } + + String[] files = { + "test/pom-packaging/1.0-SNAPSHOT/pom-packaging-1.0-SNAPSHOT.pom", + }; + for ( String file : files ) + { + File stagedFile = new File( itRepoDir, file ); + System.out.println( "Checking for existence of: " + stagedFile ); + if ( !stagedFile.isFile() ) + { + System.out.println( "FAILED!" ); + return false; + } + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/invoker.properties new file mode 100644 index 000000000..353946b69 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = verify diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod1-parent/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod1-parent/pom.xml new file mode 100644 index 000000000..9b026e607 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod1-parent/pom.xml @@ -0,0 +1,47 @@ + + + + + + 4.0.0 + + test + mod1-parent + 1.0-SNAPSHOT + pom + + + Test to check for proper staging during a multi module build, i.e. artifacts from the reactor need to be considered. + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-site-plugin + 2.0-beta-7 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod1/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod1/pom.xml new file mode 100644 index 000000000..fad9dc45c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod1/pom.xml @@ -0,0 +1,73 @@ + + + + + + 4.0.0 + + + test + mod1-parent + 1.0-SNAPSHOT + ../mod1-parent + + + mod1 + 1.0-SNAPSHOT + jar + + + Test to check for proper staging during a multi module build, i.e. artifacts from the reactor need to be considered. + + + + UTF-8 + + + + + test + mod2 + 1.0-SNAPSHOT + + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + ${project.build.directory}/it-repo + + + + integration-test + + install + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod2/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod2/pom.xml new file mode 100644 index 000000000..0f33056f6 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod2/pom.xml @@ -0,0 +1,59 @@ + + + + + + 4.0.0 + + + test + mod2-parent + 1.0-SNAPSHOT + + + mod2 + 1.0-SNAPSHOT + jar + + + Test to check for proper staging during a multi module build, i.e. artifacts from the reactor need to be considered. + + + + UTF-8 + + + + + + maven-source-plugin + 2.0.4 + + + attach-resources + + jar + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod2/src/main/resources/main.properties b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod2/src/main/resources/main.properties new file mode 100644 index 000000000..00ae6c00d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/mod2/src/main/resources/main.properties @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/pom.xml new file mode 100644 index 000000000..185925a70 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/pom.xml @@ -0,0 +1,52 @@ + + + + + + 4.0.0 + + test + mod2-parent + 1.0-SNAPSHOT + pom + + + Test to check for proper staging during a multi module build, i.e. artifacts from the reactor need to be considered. + + + + mod1 + mod2 + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-site-plugin + 2.0-beta-7 + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/src/site/site.xml b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/src/site/site.xml new file mode 100644 index 000000000..e4c4c48cc --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/src/site/site.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/verify.bsh b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/verify.bsh new file mode 100644 index 000000000..19f6fa831 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/staging-reactor/verify.bsh @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import java.util.*; +import java.util.regex.*; + +try +{ + File itRepoDir = new File( basedir, "mod1/target/it-repo" ); + System.out.println( "Checking for existence of: " + itRepoDir ); + if ( !itRepoDir.isDirectory() ) + { + System.out.println( "FAILED!" ); + return false; + } + + // NOTE: Checking the metadata is included to guard against regression of MINVOKER-43 + String[] files = { + "test/mod1/maven-metadata-local.xml", + "test/mod1/1.0-SNAPSHOT/maven-metadata-local.xml", + "test/mod1/1.0-SNAPSHOT/mod1-1.0-SNAPSHOT.pom", + "test/mod1/1.0-SNAPSHOT/mod1-1.0-SNAPSHOT.jar", + "test/mod1-parent/maven-metadata-local.xml", + "test/mod1-parent/1.0-SNAPSHOT/maven-metadata-local.xml", + "test/mod1-parent/1.0-SNAPSHOT/mod1-parent-1.0-SNAPSHOT.pom", + "test/mod2/maven-metadata-local.xml", + "test/mod2/1.0-SNAPSHOT/maven-metadata-local.xml", + "test/mod2/1.0-SNAPSHOT/mod2-1.0-SNAPSHOT.pom", + "test/mod2/1.0-SNAPSHOT/mod2-1.0-SNAPSHOT.jar", + "test/mod2/1.0-SNAPSHOT/mod2-1.0-SNAPSHOT-sources.jar", + "test/mod2-parent/maven-metadata-local.xml", + "test/mod2-parent/1.0-SNAPSHOT/maven-metadata-local.xml", + "test/mod2-parent/1.0-SNAPSHOT/mod2-parent-1.0-SNAPSHOT.pom", + }; + for ( String file : files ) + { + File stagedFile = new File( itRepoDir, file ); + System.out.println( "Checking for existence of: " + stagedFile ); + if ( !stagedFile.isFile() ) + { + System.out.println( "FAILED!" ); + return false; + } + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/invoker.properties new file mode 100644 index 000000000..353946b69 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = verify diff --git a/Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/pom.xml new file mode 100644 index 000000000..537162790 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/pom.xml @@ -0,0 +1,63 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.invoker.its + maven-wrong-interpolation-test + 0.1-SNAPSHOT + Maven Property Interpolation Test + Maven Invoker tests for property interpolation + + https://issues.apache.org/jira/browse/MINVOKER-194 + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-invoker-plugin + @project.version@ + + ${project.build.directory}/it + verify + + + ${https.protocols} + + + + + + install + run + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/src/it/project/invoker.properties b/Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/src/it/project/invoker.properties new file mode 100644 index 000000000..276151bb3 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/src/it/project/invoker.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.name=wrong property interpolation +invoker.goals=org.apache.maven.plugins:maven-project-info-reports-plugin:2.8:summary help:effective-pom -Doutput=effective-pom.xml diff --git a/Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/src/it/project/pom.xml b/Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/src/it/project/pom.xml new file mode 100644 index 000000000..2cc24eba9 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/it/wrongPropertyInterpolation/src/it/project/pom.xml @@ -0,0 +1,54 @@ + + + + 4.0.0 + org.apache.maven.invoker.its.it + maven-prop-interpolation + 0.1-SNAPSHOT + jar + + 1.3 + 1.3 + + + + + + com.soebes.maven.plugins + echo-maven-plugin + 0.2 + + + package + + echo + + + + + + maven.compiler.source: ${maven.compiler.source} + maven.compiler.target: ${maven.compiler.target} + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java new file mode 100644 index 000000000..deec2ccfe --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java @@ -0,0 +1,2876 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.Model; +import org.apache.maven.model.Profile; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecution; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.invoker.model.BuildJob; +import org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Writer; +import org.apache.maven.project.MavenProject; +import org.apache.maven.settings.Settings; +import org.apache.maven.settings.SettingsUtils; +import org.apache.maven.settings.TrackableBase; +import org.apache.maven.settings.building.DefaultSettingsBuildingRequest; +import org.apache.maven.settings.building.SettingsBuilder; +import org.apache.maven.settings.building.SettingsBuildingException; +import org.apache.maven.settings.building.SettingsBuildingRequest; +import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer; +import org.apache.maven.shared.invoker.CommandLineConfigurationException; +import org.apache.maven.shared.invoker.DefaultInvocationRequest; +import org.apache.maven.shared.invoker.InvocationRequest; +import org.apache.maven.shared.invoker.InvocationResult; +import org.apache.maven.shared.invoker.Invoker; +import org.apache.maven.shared.invoker.MavenCommandLineBuilder; +import org.apache.maven.shared.invoker.MavenInvocationException; +import org.apache.maven.shared.scriptinterpreter.RunErrorException; +import org.apache.maven.shared.scriptinterpreter.RunFailureException; +import org.apache.maven.shared.scriptinterpreter.ScriptRunner; +import org.apache.maven.shared.utils.logging.MessageBuilder; +import org.apache.maven.toolchain.MisconfiguredToolchainException; +import org.apache.maven.toolchain.ToolchainManagerPrivate; +import org.apache.maven.toolchain.ToolchainPrivate; +import org.codehaus.plexus.interpolation.InterpolationException; +import org.codehaus.plexus.interpolation.Interpolator; +import org.codehaus.plexus.interpolation.MapBasedValueSource; +import org.codehaus.plexus.interpolation.RegexBasedInterpolator; +import org.codehaus.plexus.util.DirectoryScanner; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.IOUtil; +import org.codehaus.plexus.util.InterpolationFilterReader; +import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.ReflectionUtils; +import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.WriterFactory; +import org.codehaus.plexus.util.cli.CommandLineException; +import org.codehaus.plexus.util.cli.CommandLineUtils; +import org.codehaus.plexus.util.cli.Commandline; +import org.codehaus.plexus.util.cli.StreamConsumer; +import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.codehaus.plexus.util.xml.Xpp3DomWriter; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.Writer; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.TreeSet; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +import static org.apache.maven.shared.utils.logging.MessageUtils.buffer; + +/** + * Provides common code for mojos invoking sub builds. + * + * @author Stephen Connolly + * @since 15-Aug-2009 09:09:29 + */ +public abstract class AbstractInvokerMojo + extends AbstractMojo +{ + /** + * The zero-based column index where to print the invoker result. + */ + private static final int RESULT_COLUMN = 60; + + /** + * Flag used to suppress certain invocations. This is useful in tailoring the build using profiles. + * + * @since 1.1 + */ + @Parameter( property = "invoker.skip", defaultValue = "false" ) + private boolean skipInvocation; + + /** + * Flag used to suppress the summary output notifying of successes and failures. If set to true, the + * only indication of the build's success or failure will be the effect it has on the main build (if it fails, the + * main build should fail as well). If {@link #streamLogs} is enabled, the sub-build summary will also provide an + * indication. + */ + @Parameter( defaultValue = "false" ) + protected boolean suppressSummaries; + + /** + * Flag used to determine whether the build logs should be output to the normal mojo log. + */ + @Parameter( property = "invoker.streamLogs", defaultValue = "false" ) + private boolean streamLogs; + + /** + * The local repository for caching artifacts. It is strongly recommended to specify a path to an isolated + * repository like ${project.build.directory}/it-repo. Otherwise, your ordinary local repository will + * be used, potentially soiling it with broken artifacts. + */ + @Parameter( property = "invoker.localRepositoryPath", defaultValue = "${settings.localRepository}" ) + private File localRepositoryPath; + + /** + * Directory to search for integration tests. + */ + @Parameter( property = "invoker.projectsDirectory", defaultValue = "${basedir}/src/it/" ) + private File projectsDirectory; + + /** + * Base directory where all build reports are written to. Every execution of an integration test will produce an XML + * file which contains the information about success or failure of that particular build job. The format of the + * resulting XML file is documented in the given build-job reference. + * + * @since 1.4 + */ + @Parameter( property = "invoker.reportsDirectory", defaultValue = "${project.build.directory}/invoker-reports" ) + private File reportsDirectory; + + /** + * A flag to disable the generation of build reports. + * + * @since 1.4 + */ + @Parameter( property = "invoker.disableReports", defaultValue = "false" ) + private boolean disableReports; + + /** + * Directory to which projects should be cloned prior to execution. If set to {@code null}, each integration test + * will be run in the directory in which the corresponding IT POM was found. In this case, you most likely want to + * configure your SCM to ignore target and build.log in the test's base directory. + * + * @since 1.1 + */ + @Parameter( property = "invoker.cloneProjectsTo" ) + private File cloneProjectsTo; + + // CHECKSTYLE_OFF: LineLength + /** + * Some files are normally excluded when copying the IT projects from the directory specified by the parameter + * projectsDirectory to the directory given by cloneProjectsTo (e.g. .svn, CVS, + * *~, etc: see + * reference for full list). Setting this parameter to true will cause all files to be copied to + * the cloneProjectsTo directory. + * + * @since 1.2 + */ + @Parameter( defaultValue = "false" ) + private boolean cloneAllFiles; + // CHECKSTYLE_ON: LineLength + + /** + * Ensure the {@link #cloneProjectsTo} directory is not polluted with files from earlier invoker runs. + * + * @since 1.6 + */ + @Parameter( defaultValue = "true" ) + private boolean cloneClean; + + /** + * A single POM to build, skipping any scanning parameters and behavior. + */ + @Parameter( property = "invoker.pom" ) + private File pom; + + /** + * Include patterns for searching the integration test directory for projects. This parameter is meant to be set + * from the POM. If this parameter is not set, the plugin will search for all pom.xml files one + * directory below {@link #projectsDirectory} (i.e. */pom.xml).
    + *
    + * Starting with version 1.3, mere directories can also be matched by these patterns. For example, the include + * pattern * will run Maven builds on all immediate sub directories of {@link #projectsDirectory}, + * regardless if they contain a pom.xml. This allows to perform builds that need/should not depend on + * the existence of a POM. + */ + @Parameter + private List pomIncludes = Collections.singletonList( "*/pom.xml" ); + + /** + * Exclude patterns for searching the integration test directory. This parameter is meant to be set from the POM. By + * default, no POM files are excluded. For the convenience of using an include pattern like *, the + * custom settings file specified by the parameter {@link #settingsFile} will always be excluded automatically. + */ + @Parameter + private List pomExcludes = Collections.emptyList(); + + /** + * Include patterns for searching the projects directory for projects that need to be run before the other projects. + * This parameter allows to declare projects that perform setup tasks like installing utility artifacts into the + * local repository. Projects matched by these patterns are implicitly excluded from the scan for ordinary projects. + * Also, the exclusions defined by the parameter {@link #pomExcludes} apply to the setup projects, too. Default + * value is: setup*/pom.xml. + * + * @since 1.3 + */ + @Parameter + private List setupIncludes = Collections.singletonList( "setup*/pom.xml" ); + + /** + * The list of goals to execute on each project. Default value is: package. + */ + @Parameter + private List goals = Collections.singletonList( "package" ); + + /** + */ + @Component + private Invoker invoker; + + @Component + private SettingsBuilder settingsBuilder; + + @Component + private ToolchainManagerPrivate toolchainManagerPrivate; + + /** + * Relative path of a selector script to run prior in order to decide if the build should be executed. This script + * may be written with either BeanShell or Groovy. If the file extension is omitted (e.g. selector), + * the plugin searches for the file by trying out the well-known extensions .bsh and + * .groovy. If this script exists for a particular project but returns any non-null value different + * from true, the corresponding build is flagged as skipped. In this case, none of the pre-build hook + * script, Maven nor the post-build hook script will be invoked. If this script throws an exception, the + * corresponding build is flagged as in error, and none of the pre-build hook script, Maven not the post-build hook + * script will be invoked. + * + * @since 1.5 + */ + @Parameter( property = "invoker.selectorScript", defaultValue = "selector" ) + private String selectorScript; + + /** + * Relative path of a pre-build hook script to run prior to executing the build. This script may be written with + * either BeanShell or Groovy (since 1.3). If the file extension is omitted (e.g. prebuild), the plugin + * searches for the file by trying out the well-known extensions .bsh and .groovy. If this + * script exists for a particular project but returns any non-null value different from true or throws + * an exception, the corresponding build is flagged as a failure. In this case, neither Maven nor the post-build + * hook script will be invoked. + */ + @Parameter( property = "invoker.preBuildHookScript", defaultValue = "prebuild" ) + private String preBuildHookScript; + + /** + * Relative path of a cleanup/verification hook script to run after executing the build. This script may be written + * with either BeanShell or Groovy (since 1.3). If the file extension is omitted (e.g. verify), the + * plugin searches for the file by trying out the well-known extensions .bsh and .groovy. + * If this script exists for a particular project but returns any non-null value different from true or + * throws an exception, the corresponding build is flagged as a failure. + */ + @Parameter( property = "invoker.postBuildHookScript", defaultValue = "postbuild" ) + private String postBuildHookScript; + + /** + * Location of a properties file that defines CLI properties for the test. + */ + @Parameter( property = "invoker.testPropertiesFile", defaultValue = "test.properties" ) + private String testPropertiesFile; + + /** + * Common set of properties to pass in on each project's command line, via -D parameters. + * + * @since 1.1 + */ + @Parameter + private Map properties; + + /** + * Whether to show errors in the build output. + */ + @Parameter( property = "invoker.showErrors", defaultValue = "false" ) + private boolean showErrors; + + /** + * Whether to show debug statements in the build output. + */ + @Parameter( property = "invoker.debug", defaultValue = "false" ) + private boolean debug; + + /** + * Suppress logging to the build.log file. + */ + @Parameter( property = "invoker.noLog", defaultValue = "false" ) + private boolean noLog; + + /** + * By default a {@code build.log} is created in the root of the project. By setting this folder + * files are written to a different folder, respecting the structure of the projectsDirectory. + * + * @since 3.2.0 + */ + @Parameter + private File logDirectory; + + /** + * List of profile identifiers to explicitly trigger in the build. + * + * @since 1.1 + */ + @Parameter + private List profiles; + + /** + * A list of additional properties which will be used to filter tokens in POMs and goal files. + * + * @since 1.3 + */ + @Parameter + private Map filterProperties; + + /** + * The Maven Project Object + * + * @since 1.1 + */ + @Parameter( defaultValue = "${project}", readonly = true, required = true ) + private MavenProject project; + + @Parameter( defaultValue = "${session}", readonly = true, required = true ) + private MavenSession session; + + @Parameter( defaultValue = "${mojoExecution}", readonly = true, required = true ) + private MojoExecution mojoExecution; + + /** + * A comma separated list of projectname patterns to run. Specify this parameter to run individual tests by file + * name, overriding the {@link #setupIncludes}, {@link #pomIncludes} and {@link #pomExcludes} parameters. Each + * pattern you specify here will be used to create an include/exclude pattern formatted like + * ${projectsDirectory}/pattern. To exclude a test, prefix the pattern with a '!'. + * So you can just type -Dinvoker.test=SimpleTest,Comp*Test,!Compare* to run builds in + * ${projectsDirectory}/SimpleTest and ${projectsDirectory}/ComplexTest, but not + * ${projectsDirectory}/CompareTest + * + * @since 1.1 (exclusion since 1.8) + */ + @Parameter( property = "invoker.test" ) + private String invokerTest; + + /** + * Path to an alternate settings.xml to use for Maven invocation with all ITs. Note that the + * <localRepository> element of this settings file is always ignored, i.e. the path given by the + * parameter {@link #localRepositoryPath} is dominant. + * + * @since 1.2 + */ + @Parameter( property = "invoker.settingsFile" ) + private File settingsFile; + + /** + * The MAVEN_OPTS environment variable to use when invoking Maven. This value can be overridden for + * individual integration tests by using {@link #invokerPropertiesFile}. + * + * @since 1.2 + */ + @Parameter( property = "invoker.mavenOpts" ) + private String mavenOpts; + + /** + * The home directory of the Maven installation to use for the forked builds. Defaults to the current Maven + * installation. + * + * @since 1.3 + */ + @Parameter( property = "invoker.mavenHome" ) + private File mavenHome; + + /** + * mavenExecutable can either be a file relative to ${maven.home}/bin/ or an absolute file. + * + * @since 1.8 + * @see Invoker#setMavenExecutable(File) + */ + @Parameter( property = "invoker.mavenExecutable" ) + private String mavenExecutable; + + /** + * The JAVA_HOME environment variable to use for forked Maven invocations. Defaults to the current Java + * home directory. + * + * @since 1.3 + */ + @Parameter( property = "invoker.javaHome" ) + private File javaHome; + + /** + * The file encoding for the pre-/post-build scripts and the list files for goals and profiles. + * + * @since 1.2 + */ + @Parameter( property = "encoding", defaultValue = "${project.build.sourceEncoding}" ) + private String encoding; + + /** + * The current user system settings for use in Maven. + * + * @since 1.2 + */ + @Parameter( defaultValue = "${settings}", readonly = true, required = true ) + private Settings settings; + + /** + * A flag whether the test class path of the project under test should be included in the class path of the + * pre-/post-build scripts. If set to false, the class path of script interpreter consists only of the + * runtime dependencies of the Maven Invoker Plugin. If set the true, + * the project's test class path will be prepended to the interpreter class path. Among others, this feature allows + * the scripts to access utility classes from the test sources of your project. + * + * @since 1.2 + */ + @Parameter( property = "invoker.addTestClassPath", defaultValue = "false" ) + private boolean addTestClassPath; + + /** + * The test class path of the project under test. + */ + @Parameter( defaultValue = "${project.testClasspathElements}", readonly = true ) + private List testClassPath; + + /** + * The name of an optional project-specific file that contains properties used to specify settings for an individual + * Maven invocation. Any property present in the file will override the corresponding setting from the plugin + * configuration. The values of the properties are filtered and may use expressions like + * ${project.version} to reference project properties or values from the parameter + * {@link #filterProperties}.

    + * + *

    + * As of 3.2.0 it is possible to put this folder in any of the ancestor folders, where properties will be inherited. + * This way you can provide a single properties file for a group of projects + *

    + * + * The snippet below describes the supported properties: + *
    +     * # A comma or space separated list of goals/phases to execute, may
    +     * # specify an empty list to execute the default goal of the IT project.
    +     * # Environment variables used by maven plugins can be added here
    +     * invoker.goals = clean install -Dplugin.variable=value
    +     *
    +     * # Or you can give things like this if you need.
    +     * invoker.goals = -T2 clean verify
    +     *
    +     * # Optionally, a list of goals to run during further invocations of Maven
    +     * invoker.goals.2 = ${project.groupId}:${project.artifactId}:${project.version}:run
    +     *
    +     * # A comma or space separated list of profiles to activate
    +     * invoker.profiles = its,jdk15
    +     *
    +     * # The path to an alternative POM or base directory to invoke Maven on, defaults to the
    +     * # project that was originally specified in the plugin configuration
    +     * # Since plugin version 1.4
    +     * invoker.project = sub-module
    +     *
    +     * # The value for the environment variable MAVEN_OPTS
    +     * invoker.mavenOpts = -Dfile.encoding=UTF-16 -Xms32m -Xmx256m
    +     *
    +     * # Possible values are "fail-fast" (default), "fail-at-end" and "fail-never"
    +     * invoker.failureBehavior = fail-never
    +     *
    +     * # The expected result of the build, possible values are "success" (default) and "failure"
    +     * invoker.buildResult = failure
    +     *
    +     * # A boolean value controlling the aggregator mode of Maven, defaults to "false"
    +     * invoker.nonRecursive = true
    +     *
    +     * # A boolean value controlling the network behavior of Maven, defaults to "false"
    +     * # Since plugin version 1.4
    +     * invoker.offline = true
    +     *
    +     * # The path to the properties file from which to load system properties, defaults to the
    +     * # filename given by the plugin parameter testPropertiesFile
    +     * # Since plugin version 1.4
    +     * invoker.systemPropertiesFile = test.properties
    +     *
    +     * # An optional human friendly name for this build job to be included in the build reports.
    +     * # Since plugin version 1.4
    +     * invoker.name = Test Build 01
    +     *
    +     * # An optional description for this build job to be included in the build reports.
    +     * # Since plugin version 1.4
    +     * invoker.description = Checks the support for build reports.
    +     *
    +     * # A comma separated list of JRE versions on which this build job should be run.
    +     * # Since plugin version 1.4
    +     * invoker.java.version = 1.4+, !1.4.1, 1.7-
    +     * 
    +     * # A comma separated list of OS families on which this build job should be run.
    +     * # Since plugin version 1.4
    +     * invoker.os.family = !windows, unix, mac
    +     *
    +     * # A comma separated list of Maven versions on which this build should be run.
    +     * # Since plugin version 1.5
    +     * invoker.maven.version = 2.0.10+, !2.1.0, !2.2.0
    +     * 
    +     * # A mapping for toolchain to ensure it exists
    +     * # Since plugin version 3.2.0
    +     * invoker.toolchain.<type>.<provides> = value
    +     * invoker.toolchain.jdk.version = 11
    +     * 
    +     * # For java.version, maven.version, os.family and toolchain it is possible to define multiple selectors.
    +     * # If one of the indexed selectors matches, the test is executed.
    +     * # With the invoker.x.y equivalents you can specify global matchers.  
    +     * selector.1.java.version = 1.8+
    +     * selector.1.maven.version = 3.2.5+
    +     * selector.1.os.family = !windows
    +     * selector.2.maven.version = 3.0+
    +     * selector.3.java.version = 9+
    +     * 
    +     * # A boolean value controlling the debug logging level of Maven, , defaults to "false"
    +     * # Since plugin version 1.8
    +     * invoker.debug = true
    +     * 
    +     * # Path to an alternate settings.xml to use for Maven invocation with this IT.
    +     * # Since plugin version 3.0.1
    +     * invoker.settingsFile = ../
    +     *
    +     * # An integer value to control run order of projects. sorted in the descending order of the ordinal.
    +     * # In other words, the BuildJobs with the highest numbers will be executed first
    +     * # Since plugin version 3.2.1
    +     * invoker.ordinal = 3
    +     * invoker.ordinal = 1
    +     *
    +     * # The additional value for the environment variable.
    +     * # Since plugin version 3.2.2
    +     * invoker.environmentVariables.<variableName> = variableValue
    +     * invoker.environmentVariables.MY_ENV_NAME = myEnvValue
    +     *
    +     * 
    + * + * @since 1.2 + */ + @Parameter( property = "invoker.invokerPropertiesFile", defaultValue = "invoker.properties" ) + private String invokerPropertiesFile; + + /** + * flag to enable show mvn version used for running its (cli option : -V,--show-version ) + * + * @since 1.4 + */ + @Parameter( property = "invoker.showVersion", defaultValue = "false" ) + private boolean showVersion; + + /** + *

    Number of threads for running tests in parallel. This will be the number of maven forked process in parallel. + * When terminated with "C", the number part is multiplied by the number of processors (cores) available + * to the Java virtual machine. Floating point value are only accepted together with "C".

    + * + *

    Example values: "1.5C", "4"

    + * + * @since 1.6 + */ + @Parameter( property = "invoker.parallelThreads", defaultValue = "1" ) + private String parallelThreads; + + /** + * @since 1.6 + */ + @Parameter( property = "plugin.artifacts", required = true, readonly = true ) + private List pluginArtifacts; + + /** + * If enable and if you have a settings file configured for the execution, it will be merged with your user + * settings. + * + * @since 1.6 + */ + @Parameter( property = "invoker.mergeUserSettings", defaultValue = "false" ) + private boolean mergeUserSettings; + + /** + * Additional environment variables to set on the command line. + * + * @since 1.8 + */ + @Parameter + private Map environmentVariables; + + /** + * Additional variables for use in the hook scripts. + * + * @since 1.9 + */ + @Parameter + private Map scriptVariables; + + /** + * + * @since 3.0.2 + */ + @Parameter( defaultValue = "0", property = "invoker.timeoutInSeconds" ) + private int timeoutInSeconds; + + /** + * Write test result in junit format. + * @since 3.1.2 + */ + @Parameter( defaultValue = "false", property = "invoker.writeJunitReport" ) + private boolean writeJunitReport; + + /** + * The package name use in junit report + * @since 3.1.2 + */ + @Parameter( defaultValue = "maven.invoker.it", property = "invoker.junitPackageName" ) + private String junitPackageName = "maven.invoker.it"; + + /** + * The scripter runner that is responsible to execute hook scripts. + */ + private ScriptRunner scriptRunner; + + /** + * A string used to prefix the file name of the filtered POMs in case the POMs couldn't be filtered in-place (i.e. + * the projects were not cloned to a temporary directory), can be null. This will be set to + * null if the POMs have already been filtered during cloning. + */ + private String filteredPomPrefix = "interpolated-"; + + /** + * The format for elapsed build time. + */ + private final DecimalFormat secFormat = new DecimalFormat( "(0.0 s)", new DecimalFormatSymbols( Locale.ENGLISH ) ); + + /** + * The version of Maven which is used to run the builds + */ + private String actualMavenVersion; + + /** + * Invokes Maven on the configured test projects. + * + * @throws org.apache.maven.plugin.MojoExecutionException If the goal encountered severe errors. + * @throws org.apache.maven.plugin.MojoFailureException If any of the Maven builds failed. + */ + public void execute() + throws MojoExecutionException, MojoFailureException + { + if ( skipInvocation ) + { + getLog().info( "Skipping invocation per configuration." + + " If this is incorrect, ensure the skipInvocation parameter is not set to true." ); + return; + } + + if ( StringUtils.isEmpty( encoding ) ) + { + getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING + + ", i.e. build is platform dependent!" ); + } + + // done it here to prevent issues with concurrent access in case of parallel run + if ( !disableReports ) + { + setupReportsFolder(); + } + + List buildJobs; + if ( pom == null ) + { + try + { + buildJobs = getBuildJobs(); + } + catch ( final IOException e ) + { + throw new MojoExecutionException( "Error retrieving POM list from includes, " + + "excludes, and projects directory. Reason: " + e.getMessage(), e ); + } + } + else + { + try + { + projectsDirectory = pom.getCanonicalFile().getParentFile(); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to discover projectsDirectory from " + + "pom File parameter. Reason: " + e.getMessage(), e ); + } + + buildJobs = Collections.singletonList( new BuildJob( pom.getName(), BuildJob.Type.NORMAL ) ); + } + + if ( buildJobs.isEmpty() ) + { + doFailIfNoProjects(); + + getLog().info( "No projects were selected for execution." ); + return; + } + + handleScriptRunnerWithScriptClassPath(); + + Collection collectedProjects = new LinkedHashSet<>(); + for ( BuildJob buildJob : buildJobs ) + { + collectProjects( projectsDirectory, buildJob.getProject(), collectedProjects, true ); + } + + File projectsDir = projectsDirectory; + + if ( cloneProjectsTo != null ) + { + cloneProjects( collectedProjects ); + projectsDir = cloneProjectsTo; + } + else if ( cloneProjectsTo == null && "maven-plugin".equals( project.getPackaging() ) ) + { + cloneProjectsTo = new File( project.getBuild().getDirectory(), "its" ); + cloneProjects( collectedProjects ); + projectsDir = cloneProjectsTo; + } + else + { + getLog().warn( "Filtering of parent/child POMs is not supported without cloning the projects" ); + } + + // First run setup jobs. + List setupBuildJobs = null; + try + { + setupBuildJobs = getSetupBuildJobsFromFolders(); + } + catch ( IOException e ) + { + getLog().error( "Failure during scanning of folders.", e ); + // TODO: Check shouldn't we fail in case of problems? + } + + if ( !setupBuildJobs.isEmpty() ) + { + // Run setup jobs in single thread + // mode. + // + // Some Idea about ordering? + getLog().info( "Running " + setupBuildJobs.size() + " setup job" + + ( ( setupBuildJobs.size() < 2 ) ? "" : "s" ) + ":" ); + runBuilds( projectsDir, setupBuildJobs, 1 ); + getLog().info( "Setup done." ); + } + + // Afterwards run all other jobs. + List nonSetupBuildJobs = getNonSetupJobs( buildJobs ); + // We will run the non setup jobs with the configured + // parallelThreads number. + runBuilds( projectsDir, nonSetupBuildJobs, getParallelThreadsCount() ); + + writeSummaryFile( nonSetupBuildJobs ); + + processResults( new InvokerSession( nonSetupBuildJobs ) ); + + } + + /** + * This will create the necessary folders for the reports. + * + * @throws MojoExecutionException in case of failure during creation of the reports folder. + */ + private void setupReportsFolder() + throws MojoExecutionException + { + // If it exists from previous run... + if ( reportsDirectory.exists() ) + { + try + { + FileUtils.deleteDirectory( reportsDirectory ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failure while trying to delete " + + reportsDirectory.getAbsolutePath(), e ); + } + } + if ( !reportsDirectory.mkdirs() ) + { + throw new MojoExecutionException( "Failure while creating the " + reportsDirectory.getAbsolutePath() ); + } + } + + private List getNonSetupJobs( List buildJobs ) + { + List result = new LinkedList<>(); + for ( BuildJob buildJob : buildJobs ) + { + if ( !buildJob.getType().equals( BuildJob.Type.SETUP ) ) + { + result.add( buildJob ); + } + } + return result; + } + + private void handleScriptRunnerWithScriptClassPath() + { + final List scriptClassPath; + if ( addTestClassPath ) + { + scriptClassPath = new ArrayList<>( testClassPath ); + for ( Artifact pluginArtifact : pluginArtifacts ) + { + scriptClassPath.remove( pluginArtifact.getFile().getAbsolutePath() ); + } + } + else + { + scriptClassPath = null; + } + scriptRunner = new ScriptRunner( getLog() ); + scriptRunner.setScriptEncoding( encoding ); + scriptRunner.setGlobalVariable( "localRepositoryPath", localRepositoryPath ); + if ( scriptVariables != null ) + { + for ( Entry entry : scriptVariables.entrySet() ) + { + scriptRunner.setGlobalVariable( entry.getKey(), entry.getValue() ); + } + } + scriptRunner.setClassPath( scriptClassPath ); + } + + private void writeSummaryFile( List buildJobs ) + throws MojoExecutionException + { + + File summaryReportFile = new File( reportsDirectory, "invoker-summary.txt" ); + + try ( Writer writer = new BufferedWriter( new FileWriter( summaryReportFile ) ) ) + { + for ( BuildJob buildJob : buildJobs ) + { + if ( !buildJob.getResult().equals( BuildJob.Result.SUCCESS ) ) + { + writer.append( buildJob.getResult() ); + writer.append( " [" ); + writer.append( buildJob.getProject() ); + writer.append( "] " ); + if ( buildJob.getFailureMessage() != null ) + { + writer.append( " " ); + writer.append( buildJob.getFailureMessage() ); + } + writer.append( "\n" ); + } + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to write summary report " + summaryReportFile, e ); + } + } + + protected void doFailIfNoProjects() + throws MojoFailureException + { + // should only be used during run and verify + } + + /** + * Processes the results of invoking the build jobs. + * + * @param invokerSession The session with the build jobs, must not be null. + * @throws MojoFailureException If the mojo had failed as a result of invoking the build jobs. + * @since 1.4 + */ + abstract void processResults( InvokerSession invokerSession ) + throws MojoFailureException; + + /** + * Creates a new reader for the specified file, using the plugin's {@link #encoding} parameter. + * + * @param file The file to create a reader for, must not be null. + * @return The reader for the file, never null. + * @throws java.io.IOException If the specified file was not found or the configured encoding is not supported. + */ + private Reader newReader( File file ) + throws IOException + { + if ( StringUtils.isNotEmpty( encoding ) ) + { + return ReaderFactory.newReader( file, encoding ); + } + else + { + return ReaderFactory.newPlatformReader( file ); + } + } + + /** + * Collects all projects locally reachable from the specified project. The method will as such try to read the POM + * and recursively follow its parent/module elements. + * + * @param projectsDir The base directory of all projects, must not be null. + * @param projectPath The relative path of the current project, can denote either the POM or its base directory, + * must not be null. + * @param projectPaths The set of already collected projects to add new projects to, must not be null. + * This set will hold the relative paths to either a POM file or a project base directory. + * @param included A flag indicating whether the specified project has been explicitly included via the parameter + * {@link #pomIncludes}. Such projects will always be added to the result set even if there is no + * corresponding POM. + * @throws org.apache.maven.plugin.MojoExecutionException If the project tree could not be traversed. + */ + private void collectProjects( File projectsDir, String projectPath, Collection projectPaths, + boolean included ) + throws MojoExecutionException + { + projectPath = projectPath.replace( '\\', '/' ); + File pomFile = new File( projectsDir, projectPath ); + if ( pomFile.isDirectory() ) + { + pomFile = new File( pomFile, "pom.xml" ); + if ( !pomFile.exists() ) + { + if ( included ) + { + projectPaths.add( projectPath ); + } + return; + } + if ( !projectPath.endsWith( "/" ) ) + { + projectPath += '/'; + } + projectPath += "pom.xml"; + } + else if ( !pomFile.isFile() ) + { + return; + } + if ( !projectPaths.add( projectPath ) ) + { + return; + } + getLog().debug( "Collecting parent/child projects of " + projectPath ); + + Model model = PomUtils.loadPom( pomFile ); + + try + { + String projectsRoot = projectsDir.getCanonicalPath(); + String projectDir = pomFile.getParent(); + + String parentPath = "../pom.xml"; + if ( model.getParent() != null && StringUtils.isNotEmpty( model.getParent().getRelativePath() ) ) + { + parentPath = model.getParent().getRelativePath(); + } + String parent = relativizePath( new File( projectDir, parentPath ), projectsRoot ); + if ( parent != null ) + { + collectProjects( projectsDir, parent, projectPaths, false ); + } + + Collection modulePaths = new LinkedHashSet<>(); + + modulePaths.addAll( model.getModules() ); + + for ( Profile profile : model.getProfiles() ) + { + modulePaths.addAll( profile.getModules() ); + } + + for ( String modulePath : modulePaths ) + { + String module = relativizePath( new File( projectDir, modulePath ), projectsRoot ); + if ( module != null ) + { + collectProjects( projectsDir, module, projectPaths, false ); + } + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to analyze POM: " + pomFile, e ); + } + } + + /** + * Copies the specified projects to the directory given by {@link #cloneProjectsTo}. A project may either be denoted + * by a path to a POM file or merely by a path to a base directory. During cloning, the POM files will be filtered. + * + * @param projectPaths The paths to the projects to clone, relative to the projects directory, must not be + * null nor contain null elements. + * @throws org.apache.maven.plugin.MojoExecutionException If the the projects could not be copied/filtered. + */ + private void cloneProjects( Collection projectPaths ) + throws MojoExecutionException + { + if ( !cloneProjectsTo.mkdirs() && cloneClean ) + { + try + { + FileUtils.cleanDirectory( cloneProjectsTo ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Could not clean the cloneProjectsTo directory. Reason: " + + e.getMessage(), e ); + } + } + + // determine project directories to clone + Collection dirs = new LinkedHashSet<>(); + for ( String projectPath : projectPaths ) + { + if ( !new File( projectsDirectory, projectPath ).isDirectory() ) + { + projectPath = getParentPath( projectPath ); + } + dirs.add( projectPath ); + } + + boolean filter; + + // clone project directories + try + { + filter = !cloneProjectsTo.getCanonicalFile().equals( projectsDirectory.getCanonicalFile() ); + + List clonedSubpaths = new ArrayList<>(); + + for ( String subpath : dirs ) + { + // skip this project if its parent directory is also scheduled for cloning + if ( !".".equals( subpath ) && dirs.contains( getParentPath( subpath ) ) ) + { + continue; + } + + // avoid copying subdirs that are already cloned. + if ( !alreadyCloned( subpath, clonedSubpaths ) ) + { + // avoid creating new files that point to dir/. + if ( ".".equals( subpath ) ) + { + String cloneSubdir = relativizePath( cloneProjectsTo, projectsDirectory.getCanonicalPath() ); + + // avoid infinite recursion if the cloneTo path is a subdirectory. + if ( cloneSubdir != null ) + { + File temp = File.createTempFile( "pre-invocation-clone.", "" ); + temp.delete(); + temp.mkdirs(); + + copyDirectoryStructure( projectsDirectory, temp ); + + FileUtils.deleteDirectory( new File( temp, cloneSubdir ) ); + + copyDirectoryStructure( temp, cloneProjectsTo ); + } + else + { + copyDirectoryStructure( projectsDirectory, cloneProjectsTo ); + } + } + else + { + File srcDir = new File( projectsDirectory, subpath ); + File dstDir = new File( cloneProjectsTo, subpath ); + copyDirectoryStructure( srcDir, dstDir ); + } + + clonedSubpaths.add( subpath ); + } + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to clone projects from: " + projectsDirectory + " to: " + + cloneProjectsTo + ". Reason: " + e.getMessage(), e ); + } + + // filter cloned POMs + if ( filter ) + { + for ( String projectPath : projectPaths ) + { + File pomFile = new File( cloneProjectsTo, projectPath ); + if ( pomFile.isFile() ) + { + buildInterpolatedFile( pomFile, pomFile ); + } + + // MINVOKER-186 + // The following is a temporary solution to support Maven 3.3.1 (.mvn/extensions.xml) filtering + // Will be replaced by MINVOKER-117 with general filtering mechanism + File baseDir = pomFile.getParentFile(); + File mvnDir = new File( baseDir, ".mvn" ); + if ( mvnDir.isDirectory() ) + { + File extensionsFile = new File( mvnDir, "extensions.xml" ); + if ( extensionsFile.isFile() ) + { + buildInterpolatedFile( extensionsFile, extensionsFile ); + } + } + // END MINVOKER-186 + } + filteredPomPrefix = null; + } + } + + /** + * Gets the parent path of the specified relative path. + * + * @param path The relative path whose parent should be retrieved, must not be null. + * @return The parent path or "." if the specified path has no parent, never null. + */ + private String getParentPath( String path ) + { + int lastSep = Math.max( path.lastIndexOf( '/' ), path.lastIndexOf( '\\' ) ); + return ( lastSep < 0 ) ? "." : path.substring( 0, lastSep ); + } + + /** + * Copied a directory structure with default exclusions (.svn, CVS, etc) + * + * @param sourceDir The source directory to copy, must not be null. + * @param destDir The target directory to copy to, must not be null. + * @throws java.io.IOException If the directory structure could not be copied. + */ + private void copyDirectoryStructure( File sourceDir, File destDir ) + throws IOException + { + DirectoryScanner scanner = new DirectoryScanner(); + scanner.setBasedir( sourceDir ); + if ( !cloneAllFiles ) + { + scanner.addDefaultExcludes(); + } + scanner.scan(); + + /* + * NOTE: Make sure the destination directory is always there (even if empty) to support POM-less ITs. + */ + destDir.mkdirs(); + // Create all the directories, including any symlinks present in source + FileUtils.mkDirs( sourceDir, scanner.getIncludedDirectories(), destDir ); + + for ( String includedFile : scanner.getIncludedFiles() ) + { + File sourceFile = new File( sourceDir, includedFile ); + File destFile = new File( destDir, includedFile ); + FileUtils.copyFile( sourceFile, destFile ); + + // ensure clone project must be writable for additional changes + destFile.setWritable( true ); + } + } + + /** + * Determines whether the specified sub path has already been cloned, i.e. whether one of its ancestor directories + * was already cloned. + * + * @param subpath The sub path to check, must not be null. + * @param clonedSubpaths The list of already cloned paths, must not be null nor contain + * null elements. + * @return true if the specified path has already been cloned, false otherwise. + */ + static boolean alreadyCloned( String subpath, List clonedSubpaths ) + { + for ( String path : clonedSubpaths ) + { + if ( ".".equals( path ) || subpath.equals( path ) || subpath.startsWith( path + File.separator ) ) + { + return true; + } + } + + return false; + } + + /** + * Runs the specified build jobs. + * + * @param projectsDir The base directory of all projects, must not be null. + * @param buildJobs The build jobs to run must not be null nor contain null elements. + * @throws org.apache.maven.plugin.MojoExecutionException If any build could not be launched. + */ + private void runBuilds( final File projectsDir, List buildJobs, int runWithParallelThreads ) + throws MojoExecutionException + { + if ( !localRepositoryPath.exists() ) + { + localRepositoryPath.mkdirs(); + } + + // ----------------------------------------------- + // interpolate settings file + // ----------------------------------------------- + + File interpolatedSettingsFile = interpolateSettings( settingsFile ); + + final File mergedSettingsFile = mergeSettings( interpolatedSettingsFile ); + + if ( mavenHome != null ) + { + actualMavenVersion = SelectorUtils.getMavenVersion( mavenHome ); + } + else + { + actualMavenVersion = SelectorUtils.getMavenVersion(); + } + scriptRunner.setGlobalVariable( "mavenVersion", actualMavenVersion ); + + final CharSequence actualJreVersion; + // @todo if ( javaVersions ) ... to be picked up from toolchains + if ( javaHome != null ) + { + actualJreVersion = resolveExternalJreVersion(); + } + else + { + actualJreVersion = SelectorUtils.getJreVersion(); + } + + final Path projectsPath = this.projectsDirectory.toPath(); + + Set folderGroupSet = new HashSet<>(); + folderGroupSet.add( Paths.get( "." ) ); + for ( BuildJob buildJob : buildJobs ) + { + Path p = Paths.get( buildJob.getProject() ); + + if ( Files.isRegularFile( projectsPath.resolve( p ) ) ) + { + p = p.getParent(); + } + + if ( p != null ) + { + p = p.getParent(); + } + + while ( p != null && folderGroupSet.add( p ) ) + { + p = p.getParent(); + } + } + + List folderGroup = new ArrayList<>( folderGroupSet ); + Collections.sort( folderGroup ); + + final Map globalInvokerProperties = new HashMap<>(); + + for ( Path path : folderGroup ) + { + Properties ancestorProperties = globalInvokerProperties.get( projectsPath.resolve( path ).getParent() ); + + Path currentInvokerProperties = projectsPath.resolve( path ).resolve( invokerPropertiesFile ); + + Properties currentProperties; + if ( Files.isRegularFile( currentInvokerProperties ) ) + { + if ( ancestorProperties != null ) + { + currentProperties = new Properties( ancestorProperties ); + + } + else + { + currentProperties = new Properties(); + } + } + else + { + currentProperties = ancestorProperties; + } + + if ( Files.isRegularFile( currentInvokerProperties ) ) + { + try ( InputStream in = new FileInputStream( currentInvokerProperties.toFile() ) ) + { + currentProperties.load( in ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to read invoker properties: " + + currentInvokerProperties ); + } + } + + if ( currentProperties != null ) + { + globalInvokerProperties.put( projectsPath.resolve( path ).normalize(), currentProperties ); + } + } + + try + { + if ( runWithParallelThreads > 1 ) + { + getLog().info( "use parallelThreads " + runWithParallelThreads ); + + ExecutorService executorService = Executors.newFixedThreadPool( runWithParallelThreads ); + for ( final BuildJob job : buildJobs ) + { + executorService.execute( new Runnable() + { + public void run() + { + try + { + Path ancestorFolder = getAncestorFolder( projectsPath.resolve( job.getProject() ) ); + + runBuild( projectsDir, job, mergedSettingsFile, javaHome, actualJreVersion, + globalInvokerProperties.get( ancestorFolder ) ); + } + catch ( MojoExecutionException e ) + { + throw new RuntimeException( e.getMessage(), e ); + } + } + } ); + } + + try + { + executorService.shutdown(); + // TODO add a configurable time out + executorService.awaitTermination( Long.MAX_VALUE, TimeUnit.MILLISECONDS ); + } + catch ( InterruptedException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + } + else + { + for ( BuildJob job : buildJobs ) + { + Path ancestorFolder = getAncestorFolder( projectsPath.resolve( job.getProject() ) ); + + runBuild( projectsDir, job, mergedSettingsFile, javaHome, actualJreVersion, + globalInvokerProperties.get( ancestorFolder ) ); + } + } + } + finally + { + if ( interpolatedSettingsFile != null && cloneProjectsTo == null ) + { + interpolatedSettingsFile.delete(); + } + if ( mergedSettingsFile != null && mergedSettingsFile.exists() ) + { + mergedSettingsFile.delete(); + } + } + } + + private Path getAncestorFolder( Path p ) + { + Path ancestor = p; + if ( Files.isRegularFile( ancestor ) ) + { + ancestor = ancestor.getParent(); + } + if ( ancestor != null ) + { + ancestor = ancestor.getParent(); + } + return ancestor; + } + + /** + * Interpolate settings.xml file. + * @param settingsFile a settings file + * + * @return The interpolated settings.xml file. + * @throws MojoExecutionException in case of a problem. + */ + private File interpolateSettings( File settingsFile ) + throws MojoExecutionException + { + File interpolatedSettingsFile = null; + if ( settingsFile != null ) + { + if ( cloneProjectsTo != null ) + { + interpolatedSettingsFile = new File( cloneProjectsTo, "interpolated-" + settingsFile.getName() ); + } + else + { + interpolatedSettingsFile = + new File( settingsFile.getParentFile(), "interpolated-" + settingsFile.getName() ); + } + buildInterpolatedFile( settingsFile, interpolatedSettingsFile ); + } + return interpolatedSettingsFile; + } + + /** + * Merge the settings file + * + * @param interpolatedSettingsFile The interpolated settings file. + * @return The merged settings file. + * @throws MojoExecutionException Fail the build in case the merged settings file can't be created. + */ + private File mergeSettings( File interpolatedSettingsFile ) + throws MojoExecutionException + { + File mergedSettingsFile; + Settings mergedSettings = this.settings; + if ( mergeUserSettings ) + { + if ( interpolatedSettingsFile != null ) + { + // Have to merge the specified settings file (dominant) and the one of the invoking Maven process + try + { + SettingsBuildingRequest request = new DefaultSettingsBuildingRequest(); + request.setGlobalSettingsFile( interpolatedSettingsFile ); + + Settings dominantSettings = settingsBuilder.build( request ).getEffectiveSettings(); + Settings recessiveSettings = cloneSettings(); + SettingsUtils.merge( dominantSettings, recessiveSettings, TrackableBase.USER_LEVEL ); + + mergedSettings = dominantSettings; + getLog().debug( "Merged specified settings file with settings of invoking process" ); + } + catch ( SettingsBuildingException e ) + { + throw new MojoExecutionException( "Could not read specified settings file", e ); + } + } + } + + if ( this.settingsFile != null && !mergeUserSettings ) + { + mergedSettingsFile = interpolatedSettingsFile; + } + else + { + try + { + mergedSettingsFile = writeMergedSettingsFile( mergedSettings ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Could not create temporary file for invoker settings.xml", e ); + } + } + return mergedSettingsFile; + } + + private File writeMergedSettingsFile( Settings mergedSettings ) + throws IOException + { + File mergedSettingsFile; + mergedSettingsFile = File.createTempFile( "invoker-settings", ".xml" ); + + SettingsXpp3Writer settingsWriter = new SettingsXpp3Writer(); + + + try ( FileWriter fileWriter = new FileWriter( mergedSettingsFile ) ) + { + settingsWriter.write( fileWriter, mergedSettings ); + } + + if ( getLog().isDebugEnabled() ) + { + getLog().debug( "Created temporary file for invoker settings.xml: " + + mergedSettingsFile.getAbsolutePath() ); + } + return mergedSettingsFile; + } + + private Settings cloneSettings() + { + Settings recessiveSettings = SettingsUtils.copySettings( this.settings ); + + // MINVOKER-133: reset sourceLevelSet + resetSourceLevelSet( recessiveSettings ); + for ( org.apache.maven.settings.Mirror mirror : recessiveSettings.getMirrors() ) + { + resetSourceLevelSet( mirror ); + } + for ( org.apache.maven.settings.Server server : recessiveSettings.getServers() ) + { + resetSourceLevelSet( server ); + } + for ( org.apache.maven.settings.Proxy proxy : recessiveSettings.getProxies() ) + { + resetSourceLevelSet( proxy ); + } + for ( org.apache.maven.settings.Profile profile : recessiveSettings.getProfiles() ) + { + resetSourceLevelSet( profile ); + } + + return recessiveSettings; + } + + private void resetSourceLevelSet( org.apache.maven.settings.TrackableBase trackable ) + { + try + { + ReflectionUtils.setVariableValueInObject( trackable, "sourceLevelSet", Boolean.FALSE ); + getLog().debug( "sourceLevelSet: " + + ReflectionUtils.getValueIncludingSuperclasses( "sourceLevelSet", trackable ) ); + } + catch ( IllegalAccessException e ) + { + // noop + } + } + + private CharSequence resolveExternalJreVersion() + { + Artifact pluginArtifact = mojoExecution.getMojoDescriptor().getPluginDescriptor().getPluginArtifact(); + pluginArtifact.getFile(); + + Commandline commandLine = new Commandline(); + commandLine.setExecutable( new File( javaHome, "bin/java" ).getAbsolutePath() ); + commandLine.createArg().setValue( "-cp" ); + commandLine.createArg().setFile( pluginArtifact.getFile() ); + commandLine.createArg().setValue( SystemPropertyPrinter.class.getName() ); + commandLine.createArg().setValue( "java.version" ); + + final StringBuilder actualJreVersion = new StringBuilder(); + StreamConsumer consumer = new StreamConsumer() + { + public void consumeLine( String line ) + { + actualJreVersion.append( line ); + } + }; + try + { + CommandLineUtils.executeCommandLine( commandLine, consumer, null ); + } + catch ( CommandLineException e ) + { + getLog().warn( e.getMessage() ); + } + return actualJreVersion; + } + + /** + * Interpolate the pom file. + * + * @param pomFile The pom file. + * @param basedir The base directory. + * @return interpolated pom file location in case we have interpolated the pom file otherwise the original pom file + * will be returned. + * @throws MojoExecutionException + */ + private File interpolatePomFile( File pomFile, File basedir ) + throws MojoExecutionException + { + File interpolatedPomFile = null; + if ( pomFile != null ) + { + if ( StringUtils.isNotEmpty( filteredPomPrefix ) ) + { + interpolatedPomFile = new File( basedir, filteredPomPrefix + pomFile.getName() ); + buildInterpolatedFile( pomFile, interpolatedPomFile ); + } + else + { + interpolatedPomFile = pomFile; + } + } + return interpolatedPomFile; + } + + /** + * Runs the specified project. + * + * @param projectsDir The base directory of all projects, must not be null. + * @param buildJob The build job to run, must not be null. + * @param settingsFile The (already interpolated) user settings file for the build, may be null to use + * the current user settings. + * @param globalInvokerProperties + * @throws org.apache.maven.plugin.MojoExecutionException If the project could not be launched. + */ + private void runBuild( File projectsDir, BuildJob buildJob, File settingsFile, File actualJavaHome, + CharSequence actualJreVersion, Properties globalInvokerProperties ) + throws MojoExecutionException + { + // FIXME: Think about the following code part -- START + File pomFile = new File( projectsDir, buildJob.getProject() ); + File basedir; + if ( pomFile.isDirectory() ) + { + basedir = pomFile; + pomFile = new File( basedir, "pom.xml" ); + if ( !pomFile.exists() ) + { + pomFile = null; + } + else + { + buildJob.setProject( buildJob.getProject() + File.separator + "pom.xml" ); + } + } + else + { + basedir = pomFile.getParentFile(); + } + + File interpolatedPomFile = interpolatePomFile( pomFile, basedir ); + // FIXME: Think about the following code part -- ^^^^^^^ END + + getLog().info( buffer().a( "Building: " ).strong( buildJob.getProject() ).toString() ); + + InvokerProperties invokerProperties = getInvokerProperties( basedir, globalInvokerProperties ); + + // let's set what details we can + buildJob.setName( invokerProperties.getJobName() ); + buildJob.setDescription( invokerProperties.getJobDescription() ); + + try + { + int selection = getSelection( invokerProperties, actualJreVersion ); + if ( selection == 0 ) + { + long milliseconds = System.currentTimeMillis(); + boolean executed; + + FileLogger buildLogger = setupBuildLogFile( basedir ); + if ( buildLogger != null ) + { + buildJob.setBuildlog( buildLogger.getOutputFile().getAbsolutePath() ); + } + + try + { + executed = runBuild( basedir, interpolatedPomFile, settingsFile, actualJavaHome, + invokerProperties, buildLogger ); + } + finally + { + milliseconds = System.currentTimeMillis() - milliseconds; + buildJob.setTime( milliseconds / 1000.0 ); + + if ( buildLogger != null ) + { + buildLogger.close(); + } + } + + if ( executed ) + { + buildJob.setResult( BuildJob.Result.SUCCESS ); + + if ( !suppressSummaries ) + { + getLog().info( pad( buildJob ).success( "SUCCESS" ).a( ' ' ) + + formatTime( buildJob.getTime() ) ); + } + } + else + { + buildJob.setResult( BuildJob.Result.SKIPPED ); + + if ( !suppressSummaries ) + { + getLog().info( pad( buildJob ).warning( "SKIPPED" ).a( ' ' ) + + formatTime( buildJob.getTime() ) ); + } + } + } + else + { + buildJob.setResult( BuildJob.Result.SKIPPED ); + + StringBuilder message = new StringBuilder(); + if ( selection == Selector.SELECTOR_MULTI ) + { + message.append( "non-matching selectors" ); + } + else + { + if ( ( selection & Selector.SELECTOR_MAVENVERSION ) != 0 ) + { + message.append( "Maven version" ); + } + if ( ( selection & Selector.SELECTOR_JREVERSION ) != 0 ) + { + if ( message.length() > 0 ) + { + message.append( ", " ); + } + message.append( "JRE version" ); + } + if ( ( selection & Selector.SELECTOR_OSFAMILY ) != 0 ) + { + if ( message.length() > 0 ) + { + message.append( ", " ); + } + message.append( "OS" ); + } + if ( ( selection & Selector.SELECTOR_TOOLCHAIN ) != 0 ) + { + if ( message.length() > 0 ) + { + message.append( ", " ); + } + message.append( "Toolchain" ); + } + } + + if ( !suppressSummaries ) + { + getLog().info( pad( buildJob ).warning( "SKIPPED" ) + " due to " + message.toString() ); + } + + // Abuse failureMessage, the field in the report which should contain the reason for skipping + // Consider skipCode + I18N + buildJob.setFailureMessage( "Skipped due to " + message.toString() ); + } + } + catch ( RunErrorException e ) + { + buildJob.setResult( BuildJob.Result.ERROR ); + buildJob.setFailureMessage( e.getMessage() ); + + if ( !suppressSummaries ) + { + getLog().info( " " + e.getMessage() ); + getLog().info( pad( buildJob ).failure( "ERROR" ).a( ' ' ) + formatTime( buildJob.getTime() ) ); + } + } + catch ( RunFailureException e ) + { + buildJob.setResult( e.getType() ); + buildJob.setFailureMessage( e.getMessage() ); + + if ( !suppressSummaries ) + { + getLog().info( " " + e.getMessage() ); + getLog().info( pad( buildJob ).failure( "FAILED" ).a( ' ' ) + formatTime( buildJob.getTime() ) ); + } + } + finally + { + deleteInterpolatedPomFile( interpolatedPomFile ); + writeBuildReport( buildJob ); + } + } + + private MessageBuilder pad( BuildJob buildJob ) + { + MessageBuilder buffer = buffer( 128 ); + + buffer.a( " " ); + buffer.a( buildJob.getProject() ); + + int l = 10 + buildJob.getProject().length(); + + if ( l < RESULT_COLUMN ) + { + buffer.a( ' ' ); + l++; + + if ( l < RESULT_COLUMN ) + { + for ( int i = RESULT_COLUMN - l; i > 0; i-- ) + { + buffer.a( '.' ); + } + } + } + + return buffer.a( ' ' ); + } + + /** + * Delete the interpolated pom file if it has been created before. + * + * @param interpolatedPomFile The interpolated pom file. + */ + private void deleteInterpolatedPomFile( File interpolatedPomFile ) + { + if ( interpolatedPomFile != null && StringUtils.isNotEmpty( filteredPomPrefix ) ) + { + interpolatedPomFile.delete(); + } + } + + /** + * Determines whether selector conditions of the specified invoker properties match the current environment. + * + * @param invokerProperties The invoker properties to check, must not be null. + * @return 0 if the job corresponding to the properties should be run, otherwise a bitwise value + * representing the reason why it should be skipped. + */ + private int getSelection( InvokerProperties invokerProperties, CharSequence actualJreVersion ) + { + return new Selector( actualMavenVersion, actualJreVersion.toString(), + getToolchainPrivateManager() ).getSelection( invokerProperties ); + } + + private ToolchainPrivateManager getToolchainPrivateManager() + { + return new ToolchainPrivateManager( toolchainManagerPrivate, session ); + } + + /** + * Writes the XML report for the specified build job unless report generation has been disabled. + * + * @param buildJob The build job whose report should be written, must not be null. + * @throws org.apache.maven.plugin.MojoExecutionException If the report could not be written. + */ + private void writeBuildReport( BuildJob buildJob ) + throws MojoExecutionException + { + if ( disableReports ) + { + return; + } + + String safeFileName = buildJob.getProject().replace( '/', '_' ).replace( '\\', '_' ).replace( ' ', '_' ); + if ( safeFileName.endsWith( "_pom.xml" ) ) + { + safeFileName = safeFileName.substring( 0, safeFileName.length() - "_pom.xml".length() ); + } + + File reportFile = new File( reportsDirectory, "BUILD-" + safeFileName + ".xml" ); + try ( FileOutputStream fos = new FileOutputStream( reportFile ); + Writer osw = new OutputStreamWriter( fos, buildJob.getModelEncoding() ) ) + { + BuildJobXpp3Writer writer = new BuildJobXpp3Writer(); + + writer.write( osw, buildJob ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to write build report " + reportFile, e ); + } + + if ( writeJunitReport ) + { + writeJunitReport( buildJob, safeFileName ); + } + } + + private void writeJunitReport( BuildJob buildJob, String safeFileName ) + throws MojoExecutionException + { + File reportFile = new File( reportsDirectory, "TEST-" + safeFileName + ".xml" ); + Xpp3Dom testsuite = new Xpp3Dom( "testsuite" ); + testsuite.setAttribute( "name", junitPackageName + "." + safeFileName ); + testsuite.setAttribute( "time", Double.toString( buildJob.getTime() ) ); + + // set default value for required attributes + testsuite.setAttribute( "tests", "1" ); + testsuite.setAttribute( "errors", "0" ); + testsuite.setAttribute( "skipped", "0" ); + testsuite.setAttribute( "failures", "0" ); + + Xpp3Dom testcase = new Xpp3Dom( "testcase" ); + testsuite.addChild( testcase ); + switch ( buildJob.getResult() ) + { + case BuildJob.Result.SUCCESS: + break; + case BuildJob.Result.SKIPPED: + testsuite.setAttribute( "skipped", "1" ); + // adding the failure element + Xpp3Dom skipped = new Xpp3Dom( "skipped" ); + testcase.addChild( skipped ); + skipped.setValue( buildJob.getFailureMessage() ); + break; + case BuildJob.Result.ERROR: + testsuite.setAttribute( "errors", "1" ); + break; + default: + testsuite.setAttribute( "failures", "1" ); + // adding the failure element + Xpp3Dom failure = new Xpp3Dom( "failure" ); + testcase.addChild( failure ); + failure.setAttribute( "message", buildJob.getFailureMessage() ); + } + testcase.setAttribute( "classname", junitPackageName + "." + safeFileName ); + testcase.setAttribute( "name", safeFileName ); + testcase.setAttribute( "time", Double.toString( buildJob.getTime() ) ); + Xpp3Dom systemOut = new Xpp3Dom( "system-out" ); + testcase.addChild( systemOut ); + + + File buildLogFile = buildJob.getBuildlog() != null ? new File( buildJob.getBuildlog() ) : null; + + if ( buildLogFile != null && buildLogFile.exists() ) + { + getLog().debug( "fileLogger:" + buildLogFile ); + try + { + systemOut.setValue( FileUtils.fileRead( buildLogFile ) ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to read logfile " + buildLogFile, e ); + } + } + else + { + getLog().debug( safeFileName + "not exists buildLogFile = " + buildLogFile ); + } + + try ( FileOutputStream fos = new FileOutputStream( reportFile ); + Writer osw = new OutputStreamWriter( fos, buildJob.getModelEncoding() ) ) + { + Xpp3DomWriter.write( osw, testsuite ); + } catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to write JUnit build report " + reportFile, e ); + } + } + + /** + * Formats the specified build duration time. + * + * @param seconds The duration of the build. + * @return The formatted time, never null. + */ + private String formatTime( double seconds ) + { + return secFormat.format( seconds ); + } + + /** + * Runs the specified project. + * + * @param basedir The base directory of the project, must not be null. + * @param pomFile The (already interpolated) POM file, may be null for a POM-less Maven invocation. + * @param settingsFile The (already interpolated) user settings file for the build, may be null. Will + * be merged with the settings file of the invoking Maven process. + * @param invokerProperties The properties to use. + * @param logger file logger to write execution build.log + * @return true if the project was launched or false if the selector script indicated that + * the project should be skipped. + * @throws org.apache.maven.plugin.MojoExecutionException If the project could not be launched. + * @throws org.apache.maven.shared.scriptinterpreter.RunFailureException If either a hook script or the build itself + * failed. + */ + private boolean runBuild( File basedir, File pomFile, File settingsFile, File actualJavaHome, + InvokerProperties invokerProperties, FileLogger logger ) + throws MojoExecutionException, RunFailureException + { + if ( getLog().isDebugEnabled() && !invokerProperties.getProperties().isEmpty() ) + { + Properties props = invokerProperties.getProperties(); + getLog().debug( "Using invoker properties:" ); + for ( String key : new TreeSet( props.stringPropertyNames() ) ) + { + String value = props.getProperty( key ); + getLog().debug( " " + key + " = " + value ); + } + } + + List goals = getGoals( basedir ); + + List profiles = getProfiles( basedir ); + + Map context = new LinkedHashMap<>(); + + boolean selectorResult = true; + + try + { + try + { + scriptRunner.run( "selector script", basedir, selectorScript, context, logger, BuildJob.Result.SKIPPED, + false ); + } + catch ( RunErrorException e ) + { + selectorResult = false; + throw e; + } + catch ( RunFailureException e ) + { + selectorResult = false; + return false; + } + + scriptRunner.run( "pre-build script", basedir, preBuildHookScript, context, logger, + BuildJob.Result.FAILURE_PRE_HOOK, false ); + + final InvocationRequest request = new DefaultInvocationRequest(); + + request.setLocalRepositoryDirectory( localRepositoryPath ); + + request.setBatchMode( true ); + + request.setShowErrors( showErrors ); + + request.setDebug( debug ); + + request.setShowVersion( showVersion ); + + setupLoggerForBuildJob( logger, request ); + + if ( mavenHome != null ) + { + invoker.setMavenHome( mavenHome ); + // FIXME: Should we really take care of M2_HOME? + request.addShellEnvironment( "M2_HOME", mavenHome.getAbsolutePath() ); + } + + if ( mavenExecutable != null ) + { + invoker.setMavenExecutable( new File( mavenExecutable ) ); + } + + if ( actualJavaHome != null ) + { + request.setJavaHome( actualJavaHome ); + } + + if ( environmentVariables != null ) + { + for ( Map.Entry variable : environmentVariables.entrySet() ) + { + request.addShellEnvironment( variable.getKey(), variable.getValue() ); + } + } + + for ( int invocationIndex = 1;; invocationIndex++ ) + { + if ( invocationIndex > 1 && !invokerProperties.isInvocationDefined( invocationIndex ) ) + { + break; + } + + request.setBaseDirectory( basedir ); + + request.setPomFile( pomFile ); + + request.setGoals( goals ); + + request.setProfiles( profiles ); + + request.setMavenOpts( mavenOpts ); + + request.setOffline( false ); + + int timeOut = invokerProperties.getTimeoutInSeconds( invocationIndex ); + // not set so we use the one at the mojo level + request.setTimeoutInSeconds( timeOut < 0 ? timeoutInSeconds : timeOut ); + + String customSettingsFile = invokerProperties.getSettingsFile( invocationIndex ); + if ( customSettingsFile != null ) + { + File interpolateSettingsFile = interpolateSettings( new File( customSettingsFile ) ); + File mergeSettingsFile = mergeSettings( interpolateSettingsFile ); + + request.setUserSettingsFile( mergeSettingsFile ); + } + else + { + request.setUserSettingsFile( settingsFile ); + } + + Properties systemProperties = + getSystemProperties( basedir, invokerProperties.getSystemPropertiesFile( invocationIndex ) ); + request.setProperties( systemProperties ); + + invokerProperties.configureInvocation( request, invocationIndex ); + + if ( getLog().isDebugEnabled() ) + { + try + { + getLog().debug( "Using MAVEN_OPTS: " + request.getMavenOpts() ); + getLog().debug( "Executing: " + new MavenCommandLineBuilder().build( request ) ); + } + catch ( CommandLineConfigurationException e ) + { + getLog().debug( "Failed to display command line: " + e.getMessage() ); + } + } + + try + { + InvocationResult result = invoker.execute( request ); + verify( result, invocationIndex, invokerProperties, logger ); + } + catch ( final MavenInvocationException e ) + { + getLog().debug( "Error invoking Maven: " + e.getMessage(), e ); + throw new RunFailureException( "Maven invocation failed. " + e.getMessage(), + BuildJob.Result.FAILURE_BUILD ); + } + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + finally + { + if ( selectorResult ) + { + runPostBuildHook( basedir, context, logger ); + } + } + return true; + } + + int getParallelThreadsCount() + { + if ( parallelThreads.endsWith( "C" ) ) + { + double parallelThreadsMultiple = Double.parseDouble( + parallelThreads.substring( 0, parallelThreads.length() - 1 ) ); + return (int) ( parallelThreadsMultiple * Runtime.getRuntime().availableProcessors() ); + } + else + { + return Integer.parseInt( parallelThreads ); + } + } + + private void runPostBuildHook( File basedir, Map context, FileLogger logger ) + throws MojoExecutionException, RunFailureException + { + try + { + scriptRunner.run( "post-build script", basedir, postBuildHookScript, context, logger, + BuildJob.Result.FAILURE_POST_HOOK, true ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + } + private void setupLoggerForBuildJob( FileLogger logger, final InvocationRequest request ) + { + if ( logger != null ) + { + request.setErrorHandler( logger ); + + request.setOutputHandler( logger ); + } + } + + /** + * Initializes the build logger for the specified project. This will write the logging information into + * {@code build.log}. + * + * @param basedir The base directory of the project, must not be null. + * @return The build logger or null if logging has been disabled. + * @throws org.apache.maven.plugin.MojoExecutionException If the log file could not be created. + */ + private FileLogger setupBuildLogFile( File basedir ) + throws MojoExecutionException + { + FileLogger logger = null; + + if ( !noLog ) + { + Path projectLogDirectory; + if ( logDirectory == null ) + { + projectLogDirectory = basedir.toPath(); + } + else if ( cloneProjectsTo != null ) + { + projectLogDirectory = + logDirectory.toPath().resolve( cloneProjectsTo.toPath().relativize( basedir.toPath() ) ); + } + else + { + projectLogDirectory = + logDirectory.toPath().resolve( projectsDirectory.toPath().relativize( basedir.toPath() ) ); + } + + try + { + if ( streamLogs ) + { + logger = new FileLogger( projectLogDirectory.resolve( "build.log" ).toFile(), getLog() ); + } + else + { + logger = new FileLogger( projectLogDirectory.resolve( "build.log" ).toFile() ); + } + + getLog().debug( "Build log initialized in: " + projectLogDirectory ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error initializing build logfile in: " + projectLogDirectory, e ); + } + } + + return logger; + } + + /** + * Gets the system properties to use for the specified project. + * + * @param basedir The base directory of the project, must not be null. + * @param filename The filename to the properties file to load, may be null to use the default path + * given by {@link #testPropertiesFile}. + * @return The system properties to use, may be empty but never null. + * @throws org.apache.maven.plugin.MojoExecutionException If the properties file exists but could not be read. + */ + private Properties getSystemProperties( final File basedir, final String filename ) + throws MojoExecutionException + { + Properties collectedTestProperties = new Properties(); + + if ( properties != null ) + { + // MINVOKER-118: property can have empty value, which is not accepted by collectedTestProperties + for ( Map.Entry entry : properties.entrySet() ) + { + if ( entry.getValue() != null ) + { + collectedTestProperties.put( entry.getKey(), entry.getValue() ); + } + } + } + + File propertiesFile = null; + if ( filename != null ) + { + propertiesFile = new File( basedir, filename ); + } + else if ( testPropertiesFile != null ) + { + propertiesFile = new File( basedir, testPropertiesFile ); + } + + if ( propertiesFile != null && propertiesFile.isFile() ) + { + + try ( InputStream fin = new FileInputStream( propertiesFile ) ) + { + Properties loadedProperties = new Properties(); + loadedProperties.load( fin ); + collectedTestProperties.putAll( loadedProperties ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error reading system properties from " + propertiesFile ); + } + } + + return collectedTestProperties; + } + + /** + * Verifies the invocation result. + * + * @param result The invocation result to check, must not be null. + * @param invocationIndex The index of the invocation for which to check the exit code, must not be negative. + * @param invokerProperties The invoker properties used to check the exit code, must not be null. + * @param logger The build logger, may be null if logging is disabled. + * @throws org.apache.maven.shared.scriptinterpreter.RunFailureException If the invocation result indicates a build + * failure. + */ + private void verify( InvocationResult result, int invocationIndex, InvokerProperties invokerProperties, + FileLogger logger ) + throws RunFailureException + { + if ( result.getExecutionException() != null ) + { + throw new RunFailureException( "The Maven invocation failed. " + + result.getExecutionException().getMessage(), BuildJob.Result.ERROR ); + } + else if ( !invokerProperties.isExpectedResult( result.getExitCode(), invocationIndex ) ) + { + StringBuilder buffer = new StringBuilder( 256 ); + buffer.append( "The build exited with code " ).append( result.getExitCode() ).append( ". " ); + if ( logger != null ) + { + buffer.append( "See " ); + buffer.append( logger.getOutputFile().getAbsolutePath() ); + buffer.append( " for details." ); + } + else + { + buffer.append( "See console output for details." ); + } + throw new RunFailureException( buffer.toString(), BuildJob.Result.FAILURE_BUILD ); + } + } + + /** + * Gets the goal list for the specified project. + * + * @param basedir The base directory of the project, must not be null. + * @return The list of goals to run when building the project, may be empty but never null. + * @throws org.apache.maven.plugin.MojoExecutionException If the profile file could not be read. + */ + List getGoals( final File basedir ) + throws MojoExecutionException + { + try + { + // FIXME: Currently we have null for goalsFile which has been removed. + // This might mean we can remove getGoals() at all ? Check this. + return getTokens( basedir, null, goals ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "error reading goals", e ); + } + } + + /** + * Gets the profile list for the specified project. + * + * @param basedir The base directory of the project, must not be null. + * @return The list of profiles to activate when building the project, may be empty but never null. + * @throws org.apache.maven.plugin.MojoExecutionException If the profile file could not be read. + */ + List getProfiles( File basedir ) + throws MojoExecutionException + { + try + { + return getTokens( basedir, null, profiles ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "error reading profiles", e ); + } + } + + private List calculateExcludes() + throws IOException + { + List excludes = + ( pomExcludes != null ) ? new ArrayList<>( pomExcludes ) : new ArrayList(); + if ( this.settingsFile != null ) + { + String exclude = relativizePath( this.settingsFile, projectsDirectory.getCanonicalPath() ); + if ( exclude != null ) + { + excludes.add( exclude.replace( '\\', '/' ) ); + getLog().debug( "Automatically excluded " + exclude + " from project scanning" ); + } + } + return excludes; + + } + + /** + * @return The list of setupUp jobs. + * @throws IOException + * @see {@link #setupIncludes} + */ + private List getSetupBuildJobsFromFolders() + throws IOException, MojoExecutionException + { + List excludes = calculateExcludes(); + + List setupPoms = scanProjectsDirectory( setupIncludes, excludes, BuildJob.Type.SETUP ); + if ( getLog().isDebugEnabled() ) + { + getLog().debug( "Setup projects: " + setupPoms ); + } + + return setupPoms; + } + + private static class OrdinalComparator implements Comparator + { + private static final OrdinalComparator INSTANCE = new OrdinalComparator(); + + @Override + public int compare( Object o1, Object o2 ) + { + return Integer.compare( ( ( BuildJob ) o2 ).getOrdinal(), ( ( BuildJob ) o1 ).getOrdinal() ); + } + } + + /** + * Gets the build jobs that should be processed. Note that the order of the returned build jobs is significant. + * + * @return The build jobs to process, may be empty but never null. + * @throws java.io.IOException If the projects directory could not be scanned. + */ + List getBuildJobs() + throws IOException, MojoExecutionException + { + List buildJobs; + + if ( invokerTest == null ) + { + List excludes = calculateExcludes(); + + List setupPoms = scanProjectsDirectory( setupIncludes, excludes, BuildJob.Type.SETUP ); + if ( getLog().isDebugEnabled() ) + { + getLog().debug( "Setup projects: " + Arrays.asList( setupPoms ) ); + } + + List normalPoms = scanProjectsDirectory( pomIncludes, excludes, BuildJob.Type.NORMAL ); + + Map uniquePoms = new LinkedHashMap<>(); + for ( BuildJob setupPom : setupPoms ) + { + uniquePoms.put( setupPom.getProject(), setupPom ); + } + for ( BuildJob normalPom : normalPoms ) + { + if ( !uniquePoms.containsKey( normalPom.getProject() ) ) + { + uniquePoms.put( normalPom.getProject(), normalPom ); + } + } + + buildJobs = new ArrayList<>( uniquePoms.values() ); + } + else + { + String[] testRegexes = StringUtils.split( invokerTest, "," ); + List includes = new ArrayList<>( testRegexes.length ); + List excludes = new ArrayList<>(); + + for ( String regex : testRegexes ) + { + // user just use -Dinvoker.test=MWAR191,MNG111 to use a directory thats the end is not pom.xml + if ( regex.startsWith( "!" ) ) + { + excludes.add( regex.substring( 1 ) ); + } + else + { + includes.add( regex ); + } + } + + // it would be nice if we could figure out what types these are... but perhaps + // not necessary for the -Dinvoker.test=xxx t + buildJobs = scanProjectsDirectory( includes, excludes, BuildJob.Type.DIRECT ); + } + + relativizeProjectPaths( buildJobs ); + + return buildJobs; + } + + /** + * Scans the projects directory for projects to build. Both (POM) files and mere directories will be matched by the + * scanner patterns. If the patterns match a directory which contains a file named "pom.xml", the results will + * include the path to this file rather than the directory path in order to avoid duplicate invocations of the same + * project. + * + * @param includes The include patterns for the scanner, may be null. + * @param excludes The exclude patterns for the scanner, may be null to exclude nothing. + * @param type The type to assign to the resulting build jobs, must not be null. + * @return The build jobs matching the patterns, never null. + * @throws java.io.IOException If the project directory could not be scanned. + */ + private List scanProjectsDirectory( List includes, List excludes, String type ) + throws IOException, MojoExecutionException + { + if ( !projectsDirectory.isDirectory() ) + { + return Collections.emptyList(); + } + + DirectoryScanner scanner = new DirectoryScanner(); + scanner.setBasedir( projectsDirectory.getCanonicalFile() ); + scanner.setFollowSymlinks( false ); + if ( includes != null ) + { + scanner.setIncludes( includes.toArray( new String[includes.size()] ) ); + } + if ( excludes != null ) + { + scanner.setExcludes( excludes.toArray( new String[excludes.size()] ) ); + } + scanner.addDefaultExcludes(); + scanner.scan(); + + Map matches = new LinkedHashMap<>(); + + for ( String includedFile : scanner.getIncludedFiles() ) + { + matches.put( includedFile, new BuildJob( includedFile, type ) ); + } + + for ( String includedDir : scanner.getIncludedDirectories() ) + { + String includedFile = includedDir + File.separatorChar + "pom.xml"; + if ( new File( scanner.getBasedir(), includedFile ).isFile() ) + { + matches.put( includedFile, new BuildJob( includedFile, type ) ); + } + else + { + matches.put( includedDir, new BuildJob( includedDir, type ) ); + } + } + + List projects = new ArrayList<>( matches.size() ); + + // setup ordinal values to have an order here + for ( BuildJob buildJob : matches.values() ) + { + InvokerProperties invokerProperties = + getInvokerProperties( new File( projectsDirectory, buildJob.getProject() ).getParentFile(), + null ); + buildJob.setOrdinal( invokerProperties.getOrdinal() ); + projects.add( buildJob ); + } + Collections.sort( projects, OrdinalComparator.INSTANCE ); + return projects; + } + + /** + * Relativizes the project paths of the specified build jobs against the directory specified by + * {@link #projectsDirectory} (if possible). If a project path does not denote a sub path of the projects directory, + * it is returned as is. + * + * @param buildJobs The build jobs whose project paths should be relativized, must not be null nor + * contain null elements. + * @throws java.io.IOException If any path could not be relativized. + */ + private void relativizeProjectPaths( List buildJobs ) + throws IOException + { + String projectsDirPath = projectsDirectory.getCanonicalPath(); + + for ( BuildJob buildJob : buildJobs ) + { + String projectPath = buildJob.getProject(); + + File file = new File( projectPath ); + + if ( !file.isAbsolute() ) + { + file = new File( projectsDirectory, projectPath ); + } + + String relativizedPath = relativizePath( file, projectsDirPath ); + + if ( relativizedPath == null ) + { + relativizedPath = projectPath; + } + + buildJob.setProject( relativizedPath ); + } + } + + /** + * Relativizes the specified path against the given base directory. Besides relativization, the returned path will + * also be normalized, e.g. directory references like ".." will be removed. + * + * @param path The path to relativize, must not be null. + * @param basedir The (canonical path of the) base directory to relativize against, must not be null. + * @return The relative path in normal form or null if the input path does not denote a sub path of the + * base directory. + * @throws java.io.IOException If the path could not be relativized. + */ + private String relativizePath( File path, String basedir ) + throws IOException + { + String relativizedPath = path.getCanonicalPath(); + + if ( relativizedPath.startsWith( basedir ) ) + { + relativizedPath = relativizedPath.substring( basedir.length() ); + if ( relativizedPath.startsWith( File.separator ) ) + { + relativizedPath = relativizedPath.substring( File.separator.length() ); + } + + return relativizedPath; + } + else + { + return null; + } + } + + /** + * Returns the map-based value source used to interpolate POMs and other stuff. + * + * @param escapeXml {@code true}, to escape any XML special characters in the property values; {@code false}, to not + * escape any property values. + * + * @return The map-based value source for interpolation, never null. + */ + private Map getInterpolationValueSource( final boolean escapeXml ) + { + Map props = new HashMap<>(); + + if ( filterProperties != null ) + { + props.putAll( filterProperties ); + } + props.put( "basedir", this.project.getBasedir().getAbsolutePath() ); + props.put( "baseurl", toUrl( this.project.getBasedir().getAbsolutePath() ) ); + if ( settings.getLocalRepository() != null ) + { + props.put( "localRepository", settings.getLocalRepository() ); + props.put( "localRepositoryUrl", toUrl( settings.getLocalRepository() ) ); + } + + return new CompositeMap( this.project, props, escapeXml ); + } + + /** + * Converts the specified filesystem path to a URL. The resulting URL has no trailing slash regardless whether the + * path denotes a file or a directory. + * + * @param filename The filesystem path to convert, must not be null. + * @return The file: URL for the specified path, never null. + */ + private static String toUrl( String filename ) + { + /* + * NOTE: Maven fails to properly handle percent-encoded "file:" URLs (WAGON-111) so don't use File.toURI() here + * as-is but use the decoded path component in the URL. + */ + String url = "file://" + new File( filename ).toURI().getPath(); + if ( url.endsWith( "/" ) ) + { + url = url.substring( 0, url.length() - 1 ); + } + return url; + } + + /** + * Gets goal/profile names for the specified project, either directly from the plugin configuration or from an + * external token file. + * + * @param basedir The base directory of the test project, must not be null. + * @param filename The (simple) name of an optional file in the project base directory from which to read + * goals/profiles, may be null. + * @param defaultTokens The list of tokens to return in case the specified token file does not exist, may be + * null. + * @return The list of goal/profile names, may be empty but never null. + * @throws java.io.IOException If the token file exists but could not be parsed. + */ + private List getTokens( File basedir, String filename, List defaultTokens ) + throws IOException + { + List tokens = ( defaultTokens != null ) ? defaultTokens : new ArrayList(); + + if ( StringUtils.isNotEmpty( filename ) ) + { + File tokenFile = new File( basedir, filename ); + + if ( tokenFile.exists() ) + { + tokens = readTokens( tokenFile ); + } + } + + return tokens; + } + + /** + * Reads the tokens from the specified file. Tokens are separated either by line terminators or commas. During + * parsing, the file contents will be interpolated. + * + * @param tokenFile The file to read the tokens from, must not be null. + * @return The list of tokens, may be empty but never null. + * @throws java.io.IOException If the token file could not be read. + */ + private List readTokens( final File tokenFile ) + throws IOException + { + List result = new ArrayList<>(); + + Map composite = getInterpolationValueSource( false ); + + try ( BufferedReader reader = + new BufferedReader( new InterpolationFilterReader( newReader( tokenFile ), composite ) ) ) + { + for ( String line = reader.readLine(); line != null; line = reader.readLine() ) + { + result.addAll( collectListFromCSV( line ) ); + } + } + + return result; + } + + /** + * Gets a list of comma separated tokens from the specified line. + * + * @param csv The line with comma separated tokens, may be null. + * @return The list of tokens from the line, may be empty but never null. + */ + private List collectListFromCSV( final String csv ) + { + final List result = new ArrayList<>(); + + if ( ( csv != null ) && ( csv.trim().length() > 0 ) ) + { + final StringTokenizer st = new StringTokenizer( csv, "," ); + + while ( st.hasMoreTokens() ) + { + result.add( st.nextToken().trim() ); + } + } + + return result; + } + + /** + * Interpolates the specified POM/settings file to a temporary file. The destination file may be same as the input + * file, i.e. interpolation can be performed in-place. + *

    + * Note:This methods expects the file to be a XML file and applies special XML escaping during interpolation. + *

    + * + * @param originalFile The XML file to interpolate, must not be null. + * @param interpolatedFile The target file to write the interpolated contents of the original file to, must not be + * null. + * + * @throws org.apache.maven.plugin.MojoExecutionException If the target file could not be created. + */ + void buildInterpolatedFile( File originalFile, File interpolatedFile ) + throws MojoExecutionException + { + getLog().debug( "Interpolate " + originalFile.getPath() + " to " + interpolatedFile.getPath() ); + + try + { + String xml; + + Map composite = getInterpolationValueSource( true ); + + // interpolation with token @...@ + try ( Reader reader = + new InterpolationFilterReader( ReaderFactory.newXmlReader( originalFile ), composite, "@", "@" ) ) + { + xml = IOUtil.toString( reader ); + } + + try ( Writer writer = WriterFactory.newXmlWriter( interpolatedFile ) ) + { + interpolatedFile.getParentFile().mkdirs(); + + writer.write( xml ); + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to interpolate file " + originalFile.getPath(), e ); + } + } + + /** + * Gets the (interpolated) invoker properties for an integration test. + * + * @param projectDirectory The base directory of the IT project, must not be null. + * @return The invoker properties, may be empty but never null. + * @throws org.apache.maven.plugin.MojoExecutionException If an I/O error occurred during reading the properties. + */ + private InvokerProperties getInvokerProperties( final File projectDirectory, Properties globalInvokerProperties ) + throws MojoExecutionException + { + Properties props; + if ( globalInvokerProperties != null ) + { + props = new Properties( globalInvokerProperties ); + } + else + { + props = new Properties(); + } + + File propertiesFile = new File( projectDirectory, invokerPropertiesFile ); + if ( propertiesFile.isFile() ) + { + try ( InputStream in = new FileInputStream( propertiesFile ) ) + { + props.load( in ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to read invoker properties: " + propertiesFile, e ); + } + } + + Interpolator interpolator = new RegexBasedInterpolator(); + interpolator.addValueSource( new MapBasedValueSource( getInterpolationValueSource( false ) ) ); + // CHECKSTYLE_OFF: LineLength + for ( String key : props.stringPropertyNames() ) + { + String value = props.getProperty( key ); + try + { + value = interpolator.interpolate( value, "" ); + } + catch ( InterpolationException e ) + { + throw new MojoExecutionException( "Failed to interpolate invoker properties: " + propertiesFile, + e ); + } + props.setProperty( key, value ); + } + return new InvokerProperties( props ); + } + + static class ToolchainPrivateManager + { + private ToolchainManagerPrivate manager; + + private MavenSession session; + + ToolchainPrivateManager( ToolchainManagerPrivate manager, MavenSession session ) + { + this.manager = manager; + this.session = session; + } + + ToolchainPrivate[] getToolchainPrivates( String type ) throws MisconfiguredToolchainException + { + return manager.getToolchainsForType( type, session ); + } + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/CompositeMap.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/CompositeMap.java new file mode 100644 index 000000000..13b902c20 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/CompositeMap.java @@ -0,0 +1,258 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.util.introspection.ReflectionValueExtractor; + +/** + * A map-like source to interpolate expressions. + * + * @author Olivier Lamy + * @since 1.1 + */ +class CompositeMap + implements Map +{ + + /** + * The Maven project from which to extract interpolated values, never null. + */ + private MavenProject mavenProject; + + /** + * The set of additional properties from which to extract interpolated values, never null. + */ + private Map properties; + + /** + * Flag indicating to escape XML special characters. + */ + private final boolean escapeXml; + + /** + * Creates a new interpolation source backed by the specified Maven project and some user-specified properties. + * + * @param mavenProject The Maven project from which to extract interpolated values, must not be null. + * @param properties The set of additional properties from which to extract interpolated values, may be + * null. + * @param escapeXml {@code true}, to escape any XML special characters; {@code false}, to not perform any escaping. + */ + protected CompositeMap( MavenProject mavenProject, Map properties, boolean escapeXml ) + { + if ( mavenProject == null ) + { + throw new IllegalArgumentException( "no project specified" ); + } + this.mavenProject = mavenProject; + this.properties = properties == null ? new HashMap() : properties; + this.escapeXml = escapeXml; + } + + /** + * {@inheritDoc} + * + * @see java.util.Map#clear() + */ + public void clear() + { + // nothing here + } + + /** + * {@inheritDoc} + * + * @see java.util.Map#containsKey(java.lang.Object) + */ + public boolean containsKey( Object key ) + { + if ( !( key instanceof String ) ) + { + return false; + } + + String expression = (String) key; + if ( expression.startsWith( "project." ) || expression.startsWith( "pom." ) ) + { + try + { + Object evaluated = ReflectionValueExtractor.evaluate( expression, this.mavenProject ); + if ( evaluated != null ) + { + return true; + } + } + catch ( Exception e ) + { + // uhm do we have to throw a RuntimeException here ? + } + } + + return properties.containsKey( key ) || mavenProject.getProperties().containsKey( key ); + } + + /** + * {@inheritDoc} + * + * @see java.util.Map#containsValue(java.lang.Object) + */ + public boolean containsValue( Object value ) + { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + * + * @see java.util.Map#entrySet() + */ + public Set> entrySet() + { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + * + * @see java.util.Map#get(java.lang.Object) + */ + public Object get( Object key ) + { + if ( !( key instanceof String ) ) + { + return null; + } + + Object value = null; + String expression = (String) key; + if ( expression.startsWith( "project." ) || expression.startsWith( "pom." ) ) + { + try + { + Object evaluated = ReflectionValueExtractor.evaluate( expression, this.mavenProject ); + if ( evaluated != null ) + { + value = evaluated; + } + } + catch ( Exception e ) + { + // uhm do we have to throw a RuntimeException here ? + } + } + + if ( value == null ) + { + value = properties.get( key ); + } + + if ( value == null ) + { + value = this.mavenProject.getProperties().get( key ); + } + + if ( value != null && this.escapeXml ) + { + value = value.toString(). + replaceAll( "\"", """ ). + replaceAll( "<", "<" ). + replaceAll( ">", ">" ). + replaceAll( "&", "&" ); + + } + + return value; + } + + /** + * {@inheritDoc} + * + * @see java.util.Map#isEmpty() + */ + public boolean isEmpty() + { + return this.mavenProject.getProperties().isEmpty() && this.properties.isEmpty(); + } + + /** + * {@inheritDoc} + * + * @see java.util.Map#keySet() + */ + public Set keySet() + { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + * + * @see java.util.Map#put(java.lang.Object, java.lang.Object) + */ + public Object put( String key, Object value ) + { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + * + * @see java.util.Map#putAll(java.util.Map) + */ + public void putAll( Map t ) + { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + * + * @see java.util.Map#remove(java.lang.Object) + */ + public Object remove( Object key ) + { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + * + * @see java.util.Map#size() + */ + public int size() + { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + * + * @see java.util.Map#values() + */ + public Collection values() + { + throw new UnsupportedOperationException(); + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/FileLogger.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/FileLogger.java new file mode 100644 index 000000000..9e67115b6 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/FileLogger.java @@ -0,0 +1,62 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.IOException; + +import org.apache.maven.plugin.logging.Log; +import org.apache.maven.shared.invoker.InvocationOutputHandler; +import org.apache.maven.shared.scriptinterpreter.ExecutionLogger; + +/** + * + */ +class FileLogger + extends org.apache.maven.shared.scriptinterpreter.FileLogger + implements InvocationOutputHandler, ExecutionLogger +{ + + /** + * Creates a new logger that writes to the specified file. + * + * @param outputFile The path to the output file, must not be null. + * @throws IOException If the output file could not be created. + */ + FileLogger( File outputFile ) + throws IOException + { + super( outputFile, null ); + } + + /** + * Creates a new logger that writes to the specified file and optionally mirrors messages to the given mojo logger. + * + * @param outputFile The path to the output file, must not be null. + * @param log The mojo logger to additionally output messages to, may be null if not used. + * @throws IOException If the output file could not be created. + */ + FileLogger( File outputFile, Log log ) + throws IOException + { + super( outputFile, log ); + } + +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java new file mode 100644 index 000000000..bf9b72173 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java @@ -0,0 +1,661 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.factory.ArtifactFactory; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.Model; +import org.apache.maven.model.Parent; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.ProjectBuildingRequest; +import org.apache.maven.shared.artifact.filter.resolve.PatternExclusionsFilter; +import org.apache.maven.shared.transfer.artifact.install.ArtifactInstaller; +import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult; +import org.apache.maven.shared.transfer.dependencies.DefaultDependableCoordinate; +import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolver; +import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolverException; +import org.apache.maven.shared.transfer.repository.RepositoryManager; +import org.codehaus.plexus.util.FileUtils; + +/** + * Installs the project artifacts of the main build into the local repository as a preparation to run the sub projects. + * More precisely, all artifacts of the project itself, all its locally reachable parent POMs and all its dependencies + * from the reactor will be installed to the local repository. + * + * @since 1.2 + * @author Paul Gier + * @author Benjamin Bentmann + * + */ +// CHECKSTYLE_OFF: LineLength +@Mojo( name = "install", defaultPhase = LifecyclePhase.PRE_INTEGRATION_TEST, requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true ) +// CHECKSTYLE_ON: LineLength +public class InstallMojo + extends AbstractMojo +{ + + /** + * Maven artifact install component to copy artifacts to the local repository. + */ + @Component + private ArtifactInstaller installer; + + @Component + private RepositoryManager repositoryManager; + + /** + * The component used to create artifacts. + */ + @Component + private ArtifactFactory artifactFactory; + + /** + */ + @Parameter( property = "localRepository", required = true, readonly = true ) + private ArtifactRepository localRepository; + + /** + * The path to the local repository into which the project artifacts should be installed for the integration tests. + * If not set, the regular local repository will be used. To prevent soiling of your regular local repository with + * possibly broken artifacts, it is strongly recommended to use an isolated repository for the integration tests + * (e.g. ${project.build.directory}/it-repo). + */ + @Parameter( property = "invoker.localRepositoryPath", + defaultValue = "${session.localRepository.basedir}", required = true ) + private File localRepositoryPath; + + /** + * The current Maven project. + */ + @Parameter( defaultValue = "${project}", readonly = true, required = true ) + private MavenProject project; + + @Parameter( defaultValue = "${session}", readonly = true, required = true ) + private MavenSession session; + + /** + * The set of Maven projects in the reactor build. + */ + @Parameter( defaultValue = "${reactorProjects}", readonly = true ) + private Collection reactorProjects; + + /** + * A flag used to disable the installation procedure. This is primarily intended for usage from the command line to + * occasionally adjust the build. + * + * @since 1.4 + */ + @Parameter( property = "invoker.skip", defaultValue = "false" ) + private boolean skipInstallation; + + /** + * The identifiers of already installed artifacts, used to avoid multiple installation of the same artifact. + */ + private Collection installedArtifacts; + + /** + * The identifiers of already copied artifacts, used to avoid multiple installation of the same artifact. + */ + private Collection copiedArtifacts; + + /** + * Extra dependencies that need to be installed on the local repository.
    + * Format: + * + *
    +     * groupId:artifactId:version:type:classifier
    +     * 
    + * + * Examples: + * + *
    +     * org.apache.maven.plugins:maven-clean-plugin:2.4:maven-plugin
    +     * org.apache.maven.plugins:maven-clean-plugin:2.4:jar:javadoc
    +     * 
    + * + * If the type is 'maven-plugin' the plugin will try to resolve the artifact using plugin remote repositories, + * instead of using artifact remote repositories. + * + * @since 1.6 + */ + @Parameter + private String[] extraArtifacts; + + /** + */ + @Component + private DependencyResolver resolver; + + + /** + * if the local repository is not used as test repo, the parameter can force get artifacts from local repo + * if available instead of download the artifacts again. + * @since 3.2.1 + */ + @Parameter( property = "invoker.useLocalRepository", defaultValue = "false" ) + private boolean useLocalRepository; + + private ProjectBuildingRequest projectBuildingRequest; + + /** + * Performs this mojo's tasks. + * + * @throws MojoExecutionException If the artifacts could not be installed. + */ + public void execute() + throws MojoExecutionException + { + if ( skipInstallation ) + { + getLog().info( "Skipping artifact installation per configuration." ); + return; + } + + createTestRepository(); + + installedArtifacts = new HashSet<>(); + copiedArtifacts = new HashSet<>(); + + installProjectDependencies( project, reactorProjects ); + installProjectParents( project ); + installProjectArtifacts( project ); + + installExtraArtifacts( extraArtifacts ); + } + + /** + * Creates the local repository for the integration tests. If the user specified a custom repository location, the + * custom repository will have the same identifier, layout and policies as the real local repository. That means + * apart from the location, the custom repository will be indistinguishable from the real repository such that its + * usage is transparent to the integration tests. + * + * @throws MojoExecutionException If the repository could not be created. + */ + private void createTestRepository() + throws MojoExecutionException + { + + if ( !localRepositoryPath.exists() && !localRepositoryPath.mkdirs() ) + { + throw new MojoExecutionException( "Failed to create directory: " + localRepositoryPath ); + } + projectBuildingRequest = + repositoryManager.setLocalRepositoryBasedir( session.getProjectBuildingRequest(), localRepositoryPath ); + } + + /** + * Installs the specified artifact to the local repository. Note: This method should only be used for artifacts that + * originate from the current (reactor) build. Artifacts that have been grabbed from the user's local repository + * should be installed to the test repository via {@link #copyArtifact(File, Artifact)}. + * + * @param file The file associated with the artifact, must not be null. This is in most cases the value + * of artifact.getFile() with the exception of the main artifact from a project with + * packaging "pom". Projects with packaging "pom" have no main artifact file. They have however artifact + * metadata (e.g. site descriptors) which needs to be installed. + * @param artifact The artifact to install, must not be null. + * @throws MojoExecutionException If the artifact could not be installed (e.g. has no associated file). + */ + private void installArtifact( File file, Artifact artifact ) + throws MojoExecutionException + { + try + { + if ( file == null ) + { + throw new IllegalStateException( "Artifact has no associated file: " + artifact.getId() ); + } + if ( !file.isFile() ) + { + throw new IllegalStateException( "Artifact is not fully assembled: " + file ); + } + + if ( installedArtifacts.add( artifact.getId() ) ) + { + artifact.setFile( file ); + installer.install( projectBuildingRequest, localRepositoryPath, + Collections.singletonList( artifact ) ); + } + else + { + getLog().debug( "Not re-installing " + artifact + ", " + file ); + } + } + catch ( Exception e ) + { + throw new MojoExecutionException( "Failed to install artifact: " + artifact, e ); + } + } + + /** + * Installs the specified artifact to the local repository. This method serves basically the same purpose as + * {@link #installArtifact(File, Artifact)} but is meant for artifacts that have been resolved + * from the user's local repository (and not the current build outputs). The subtle difference here is that + * artifacts from the repository have already undergone transformations and these manipulations should not be redone + * by the artifact installer. For this reason, this method performs plain copy operations to install the artifacts. + * + * @param file The file associated with the artifact, must not be null. + * @param artifact The artifact to install, must not be null. + * @throws MojoExecutionException If the artifact could not be installed (e.g. has no associated file). + */ + private void copyArtifact( File file, Artifact artifact ) + throws MojoExecutionException + { + try + { + if ( file == null ) + { + throw new IllegalStateException( "Artifact has no associated file: " + artifact.getId() ); + } + if ( !file.isFile() ) + { + throw new IllegalStateException( "Artifact is not fully assembled: " + file ); + } + + if ( copiedArtifacts.add( artifact.getId() ) ) + { + File destination = + new File( localRepositoryPath, + repositoryManager.getPathForLocalArtifact( projectBuildingRequest, artifact ) ); + + getLog().debug( "Installing " + file + " to " + destination ); + + copyFileIfDifferent( file, destination ); + + MetadataUtils.createMetadata( destination, artifact ); + } + else + { + getLog().debug( "Not re-installing " + artifact + ", " + file ); + } + } + catch ( Exception e ) + { + throw new MojoExecutionException( "Failed to stage artifact: " + artifact, e ); + } + } + + private void copyFileIfDifferent( File src, File dst ) + throws IOException + { + if ( src.lastModified() != dst.lastModified() || src.length() != dst.length() ) + { + FileUtils.copyFile( src, dst ); + dst.setLastModified( src.lastModified() ); + } + } + + /** + * Installs the main artifact and any attached artifacts of the specified project to the local repository. + * + * @param mvnProject The project whose artifacts should be installed, must not be null. + * @throws MojoExecutionException If any artifact could not be installed. + */ + private void installProjectArtifacts( MavenProject mvnProject ) + throws MojoExecutionException + { + try + { + // Install POM (usually attached as metadata but that happens only as a side effect of the Install Plugin) + installProjectPom( mvnProject ); + + // Install the main project artifact (if the project has one, e.g. has no "pom" packaging) + Artifact mainArtifact = mvnProject.getArtifact(); + if ( mainArtifact.getFile() != null ) + { + installArtifact( mainArtifact.getFile(), mainArtifact ); + } + + // Install any attached project artifacts + Collection attachedArtifacts = mvnProject.getAttachedArtifacts(); + for ( Artifact attachedArtifact : attachedArtifacts ) + { + installArtifact( attachedArtifact.getFile(), attachedArtifact ); + } + } + catch ( Exception e ) + { + throw new MojoExecutionException( "Failed to install project artifacts: " + mvnProject, e ); + } + } + + /** + * Installs the (locally reachable) parent POMs of the specified project to the local repository. The parent POMs + * from the reactor must be installed or the forked IT builds will fail when using a clean repository. + * + * @param mvnProject The project whose parent POMs should be installed, must not be null. + * @throws MojoExecutionException If any POM could not be installed. + */ + private void installProjectParents( MavenProject mvnProject ) + throws MojoExecutionException + { + try + { + for ( MavenProject parent = mvnProject.getParent(); parent != null; parent = parent.getParent() ) + { + if ( parent.getFile() == null ) + { + copyParentPoms( parent.getGroupId(), parent.getArtifactId(), parent.getVersion() ); + break; + } + installProjectPom( parent ); + } + } + catch ( Exception e ) + { + throw new MojoExecutionException( "Failed to install project parents: " + mvnProject, e ); + } + } + + /** + * Installs the POM of the specified project to the local repository. + * + * @param mvnProject The project whose POM should be installed, must not be null. + * @throws MojoExecutionException If the POM could not be installed. + */ + private void installProjectPom( MavenProject mvnProject ) + throws MojoExecutionException + { + try + { + Artifact pomArtifact = null; + if ( "pom".equals( mvnProject.getPackaging() ) ) + { + pomArtifact = mvnProject.getArtifact(); + } + if ( pomArtifact == null ) + { + pomArtifact = + artifactFactory.createProjectArtifact( mvnProject.getGroupId(), mvnProject.getArtifactId(), + mvnProject.getVersion() ); + } + installArtifact( mvnProject.getFile(), pomArtifact ); + } + catch ( Exception e ) + { + throw new MojoExecutionException( "Failed to install POM: " + mvnProject, e ); + } + } + + /** + * Installs the dependent projects from the reactor to the local repository. The dependencies on other modules from + * the reactor must be installed or the forked IT builds will fail when using a clean repository. + * + * @param mvnProject The project whose dependent projects should be installed, must not be null. + * @param reactorProjects The set of projects in the reactor build, must not be null. + * @throws MojoExecutionException If any dependency could not be installed. + */ + private void installProjectDependencies( MavenProject mvnProject, Collection reactorProjects ) + throws MojoExecutionException + { + // ... into dependencies that were resolved from reactor projects ... + Collection dependencyProjects = new LinkedHashSet<>(); + collectAllProjectReferences( mvnProject, dependencyProjects ); + + // index available reactor projects + Map projects = new HashMap<>( reactorProjects.size() ); + for ( MavenProject reactorProject : reactorProjects ) + { + String projectId = + reactorProject.getGroupId() + ':' + reactorProject.getArtifactId() + ':' + reactorProject.getVersion(); + + projects.put( projectId, reactorProject ); + } + + // group transitive dependencies (even those that don't contribute to the class path like POMs) ... + Collection artifacts = mvnProject.getArtifacts(); + // ... and those that were resolved from the (local) repo + Collection dependencyArtifacts = new LinkedHashSet<>(); + + for ( Artifact artifact : artifacts ) + { + // workaround for MNG-2961 to ensure the base version does not contain a timestamp + artifact.isSnapshot(); + + String projectId = artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getBaseVersion(); + + if ( !projects.containsKey( projectId ) ) + { + dependencyArtifacts.add( artifact ); + } + } + + // install dependencies + try + { + // copy dependencies that where resolved from the local repo + for ( Artifact artifact : dependencyArtifacts ) + { + copyArtifact( artifact ); + } + + // install dependencies that were resolved from the reactor + for ( String projectId : dependencyProjects ) + { + MavenProject dependencyProject = projects.get( projectId ); + if ( dependencyProject == null ) + { + getLog().warn( "skip dependencyProject null for projectId=" + projectId ); + continue; + } + installProjectArtifacts( dependencyProject ); + installProjectParents( dependencyProject ); + } + } + catch ( Exception e ) + { + throw new MojoExecutionException( "Failed to install project dependencies: " + mvnProject, e ); + } + } + + protected void collectAllProjectReferences( MavenProject project, Collection dependencyProjects ) + { + for ( MavenProject reactorProject : project.getProjectReferences().values() ) + { + String projectId = + reactorProject.getGroupId() + ':' + reactorProject.getArtifactId() + ':' + reactorProject.getVersion(); + if ( dependencyProjects.add( projectId ) ) + { + collectAllProjectReferences( reactorProject, dependencyProjects ); + } + } + } + + private void copyArtifact( Artifact artifact ) + throws MojoExecutionException + { + copyPoms( artifact ); + + Artifact depArtifact = + artifactFactory.createArtifactWithClassifier( artifact.getGroupId(), artifact.getArtifactId(), + artifact.getBaseVersion(), artifact.getType(), + artifact.getClassifier() ); + + File artifactFile = artifact.getFile(); + + copyArtifact( artifactFile, depArtifact ); + } + + private void copyPoms( Artifact artifact ) + throws MojoExecutionException + { + Artifact pomArtifact = + artifactFactory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(), + artifact.getBaseVersion() ); + + File pomFile = new File( localRepository.getBasedir(), localRepository.pathOf( pomArtifact ) ); + + if ( pomFile.isFile() ) + { + copyArtifact( pomFile, pomArtifact ); + copyParentPoms( pomFile ); + } + } + + /** + * Installs all parent POMs of the specified POM file that are available in the local repository. + * + * @param pomFile The path to the POM file whose parents should be installed, must not be null. + * @throws MojoExecutionException If any (existing) parent POM could not be installed. + */ + private void copyParentPoms( File pomFile ) + throws MojoExecutionException + { + Model model = PomUtils.loadPom( pomFile ); + Parent parent = model.getParent(); + if ( parent != null ) + { + copyParentPoms( parent.getGroupId(), parent.getArtifactId(), parent.getVersion() ); + } + } + + /** + * Installs the specified POM and all its parent POMs to the local repository. + * + * @param groupId The group id of the POM which should be installed, must not be null. + * @param artifactId The artifact id of the POM which should be installed, must not be null. + * @param version The version of the POM which should be installed, must not be null. + * @throws MojoExecutionException If any (existing) parent POM could not be installed. + */ + private void copyParentPoms( String groupId, String artifactId, String version ) + throws MojoExecutionException + { + Artifact pomArtifact = artifactFactory.createProjectArtifact( groupId, artifactId, version ); + + if ( installedArtifacts.contains( pomArtifact.getId() ) || copiedArtifacts.contains( pomArtifact.getId() ) ) + { + getLog().debug( "Not re-installing " + pomArtifact ); + return; + } + + File pomFile = new File( localRepository.getBasedir(), localRepository.pathOf( pomArtifact ) ); + if ( pomFile.isFile() ) + { + copyArtifact( pomFile, pomArtifact ); + copyParentPoms( pomFile ); + } + } + + private void installExtraArtifacts( String[] extraArtifacts ) + throws MojoExecutionException + { + if ( extraArtifacts == null ) + { + return; + } + + for ( String extraArtifact : extraArtifacts ) + { + String[] gav = extraArtifact.split( ":" ); + if ( gav.length < 3 || gav.length > 5 ) + { + throw new MojoExecutionException( "Invalid artifact " + extraArtifact ); + } + + String groupId = gav[0]; + String artifactId = gav[1]; + String version = gav[2]; + + String type = "jar"; + if ( gav.length > 3 ) + { + type = gav[3]; + } + + String classifier = null; + if ( gav.length == 5 ) + { + classifier = gav[4]; + } + + DefaultDependableCoordinate coordinate = new DefaultDependableCoordinate(); + try + { + coordinate.setGroupId( groupId ); + coordinate.setArtifactId( artifactId ); + coordinate.setVersion( version ); + coordinate.setType( type ); + coordinate.setClassifier( classifier ); + + + if ( !localRepository.getBasedir().equals( localRepositoryPath.getPath() ) && useLocalRepository ) + { + String previousId = localRepository.getId(); + try + { + // using another request with the correct target repo + ProjectBuildingRequest projectBuildingRequest = repositoryManager + .setLocalRepositoryBasedir( session.getProjectBuildingRequest(), + localRepositoryPath ); + projectBuildingRequest.setRemoteRepositories( Arrays.asList( localRepository ) ); + resolver.resolveDependencies( projectBuildingRequest, coordinate, + new PatternExclusionsFilter( Collections.emptyList() ) ); + } + finally + { + localRepository.setId( previousId ); + } + } + else + { + resolver.resolveDependencies( projectBuildingRequest, coordinate, + new PatternExclusionsFilter( Collections.emptyList() ) ); + } + } + catch ( DependencyResolverException e ) + { + throw new MojoExecutionException( "Unable to resolve dependencies for: " + coordinate, e ); + } + } + } + + // FIXME could be simplify with using lambda... maybe in the next century... :P + private List toArtifactsList( Iterable artifactResults ) + { + List artifacts = new ArrayList<>( ); + for ( ArtifactResult artifactResult : artifactResults ) + { + artifacts.add( artifactResult.getArtifact() ); + } + return artifacts; + } + +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/IntegrationTestMojo.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/IntegrationTestMojo.java new file mode 100644 index 000000000..8e8021b0f --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/IntegrationTestMojo.java @@ -0,0 +1,47 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.ResolutionScope; + +/** + * Searches for integration test Maven projects, and executes each, collecting a log in the project directory, will + * never fail the build, designed to be used in conjunction with the verify mojo. + * + * @since 1.4 + * @author Stephen Connolly + */ +// CHECKSTYLE_OFF: LineLength +@Mojo( name = "integration-test", defaultPhase = LifecyclePhase.INTEGRATION_TEST, requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true ) +public class IntegrationTestMojo + extends AbstractInvokerMojo +{ + + void processResults( InvokerSession invokerSession ) + throws MojoFailureException + { + // do nothing + } + +} +// CHECKSTYLE_ON: LineLength diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerMojo.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerMojo.java new file mode 100644 index 000000000..6dbbbd48d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerMojo.java @@ -0,0 +1,94 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; + +/** + * Searches for integration test Maven projects, and executes each, collecting a log in the project directory, and + * outputting the results to the command line. + * + * @since 1.0 + * @author Kenney Westerhof + * @author John Casey + */ +// CHECKSTYLE_OFF: LineLength +@Mojo( name = "run", defaultPhase = LifecyclePhase.INTEGRATION_TEST, requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true ) +// CHECKSTYLE_ON: LineLength +public class InvokerMojo + extends AbstractInvokerMojo +{ + + /** + * A flag controlling whether failures of the sub builds should fail the main build, too. If set to + * true, the main build will proceed even if one or more sub builds failed. + * + * @since 1.3 + */ + @Parameter( property = "maven.test.failure.ignore", defaultValue = "false" ) + private boolean ignoreFailures; + + /** + * Set this to true to cause a failure if there are no projects to invoke. + * + * @since 1.9 + */ + @Parameter( property = "invoker.failIfNoProjects" ) + private Boolean failIfNoProjects; + + /** + * Set to true to output build.log to mojo log in case of failed jobs. + * + * @since 3.2.2 + */ + @Parameter( property = "invoker.streamLogsOnFailures", defaultValue = "false" ) + private boolean streamLogsOnFailures; + + void processResults( InvokerSession invokerSession ) + throws MojoFailureException + { + if ( !suppressSummaries ) + { + invokerSession.logSummary( getLog(), ignoreFailures ); + } + + if ( streamLogsOnFailures ) + { + invokerSession.logFailedBuildLog( getLog(), ignoreFailures ); + } + + invokerSession.handleFailures( getLog(), ignoreFailures ); + } + + @Override + protected void doFailIfNoProjects() + throws MojoFailureException + { + if ( Boolean.TRUE.equals( failIfNoProjects ) ) + { + throw new MojoFailureException( "No projects to invoke!" ); + } + } + +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerProperties.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerProperties.java new file mode 100644 index 000000000..8dd77427e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerProperties.java @@ -0,0 +1,484 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.maven.shared.invoker.InvocationRequest; +import org.apache.maven.shared.invoker.InvocationRequest.ReactorFailureBehavior; +import org.codehaus.plexus.util.StringUtils; + +/** + * Provides a convenient facade around the invoker.properties. + * + * @author Benjamin Bentmann + */ +class InvokerProperties +{ + private static final String SELECTOR_PREFIX = "selector."; + + private static final Pattern ENVIRONMENT_VARIABLES_PATTERN = + Pattern.compile( "invoker\\.environmentVariables\\.([A-Za-z][^.]+)(\\.([0-9]+))?" ); + + private enum InvocationProperty + { + PROJECT( "invoker.project" ), + GOALS( "invoker.goals" ), + PROFILES( "invoker.profiles" ), + MAVEN_OPTS( "invoker.mavenOpts" ), + FAILURE_BEHAVIOR( "invoker.failureBehavior" ), + NON_RECURSIVE( "invoker.nonRecursive" ), + OFFLINE( "invoker.offline" ), + SYSTEM_PROPERTIES_FILE( "invoker.systemPropertiesFile" ), + DEBUG( "invoker.debug" ), + SETTINGS_FILE( "invoker.settingsFile" ), + TIMEOUT_IN_SECONDS( "invoker.timeoutInSeconds" ), + ORDINAL( "invoker.ordinal" ); + + private final String key; + + InvocationProperty( final String s ) + { + this.key = s; + } + + @Override + public String toString() + { + return key; + } + } + + private enum SelectorProperty + { + JAVA_VERSION( ".java.version" ), + MAVEN_VERSION( ".maven.version" ), + OS_FAMLY( ".os.family" ); + + private final String suffix; + + SelectorProperty( String suffix ) + { + this.suffix = suffix; + } + + @Override + public String toString() + { + return suffix; + } + } + + /** + * The invoker properties being wrapped. + */ + private final Properties properties; + + /** + * Creates a new facade for the specified invoker properties. The properties will not be copied, so any changes to + * them will be reflected by the facade. + * + * @param properties The invoker properties to wrap, may be null if none. + */ + InvokerProperties( Properties properties ) + { + this.properties = ( properties != null ) ? properties : new Properties(); + } + + /** + * Gets the invoker properties being wrapped. + * + * @return The invoker properties being wrapped, never null. + */ + public Properties getProperties() + { + return this.properties; + } + + /** + * Gets the name of the corresponding build job. + * + * @return The name of the build job or an empty string if not set. + */ + public String getJobName() + { + return this.properties.getProperty( "invoker.name", "" ); + } + + /** + * Gets the description of the corresponding build job. + * + * @return The description of the build job or an empty string if not set. + */ + public String getJobDescription() + { + return this.properties.getProperty( "invoker.description", "" ); + } + + /** + * Get the corresponding ordinal value + * + * @return The ordinal value + */ + public int getOrdinal() + { + return Integer.parseInt( this.properties.getProperty( "invoker.ordinal", "0" ) ); + } + + /** + * Gets the specification of JRE versions on which this build job should be run. + * + * @return The specification of JRE versions or an empty string if not set. + */ + public String getJreVersion() + { + return this.properties.getProperty( "invoker.java.version", "" ); + } + + /** + * Gets the specification of JRE versions on which this build job should be run. + * + * @return The specification of JRE versions or an empty string if not set. + */ + public String getJreVersion( int index ) + { + return this.properties.getProperty( SELECTOR_PREFIX + index + SelectorProperty.JAVA_VERSION, + getJreVersion() ); + } + + /** + * Gets the specification of Maven versions on which this build job should be run. + * + * @return The specification of Maven versions on which this build job should be run. + * @since 1.5 + */ + public String getMavenVersion() + { + return this.properties.getProperty( "invoker.maven.version", "" ); + } + + /** + * @param index the selector index + * @return The specification of Maven versions on which this build job should be run. + * @since 3.0.0 + */ + public String getMavenVersion( int index ) + { + return this.properties.getProperty( SELECTOR_PREFIX + index + SelectorProperty.MAVEN_VERSION, + getMavenVersion() ); + } + + /** + * Gets the specification of OS families on which this build job should be run. + * + * @return The specification of OS families or an empty string if not set. + */ + public String getOsFamily() + { + return this.properties.getProperty( "invoker.os.family", "" ); + } + + /** + * Gets the specification of OS families on which this build job should be run. + * + * @param index the selector index + * @return The specification of OS families or an empty string if not set. + * @since 3.0.0 + */ + public String getOsFamily( int index ) + { + return this.properties.getProperty( SELECTOR_PREFIX + index + SelectorProperty.OS_FAMLY, getOsFamily() ); + } + + public Collection getToolchains() + { + return getToolchains( Pattern.compile( "invoker\\.toolchain\\.([^.]+)\\.(.+)" ) ); + } + + public Collection getToolchains( int index ) + { + return getToolchains( Pattern.compile( "selector\\." + index + "\\.invoker\\.toolchain\\.([^.]+)\\.(.+)" ) ); + } + + private Collection getToolchains( Pattern p ) + { + Map toolchains = new HashMap<>(); + for ( Map.Entry entry : this.properties.entrySet() ) + { + Matcher m = p.matcher( entry.getKey().toString() ); + if ( m.matches() ) + { + String type = m.group( 1 ); + String providesKey = m.group( 2 ); + String providesValue = entry.getValue().toString(); + + InvokerToolchain tc = toolchains.get( type ); + if ( tc == null ) + { + tc = new InvokerToolchain( type ); + toolchains.put( type, tc ); + } + tc.addProvides( providesKey, providesValue ); + } + } + return toolchains.values(); + } + + /** + * Extract environment variable from properties for given index. + * Every environment variable without index is also returned. + * + * @param index index to lookup + * @return map of environment name and value + */ + + private Map getEnvironmentVariables( int index ) + { + + Map envItems = new HashMap<>(); + + for ( Map.Entry entry : properties.entrySet() ) + { + Matcher matcher = ENVIRONMENT_VARIABLES_PATTERN.matcher( entry.getKey().toString() ); + if ( matcher.matches() ) + { + + if ( String.valueOf( index ).equals( matcher.group( 3 ) ) ) + { + // variables with index has higher priority, so override + envItems.put( matcher.group( 1 ), entry.getValue().toString() ); + } + else if ( matcher.group( 3 ) == null ) + { + // variables without index has lower priority, so check if exist + if ( !envItems.containsKey( matcher.group( 1 ) ) ) + { + envItems.put( matcher.group( 1 ), entry.getValue().toString() ); + } + } + } + } + return envItems; + } + + /** + * Determines whether these invoker properties contain a build definition for the specified invocation index. + * + * @param index The one-based index of the invocation to check for, must not be negative. + * @return true if the invocation with the specified index is defined, false otherwise. + */ + public boolean isInvocationDefined( int index ) + { + for ( InvocationProperty prop : InvocationProperty.values() ) + { + if ( properties.getProperty( prop.toString() + '.' + index ) != null ) + { + return true; + } + } + return false; + } + + /** + * Determines whether these invoker properties contain a build definition for the specified selector index. + * + * @param index the index + * @return true if the selector with the specified index is defined, false otherwise. + * @since 3.0.0 + */ + public boolean isSelectorDefined( int index ) + { + for ( SelectorProperty prop : SelectorProperty.values() ) + { + if ( properties.getProperty( SELECTOR_PREFIX + index + prop.suffix ) != null ) + { + return true; + } + } + return false; + } + + /** + * Configures the specified invocation request from these invoker properties. Settings not present in the invoker + * properties will be left unchanged in the invocation request. + * + * @param request The invocation request to configure, must not be null. + * @param index The one-based index of the invocation to configure, must not be negative. + */ + public void configureInvocation( InvocationRequest request, int index ) + { + String project = get( InvocationProperty.PROJECT, index ); + if ( project != null ) + { + File file = new File( request.getBaseDirectory(), project ); + if ( file.isFile() ) + { + request.setBaseDirectory( file.getParentFile() ); + request.setPomFile( file ); + } + else + { + request.setBaseDirectory( file ); + request.setPomFile( null ); + } + } + + String goals = get( InvocationProperty.GOALS, index ); + if ( goals != null ) + { + request.setGoals( new ArrayList<>( Arrays.asList( StringUtils.split( goals, ", \t\n\r\f" ) ) ) ); + } + + String profiles = get( InvocationProperty.PROFILES, index ); + if ( profiles != null ) + { + // CHECKSTYLE_OFF: LineLength + request.setProfiles( new ArrayList<>( Arrays.asList( StringUtils.split( profiles, + ", \t\n\r\f" ) ) ) ); + // CHECKSTYLE_ON: LineLength + } + + String mvnOpts = get( InvocationProperty.MAVEN_OPTS, index ); + if ( mvnOpts != null ) + { + request.setMavenOpts( mvnOpts ); + } + + String failureBehavior = get( InvocationProperty.FAILURE_BEHAVIOR, index ); + if ( failureBehavior != null ) + { + ReactorFailureBehavior valueOf = + InvocationRequest.ReactorFailureBehavior.valueOfByLongOption( failureBehavior ); + request.setReactorFailureBehavior( valueOf ); + } + + String nonRecursive = get( InvocationProperty.NON_RECURSIVE, index ); + if ( nonRecursive != null ) + { + request.setRecursive( !Boolean.parseBoolean( nonRecursive ) ); + } + + String offline = get( InvocationProperty.OFFLINE, index ); + if ( offline != null ) + { + request.setOffline( Boolean.parseBoolean( offline ) ); + } + + String debug = get( InvocationProperty.DEBUG, index ); + if ( debug != null ) + { + request.setDebug( Boolean.parseBoolean( debug ) ); + } + + for ( Map.Entry envItem : getEnvironmentVariables( index ).entrySet() ) + { + request.addShellEnvironment( envItem.getKey(), envItem.getValue() ); + } + } + + /** + * Checks whether the specified exit code matches the one expected for the given invocation. + * + * @param exitCode The exit code of the Maven invocation to check. + * @param index The index of the invocation for which to check the exit code, must not be negative. + * @return true if the exit code is zero and a success was expected or if the exit code is non-zero and + * a failue was expected, false otherwise. + */ + public boolean isExpectedResult( int exitCode, int index ) + { + boolean nonZeroExit = "failure".equalsIgnoreCase( get( "invoker.buildResult", index ) ); + return ( exitCode != 0 ) == nonZeroExit; + } + + /** + * Gets the path to the properties file used to set the system properties for the specified invocation. + * + * @param index The index of the invocation, must not be negative. + * @return The path to the properties file or null if not set. + */ + public String getSystemPropertiesFile( int index ) + { + return get( InvocationProperty.SYSTEM_PROPERTIES_FILE, index ); + } + + /** + * Gets the settings file used for the specified invocation. + * + * @param index The index of the invocation, must not be negative. + * @return the value for the settings file or null if not set. + */ + public String getSettingsFile( int index ) + { + return get( InvocationProperty.SETTINGS_FILE, index ); + } + + /** + * Get timeout to execute the project + * @param index index The index of the invocation, must not be negative. + * @return the value for the timeout or -1 + */ + public int getTimeoutInSeconds( int index ) + { + String timeoutInSecondsStr = get( InvocationProperty.TIMEOUT_IN_SECONDS, index ); + if ( StringUtils.isEmpty( timeoutInSecondsStr ) ) + { + return -1; + } + // catch NumberFormatException? well we assume users knows what they do :-) + return Integer.parseInt( timeoutInSecondsStr ); + } + /** + * Gets a value from the invoker properties. The invoker properties are intended to describe the invocation settings + * for multiple builds of the same project. For this reason, the properties are indexed. First, a property named + * key.index will be queried. If this property does not exist, the value of the property named + * key will finally be returned. + * + * @param key The (base) key for the invoker property to lookup, must not be null. + * @param index The index of the invocation for which to retrieve the value, must not be negative. + * @return The value for the requested invoker property or null if not defined. + */ + String get( String key, int index ) + { + if ( index < 0 ) + { + throw new IllegalArgumentException( "invalid invocation index: " + index ); + } + + String value = properties.getProperty( key + '.' + index ); + if ( value == null ) + { + value = properties.getProperty( key ); + } + return value; + } + + private String get( InvocationProperty prop, int index ) + { + return get( prop.toString(), index ); + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java new file mode 100644 index 000000000..063ac648e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java @@ -0,0 +1,359 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +import org.apache.maven.doxia.sink.Sink; +import org.apache.maven.doxia.siterenderer.Renderer; +import org.apache.maven.plugins.invoker.model.BuildJob; +import org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Reader; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.apache.maven.reporting.AbstractMavenReport; +import org.apache.maven.reporting.MavenReportException; +import org.codehaus.plexus.i18n.I18N; +import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.xml.XmlStreamReader; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +/** + * Generate a report based on the results of the Maven invocations. Note: This mojo doesn't fork any + * lifecycle, if you have a clean working copy, you have to use a command like + * mvn clean integration-test site to ensure the build results are present when this goal is invoked. + * + * @author Olivier Lamy + * @since 1.4 + */ +@Mojo( name = "report", threadSafe = true ) +public class InvokerReport + extends AbstractMavenReport +{ + + /** + * The Maven Project. + */ + @Parameter( defaultValue = "${project}", readonly = true, required = true ) + protected MavenProject project; + + /** + * Doxia Site Renderer component. + */ + @Component + protected Renderer siteRenderer; + + /** + * Internationalization component. + */ + @Component + protected I18N i18n; + + /** + * The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from + * the command line. If the goal is run indirectly as part of a site generation, the output directory configured in + * the Maven Site Plugin is used instead. + */ + @Parameter( defaultValue = "${project.reporting.outputDirectory}", required = true ) + protected File outputDirectory; + + /** + * Base directory where all build reports have been written to. + */ + @Parameter( defaultValue = "${project.build.directory}/invoker-reports", property = "invoker.reportsDirectory" ) + private File reportsDirectory; + + /** + * The number format used to print percent values in the report locale. + */ + private NumberFormat percentFormat; + + /** + * The number format used to print time values in the report locale. + */ + private NumberFormat secondsFormat; + + protected void executeReport( Locale locale ) + throws MavenReportException + { + DecimalFormatSymbols symbols = new DecimalFormatSymbols( locale ); + percentFormat = new DecimalFormat( getText( locale, "report.invoker.format.percent" ), symbols ); + secondsFormat = new DecimalFormat( getText( locale, "report.invoker.format.seconds" ), symbols ); + + Sink sink = getSink(); + + sink.head(); + + sink.title(); + sink.text( getText( locale, "report.invoker.result.title" ) ); + sink.title_(); + + sink.head_(); + + sink.body(); + + sink.section1(); + sink.sectionTitle1(); + sink.text( getText( locale, "report.invoker.result.title" ) ); + sink.sectionTitle1_(); + sink.paragraph(); + sink.text( getText( locale, "report.invoker.result.description" ) ); + sink.paragraph_(); + sink.section1_(); + + // ---------------------------------- + // build buildJob beans + // ---------------------------------- + File[] reportFiles = ReportUtils.getReportFiles( reportsDirectory ); + if ( reportFiles.length <= 0 ) + { + getLog().info( "no invoker report files found, skip report generation" ); + return; + } + + BuildJobXpp3Reader buildJobReader = new BuildJobXpp3Reader(); + + List buildJobs = new ArrayList<>( reportFiles.length ); + for ( File reportFile : reportFiles ) + { + try ( XmlStreamReader xmlReader = ReaderFactory.newXmlReader( reportFile ) ) + { + buildJobs.add( buildJobReader.read( xmlReader ) ); + } + catch ( XmlPullParserException e ) + { + throw new MavenReportException( "Failed to parse report file: " + reportFile, e ); + } + catch ( IOException e ) + { + throw new MavenReportException( "Failed to read report file: " + reportFile, e ); + } + } + + // ---------------------------------- + // summary + // ---------------------------------- + + constructSummarySection( buildJobs, locale ); + + // ---------------------------------- + // per file/it detail + // ---------------------------------- + + sink.section2(); + sink.sectionTitle2(); + + sink.text( getText( locale, "report.invoker.detail.title" ) ); + + sink.sectionTitle2_(); + + sink.section2_(); + + // detail tests table header + sink.table(); + + sink.tableRow(); + // ------------------------------------------- + // name | Result | time | message + // ------------------------------------------- + sinkTableHeader( sink, getText( locale, "report.invoker.detail.name" ) ); + sinkTableHeader( sink, getText( locale, "report.invoker.detail.result" ) ); + sinkTableHeader( sink, getText( locale, "report.invoker.detail.time" ) ); + sinkTableHeader( sink, getText( locale, "report.invoker.detail.message" ) ); + + sink.tableRow_(); + + for ( BuildJob buildJob : buildJobs ) + { + renderBuildJob( buildJob, locale ); + } + + sink.table_(); + + sink.body_(); + + sink.flush(); + sink.close(); + } + + private void constructSummarySection( List buildJobs, Locale locale ) + { + Sink sink = getSink(); + + sink.section2(); + sink.sectionTitle2(); + + sink.text( getText( locale, "report.invoker.summary.title" ) ); + + sink.sectionTitle2_(); + sink.section2_(); + + // ------------------------------------------------------------------------ + // Building a table with + // it number | succes nb | failed nb | Success rate | total time | avg time + // ------------------------------------------------------------------------ + + sink.table(); + sink.tableRow(); + + sinkTableHeader( sink, getText( locale, "report.invoker.summary.number" ) ); + sinkTableHeader( sink, getText( locale, "report.invoker.summary.success" ) ); + sinkTableHeader( sink, getText( locale, "report.invoker.summary.failed" ) ); + sinkTableHeader( sink, getText( locale, "report.invoker.summary.skipped" ) ); + sinkTableHeader( sink, getText( locale, "report.invoker.summary.success.rate" ) ); + sinkTableHeader( sink, getText( locale, "report.invoker.summary.time.total" ) ); + sinkTableHeader( sink, getText( locale, "report.invoker.summary.time.avg" ) ); + + int number = buildJobs.size(); + int success = 0; + int failed = 0; + int skipped = 0; + double totalTime = 0; + + for ( BuildJob buildJob : buildJobs ) + { + if ( BuildJob.Result.SUCCESS.equals( buildJob.getResult() ) ) + { + success++; + } + else if ( BuildJob.Result.SKIPPED.equals( buildJob.getResult() ) ) + { + skipped++; + } + else + { + failed++; + } + totalTime += buildJob.getTime(); + } + + sink.tableRow_(); + sink.tableRow(); + + sinkCell( sink, Integer.toString( number ) ); + sinkCell( sink, Integer.toString( success ) ); + sinkCell( sink, Integer.toString( failed ) ); + sinkCell( sink, Integer.toString( skipped ) ); + + if ( success + failed > 0 ) + { + sinkCell( sink, percentFormat.format( (double) success / ( success + failed ) ) ); + } + else + { + sinkCell( sink, "" ); + } + + sinkCell( sink, secondsFormat.format( totalTime ) ); + + sinkCell( sink, secondsFormat.format( totalTime / number ) ); + + sink.tableRow_(); + sink.table_(); + + } + + private void renderBuildJob( BuildJob buildJob, Locale locale ) + { + Sink sink = getSink(); + sink.tableRow(); + StringBuilder buffer = new StringBuilder(); + if ( !StringUtils.isEmpty( buildJob.getName() ) && !StringUtils.isEmpty( buildJob.getDescription() ) ) + { + buffer.append( buildJob.getName() ); + buffer.append( " : " ); + buffer.append( buildJob.getDescription() ); + } + else + { + buffer.append( buildJob.getProject() ); + } + sinkCell( sink, buffer.toString() ); + // FIXME image + sinkCell( sink, buildJob.getResult() ); + sinkCell( sink, secondsFormat.format( buildJob.getTime() ) ); + sinkCell( sink, buildJob.getFailureMessage() ); + sink.tableRow_(); + } + + protected String getOutputDirectory() + { + return outputDirectory.getAbsolutePath(); + } + + protected MavenProject getProject() + { + return project; + } + + protected Renderer getSiteRenderer() + { + return siteRenderer; + } + + public String getDescription( Locale locale ) + { + return getText( locale, "report.invoker.result.description" ); + } + + public String getName( Locale locale ) + { + return getText( locale, "report.invoker.result.name" ); + } + + public String getOutputName() + { + return "invoker-report"; + } + + public boolean canGenerateReport() + { + return ReportUtils.getReportFiles( reportsDirectory ).length > 0; + } + + private String getText( Locale locale, String key ) + { + return i18n.getString( "invoker-report", locale, key ); + } + + private void sinkTableHeader( Sink sink, String header ) + { + sink.tableHeaderCell(); + sink.text( header ); + sink.tableHeaderCell_(); + } + + private void sinkCell( Sink sink, String text ) + { + sink.tableCell(); + sink.text( text ); + sink.tableCell_(); + } + +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java new file mode 100644 index 000000000..1cba4a0a3 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java @@ -0,0 +1,342 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.apache.maven.shared.utils.logging.MessageUtils.buffer; + +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.invoker.model.BuildJob; +import org.apache.maven.plugin.logging.Log; +import org.apache.maven.shared.utils.io.IOUtil; + +/** + * Tracks a set of build jobs and their results. + * + * @author Benjamin Bentmann + */ +class InvokerSession +{ + private static final String SEPARATOR = buffer().strong( + "-------------------------------------------------" ).toString(); + + private List buildJobs; + + private List failedJobs; + + private List errorJobs; + + private List successfulJobs; + + private List skippedJobs; + + /** + * Creates a new empty session. + */ + InvokerSession() + { + buildJobs = new ArrayList<>(); + } + + /** + * Creates a session that initially contains the specified build jobs. + * + * @param buildJobs The build jobs to set, must not be null. + */ + InvokerSession( List buildJobs ) + { + this.buildJobs = new ArrayList<>( buildJobs ); + } + + /** + * Adds the specified build job to this session. + * + * @param buildJob The build job to add, must not be null. + */ + public void addJob( BuildJob buildJob ) + { + buildJobs.add( buildJob ); + + resetStats(); + } + + /** + * Sets the build jobs of this session. + * + * @param buildJobs The build jobs to set, must not be null. + */ + public void setJobs( List buildJobs ) + { + this.buildJobs = new ArrayList<>( buildJobs ); + + resetStats(); + } + + /** + * Gets the build jobs in this session. + * + * @return The build jobs in this session, can be empty but never null. + */ + public List getJobs() + { + return buildJobs; + } + + /** + * Gets the successful build jobs in this session. + * + * @return The successful build jobs in this session, can be empty but never null. + */ + public List getSuccessfulJobs() + { + updateStats(); + + return successfulJobs; + } + + /** + * Gets the failed build jobs in this session. + * + * @return The failed build jobs in this session, can be empty but never null. + */ + public List getFailedJobs() + { + updateStats(); + + return failedJobs; + } + + /** + * Gets the build jobs which had errors for this session. + * + * @return The build jobs in error for this session, can be empty but never null. + */ + public List getErrorJobs() + { + updateStats(); + + return errorJobs; + } + + /** + * Gets the skipped build jobs in this session. + * + * @return The skipped build jobs in this session, can be empty but never null. + */ + public List getSkippedJobs() + { + updateStats(); + + return skippedJobs; + } + + private void resetStats() + { + successfulJobs = null; + failedJobs = null; + skippedJobs = null; + errorJobs = null; + } + + private void updateStats() + { + if ( successfulJobs != null && skippedJobs != null && failedJobs != null && errorJobs != null ) + { + return; + } + + successfulJobs = new ArrayList<>(); + failedJobs = new ArrayList<>(); + skippedJobs = new ArrayList<>(); + errorJobs = new ArrayList<>(); + + for ( BuildJob buildJob : buildJobs ) + { + if ( BuildJob.Result.SUCCESS.equals( buildJob.getResult() ) ) + { + successfulJobs.add( buildJob ); + } + else if ( BuildJob.Result.SKIPPED.equals( buildJob.getResult() ) ) + { + skippedJobs.add( buildJob ); + } + else if ( BuildJob.Result.ERROR.equals( buildJob.getResult() ) ) + { + errorJobs.add( buildJob ); + } + else if ( buildJob.getResult() != null ) + { + failedJobs.add( buildJob ); + } + } + } + + /** + * Prints a summary of this session to the specified logger. + * + * @param logger The mojo logger to output messages to, must not be null. + * @param ignoreFailures A flag whether failures should be ignored or whether a build failure should be signaled. + */ + public void logSummary( Log logger, boolean ignoreFailures ) + { + updateStats(); + + logger.info( SEPARATOR ); + logger.info( "Build Summary:" ); + logger.info( " Passed: " + successfulJobs.size() + + ", Failed: " + failedJobs.size() + + ", Errors: " + errorJobs.size() + + ", Skipped: " + skippedJobs.size() ); + logger.info( SEPARATOR ); + + logBuildJobList( logger, ignoreFailures, "The following builds failed:", failedJobs ); + logBuildJobList( logger, ignoreFailures, "The following builds finished with error:", errorJobs ); + logBuildJobList( logger, ignoreFailures, "The following builds was skipped:", skippedJobs ); + } + + public void logFailedBuildLog( Log logger, boolean ignoreFailures ) + throws MojoFailureException + { + List jobToLogs = new ArrayList<>( failedJobs ); + jobToLogs.addAll( errorJobs ); + + for ( BuildJob buildJob: jobToLogs ) + { + File buildLogFile = buildJob.getBuildlog() != null ? new File( buildJob.getBuildlog() ) : null; + if ( buildLogFile != null && buildLogFile.exists() ) + { + try + { + // prepare message with build.log in one string to omit begin [ERROR], [WARN] + // so whole log will be displayed without decoration + StringBuilder buildLogMessage = new StringBuilder( ); + buildLogMessage.append( System.lineSeparator() ); + buildLogMessage.append( System.lineSeparator() ); + buildLogMessage.append( "*** begin build.log for: " + buildJob.getProject() + " ***" ); + buildLogMessage.append( System.lineSeparator() ); + buildLogMessage.append( IOUtil.toString( new FileReader( buildLogFile ) ) ); + buildLogMessage.append( "*** end build.log for: " + buildJob.getProject() + " ***" ); + buildLogMessage.append( System.lineSeparator() ); + + logWithLevel( logger, ignoreFailures, SEPARATOR ); + logWithLevel( logger, ignoreFailures, buildLogMessage.toString() ); + logWithLevel( logger, ignoreFailures, SEPARATOR ); + logWithLevel( logger, ignoreFailures, "" ); + + } + catch ( IOException e ) + { + throw new MojoFailureException( e.getMessage(), e ); + } + } + } + } + + + /** + * Handles the build failures in this session. + * + * @param logger The mojo logger to output messages to, must not be null. + * @param ignoreFailures A flag whether failures should be ignored or whether a build failure should be signaled. + * @throws MojoFailureException If failures are present and not ignored. + */ + public void handleFailures( Log logger, boolean ignoreFailures ) + throws MojoFailureException + { + updateStats(); + + if ( !failedJobs.isEmpty() ) + { + String message = failedJobs.size() + " build" + ( failedJobs.size() == 1 ? "" : "s" ) + " failed."; + + if ( ignoreFailures ) + { + logger.warn( "Ignoring that " + message ); + } + else + { + throw new MojoFailureException( message + " See console output above for details." ); + } + } + + if ( !errorJobs.isEmpty() ) + { + String message = errorJobs.size() + " build" + ( errorJobs.size() == 1 ? "" : "s" ) + " in error."; + + if ( ignoreFailures ) + { + logger.warn( "Ignoring that " + message ); + } + else + { + throw new MojoFailureException( message + " See console output above for details." ); + } + } + } + + /** + * Log list of jobs. + * + * @param logger logger to write + * @param warn flag indicate log level + * @param buildJobs jobs to list + */ + private void logBuildJobList( Log logger, boolean warn, String header, List buildJobs ) + { + if ( buildJobs.isEmpty() ) + { + return; + } + + logWithLevel( logger, warn, header ); + + for ( BuildJob buildJob : buildJobs ) + { + logWithLevel( logger, warn, "* " + buildJob.getProject() ); + } + + logger.info( SEPARATOR ); + } + + /** + * Log message in correct level depends on flag. + * + * @param logger logger to write + * @param warn flag indicate log level + * @param message message to write + */ + private void logWithLevel( Log logger, boolean warn, String message ) + { + + if ( warn ) + { + logger.warn( message ); + } + else + { + logger.error( message ); + } + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerToolchain.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerToolchain.java new file mode 100644 index 000000000..c2381fec1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/InvokerToolchain.java @@ -0,0 +1,55 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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; + +/** + * + * @author Robert Scholte + * @since 3.2.0 + */ +public class InvokerToolchain +{ + private final String type; + + private Map provides = new HashMap<>(); + + public InvokerToolchain( String type ) + { + this.type = type; + } + + public String getType() + { + return type; + } + + public void addProvides( String key, String value ) + { + provides.put( key, value ); + } + + public Map getProvides() + { + return provides; + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/MetadataUtils.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/MetadataUtils.java new file mode 100644 index 000000000..726af155e --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/MetadataUtils.java @@ -0,0 +1,168 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.IOException; +import java.io.Reader; +import java.io.Writer; +import java.text.SimpleDateFormat; +import java.util.Collection; +import java.util.Date; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.TimeZone; + +import org.apache.maven.artifact.Artifact; +import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.WriterFactory; +import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.codehaus.plexus.util.xml.Xpp3DomBuilder; +import org.codehaus.plexus.util.xml.Xpp3DomUtils; +import org.codehaus.plexus.util.xml.Xpp3DomWriter; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +/** + * Provides utility methods for artifact metadata processing. + * + * @author Benjamin Bentmann + */ +class MetadataUtils +{ + + /** + * Creates local metadata files for the specified artifact. The goal is to simulate the installation of the artifact + * by a local build, thereby decoupling the forked builds from the inderministic collection of remote repositories + * that are available to the main build and from which the artifact was originally resolved. + * + * @param file The artifact's file in the local test repository, must not be null. + * @param artifact The artifact to create metadata for, must not be null. + * @throws IOException If the metadata could not be created. + */ + public static void createMetadata( File file, Artifact artifact ) + throws IOException + { + TimeZone tz = java.util.TimeZone.getTimeZone( "UTC" ); + SimpleDateFormat fmt = new SimpleDateFormat( "yyyyMMddHHmmss" ); + fmt.setTimeZone( tz ); + String timestamp = fmt.format( new Date() ); + + if ( artifact.isSnapshot() ) + { + File metadataFile = new File( file.getParentFile(), "maven-metadata-local.xml" ); + + Xpp3Dom metadata = new Xpp3Dom( "metadata" ); + addChild( metadata, "groupId", artifact.getGroupId() ); + addChild( metadata, "artifactId", artifact.getArtifactId() ); + addChild( metadata, "version", artifact.getBaseVersion() ); + Xpp3Dom versioning = new Xpp3Dom( "versioning" ); + versioning.addChild( addChild( new Xpp3Dom( "snapshot" ), "localCopy", "true" ) ); + addChild( versioning, "lastUpdated", timestamp ); + metadata.addChild( versioning ); + + writeMetadata( metadataFile, metadata ); + } + + File metadataFile = new File( file.getParentFile().getParentFile(), "maven-metadata-local.xml" ); + + Set allVersions = new LinkedHashSet(); + + Xpp3Dom metadata = readMetadata( metadataFile ); + + if ( metadata != null ) + { + Xpp3Dom versioning = metadata.getChild( "versioning" ); + if ( versioning != null ) + { + Xpp3Dom versions = versioning.getChild( "versions" ); + if ( versions != null ) + { + + Xpp3Dom[] children = versions.getChildren( "version" ); + for ( Xpp3Dom aChildren : children ) + { + allVersions.add( aChildren.getValue() ); + } + } + } + } + + allVersions.add( artifact.getBaseVersion() ); + + metadata = new Xpp3Dom( "metadata" ); + addChild( metadata, "groupId", artifact.getGroupId() ); + addChild( metadata, "artifactId", artifact.getArtifactId() ); + Xpp3Dom versioning = new Xpp3Dom( "versioning" ); + versioning.addChild( addChildren( new Xpp3Dom( "versions" ), "version", allVersions ) ); + addChild( versioning, "lastUpdated", timestamp ); + metadata.addChild( versioning ); + + metadata = Xpp3DomUtils.mergeXpp3Dom( metadata, readMetadata( metadataFile ) ); + + writeMetadata( metadataFile, metadata ); + } + + private static Xpp3Dom addChild( Xpp3Dom parent, String childName, String childValue ) + { + Xpp3Dom child = new Xpp3Dom( childName ); + child.setValue( childValue ); + parent.addChild( child ); + return parent; + } + + private static Xpp3Dom addChildren( Xpp3Dom parent, String childName, Collection childValues ) + { + for ( String childValue : childValues ) + { + addChild( parent, childName, childValue ); + } + return parent; + } + + private static Xpp3Dom readMetadata( File metadataFile ) + throws IOException + { + if ( !metadataFile.isFile() ) + { + return null; + } + + try ( Reader reader = ReaderFactory.newXmlReader( metadataFile ) ) + { + return Xpp3DomBuilder.build( reader ); + } + catch ( XmlPullParserException e ) + { + throw (IOException) new IOException( e.getMessage() ).initCause( e ); + } + } + + private static void writeMetadata( File metadataFile, Xpp3Dom metadata ) + throws IOException + { + metadataFile.getParentFile().mkdirs(); + + try ( Writer writer = WriterFactory.newXmlWriter( metadataFile ) ) + { + Xpp3DomWriter.write( writer, metadata ); + } + } + +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/PomUtils.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/PomUtils.java new file mode 100644 index 000000000..83eba4ea7 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/PomUtils.java @@ -0,0 +1,64 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.IOException; +import java.io.Reader; + +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.plugin.MojoExecutionException; +import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +/** + * Provides utility methods for POM processing. + * + * @author Benjamin Bentmann + */ +class PomUtils +{ + + /** + * Loads the (raw) model from the specified POM file. + * + * @param pomFile The path to the POM file to load, must not be null. + * @return The raw model, never null. + * @throws MojoExecutionException If the POM file could not be loaded. + */ + public static Model loadPom( File pomFile ) + throws MojoExecutionException + { + try ( Reader reader = ReaderFactory.newXmlReader( pomFile ) ) + { + return new MavenXpp3Reader().read( reader, false ); + } + catch ( XmlPullParserException e ) + { + throw new MojoExecutionException( "Failed to parse POM: " + pomFile, e ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to read POM: " + pomFile, e ); + } + } + +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/ReportUtils.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/ReportUtils.java new file mode 100644 index 000000000..9f4207c72 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/ReportUtils.java @@ -0,0 +1,63 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.FilenameFilter; + +/** + * Provides utility methods for invoker report processing. + * + * @author Benjamin Bentmann + */ +class ReportUtils +{ + + private static class FileFilterOnlyXmlFile + implements FilenameFilter + { + + public boolean accept( File dir, String name ) + { + return name.startsWith( "BUILD-" ) && name.endsWith( ".xml" ); + } + + } + + /** + * Gets the paths to the invoker reports available in the specified directory. + * + * @param reportsDirectory The base directory where the invoker reports are located in, may be null. + * @return The paths to the invoker reports, can be empty but never null. + */ + public static File[] getReportFiles( File reportsDirectory ) + { + File[] reportFiles = + ( reportsDirectory != null ) ? reportsDirectory.listFiles( new FileFilterOnlyXmlFile() ) : null; + + if ( reportFiles == null ) + { + reportFiles = new File[0]; + } + + return reportFiles; + } + +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/Selector.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/Selector.java new file mode 100644 index 000000000..0391dd332 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/Selector.java @@ -0,0 +1,131 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.plugins.invoker.AbstractInvokerMojo.ToolchainPrivateManager; + +/** + * + * @author Robert Scholte + * + */ +class Selector +{ + static final int SELECTOR_MAVENVERSION = 1; + + static final int SELECTOR_JREVERSION = 2; + + static final int SELECTOR_OSFAMILY = 4; + + static final int SELECTOR_TOOLCHAIN = 8; + + static final int SELECTOR_MULTI = 16; + + private final String actualMavenVersion; + + private final String actualJavaVersion; + + private final ToolchainPrivateManager toolchainPrivateManager; + + Selector( String actualMavenVersion, String actualJavaVersion, ToolchainPrivateManager toolchainPrivateManager ) + { + this.actualMavenVersion = actualMavenVersion; + this.actualJavaVersion = actualJavaVersion; + this.toolchainPrivateManager = toolchainPrivateManager; + } + + public int getSelection( InvokerProperties invokerProperties ) + { + if ( !invokerProperties.isSelectorDefined( 1 ) ) + { + return getGlobal( invokerProperties ); + } + + for ( int selectorIndex = 1;; selectorIndex++ ) + { + if ( selectorIndex > 1 && !invokerProperties.isSelectorDefined( selectorIndex ) ) + { + break; + } + + int selection = 0; + if ( !SelectorUtils.isMavenVersion( invokerProperties.getMavenVersion( selectorIndex ), + actualMavenVersion ) ) + { + selection |= SELECTOR_MAVENVERSION; + } + + if ( !SelectorUtils.isJreVersion( invokerProperties.getJreVersion( selectorIndex ), actualJavaVersion ) ) + { + selection |= SELECTOR_JREVERSION; + } + + if ( !SelectorUtils.isOsFamily( invokerProperties.getOsFamily( selectorIndex ) ) ) + { + selection |= SELECTOR_OSFAMILY; + } + + if ( !SelectorUtils.isToolchain( toolchainPrivateManager, + invokerProperties.getToolchains( selectorIndex ) ) ) + { + selection |= SELECTOR_TOOLCHAIN; + } + + if ( selection == 0 ) + { + return 0; + } + } + return SELECTOR_MULTI; + } + + /** + * Determines whether selector conditions of the specified invoker properties match the current environment. + * + * @param invokerProperties The invoker properties to check, must not be null. + * @return 0 if the job corresponding to the properties should be run, otherwise a bitwise value + * representing the reason why it should be skipped. + */ + private int getGlobal( InvokerProperties invokerProperties ) + { + int selection = 0; + if ( !SelectorUtils.isMavenVersion( invokerProperties.getMavenVersion(), actualMavenVersion ) ) + { + selection |= SELECTOR_MAVENVERSION; + } + + if ( !SelectorUtils.isJreVersion( invokerProperties.getJreVersion(), actualJavaVersion.toString() ) ) + { + selection |= SELECTOR_JREVERSION; + } + + if ( !SelectorUtils.isOsFamily( invokerProperties.getOsFamily() ) ) + { + selection |= SELECTOR_OSFAMILY; + } + + if ( !SelectorUtils.isToolchain( toolchainPrivateManager, invokerProperties.getToolchains() ) ) + { + selection |= SELECTOR_TOOLCHAIN; + } + + return selection; + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/SelectorUtils.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/SelectorUtils.java new file mode 100644 index 000000000..eeae0f7a2 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/SelectorUtils.java @@ -0,0 +1,327 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.FilenameFilter; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; + +import org.apache.maven.plugins.invoker.AbstractInvokerMojo.ToolchainPrivateManager; +import org.apache.maven.project.MavenProject; +import org.apache.maven.toolchain.MisconfiguredToolchainException; +import org.apache.maven.toolchain.ToolchainPrivate; +import org.codehaus.plexus.util.Os; +import org.codehaus.plexus.util.StringUtils; + +/** + * Provides utility methods for selecting build jobs based on environmental conditions. + * + * @author Benjamin Bentmann + */ +class SelectorUtils +{ + + static void parseList( String list, Collection includes, Collection excludes ) + { + String[] tokens = ( list != null ) ? StringUtils.split( list, "," ) : new String[0]; + + for ( String token1 : tokens ) + { + String token = token1.trim(); + + if ( token.startsWith( "!" ) ) + { + excludes.add( token.substring( 1 ) ); + } + else + { + includes.add( token ); + } + } + } + + static boolean isOsFamily( String osSpec ) + { + List includes = new ArrayList<>(); + List excludes = new ArrayList<>(); + parseList( osSpec, includes, excludes ); + + return isOsFamily( includes, true ) && !isOsFamily( excludes, false ); + } + + static boolean isOsFamily( List families, boolean defaultMatch ) + { + if ( families != null && !families.isEmpty() ) + { + for ( String family : families ) + { + if ( Os.isFamily( family ) ) + { + return true; + } + } + + return false; + } + else + { + return defaultMatch; + } + } + + /** + * Retrieves the current Maven version. + * + * @return The current Maven version. + */ + static String getMavenVersion() + { + try + { + // This relies on the fact that MavenProject is the in core classloader + // and that the core classloader is for the maven-core artifact + // and that should have a pom.properties file + // if this ever changes, we will have to revisit this code. + Properties properties = new Properties(); + // CHECKSTYLE_OFF: LineLength + properties.load( MavenProject.class.getClassLoader().getResourceAsStream( "META-INF/maven/org.apache.maven/maven-core/pom.properties" ) ); + // CHECKSTYLE_ON: LineLength + return StringUtils.trim( properties.getProperty( "version" ) ); + } + catch ( Exception e ) + { + return null; + } + } + + static String getMavenVersion( File mavenHome ) + { + File mavenLib = new File( mavenHome, "lib" ); + File[] jarFiles = mavenLib.listFiles( new FilenameFilter() + { + public boolean accept( File dir, String name ) + { + return name.endsWith( ".jar" ); + } + } ); + + for ( File file : jarFiles ) + { + try + { + @SuppressWarnings( "deprecation" ) + URL url = + new URL( "jar:" + file.toURL().toExternalForm() + + "!/META-INF/maven/org.apache.maven/maven-core/pom.properties" ); + + Properties properties = new Properties(); + properties.load( url.openStream() ); + String version = StringUtils.trim( properties.getProperty( "version" ) ); + if ( version != null ) + { + return version; + } + } + catch ( MalformedURLException e ) + { + // ignore + } + catch ( IOException e ) + { + // ignore + } + } + return null; + } + + static boolean isMavenVersion( String mavenSpec ) + { + return isMavenVersion( mavenSpec, getMavenVersion() ); + } + + static boolean isMavenVersion( String mavenSpec, String actualVersion ) + { + List includes = new ArrayList<>(); + List excludes = new ArrayList<>(); + parseList( mavenSpec, includes, excludes ); + + List mavenVersionList = parseVersion( actualVersion ); + + return isJreVersion( mavenVersionList, includes, true ) && !isJreVersion( mavenVersionList, excludes, false ); + } + + static String getJreVersion() + { + return System.getProperty( "java.version", "" ); + } + + static String getJreVersion( File javaHome ) + { + // @todo detect actual version + return null; + } + + static boolean isJreVersion( String jreSpec ) + { + return isJreVersion( jreSpec, getJreVersion() ); + } + + static boolean isJreVersion( String jreSpec, String actualJreVersion ) + { + List includes = new ArrayList(); + List excludes = new ArrayList(); + parseList( jreSpec, includes, excludes ); + + List jreVersion = parseVersion( actualJreVersion ); + + return isJreVersion( jreVersion, includes, true ) && !isJreVersion( jreVersion, excludes, false ); + } + + static boolean isJreVersion( List jreVersion, List versionPatterns, boolean defaultMatch ) + { + if ( versionPatterns != null && !versionPatterns.isEmpty() ) + { + for ( String versionPattern : versionPatterns ) + { + if ( isJreVersion( jreVersion, versionPattern ) ) + { + return true; + } + } + + return false; + } + else + { + return defaultMatch; + } + } + + static boolean isJreVersion( List jreVersion, String versionPattern ) + { + List checkVersion = parseVersion( versionPattern ); + + if ( versionPattern.endsWith( "+" ) ) + { + // 1.5+ <=> [1.5,) + return compareVersions( jreVersion, checkVersion ) >= 0; + } + else if ( versionPattern.endsWith( "-" ) ) + { + // 1.5- <=> (,1.5) + return compareVersions( jreVersion, checkVersion ) < 0; + } + else + { + // 1.5 <=> [1.5,1.6) + return checkVersion.size() <= jreVersion.size() + && checkVersion.equals( jreVersion.subList( 0, checkVersion.size() ) ); + } + } + + static List parseVersion( String version ) + { + version = version.replaceAll( "[^0-9]", "." ); + + String[] tokens = StringUtils.split( version, "." ); + + List numbers = new ArrayList(); + + for ( String token : tokens ) + { + numbers.add( Integer.valueOf( token ) ); + } + + return numbers; + } + + static int compareVersions( List version1, List version2 ) + { + for ( Iterator it1 = version1.iterator(), it2 = version2.iterator();; ) + { + if ( !it1.hasNext() ) + { + return it2.hasNext() ? -1 : 0; + } + if ( !it2.hasNext() ) + { + return it1.hasNext() ? 1 : 0; + } + + Integer num1 = it1.next(); + Integer num2 = it2.next(); + + int rel = num1.compareTo( num2 ); + if ( rel != 0 ) + { + return rel; + } + } + } + + /** + * @param toolchainPrivateManager + * @param invokerToolchains + * @return {@code true} if all invokerToolchains are available, otherwise {@code false} + */ + static boolean isToolchain( ToolchainPrivateManager toolchainPrivateManager, + Collection invokerToolchains ) + { + for ( InvokerToolchain invokerToolchain : invokerToolchains ) + { + boolean found = false; + try + { + for ( ToolchainPrivate tc : toolchainPrivateManager.getToolchainPrivates( invokerToolchain.getType() ) ) + { + if ( !invokerToolchain.getType().equals( tc.getType() ) ) + { + // useful because of MNG-5716 + continue; + } + + if ( tc.matchesRequirements( invokerToolchain.getProvides() ) ) + { + found = true; + continue; + } + } + } + catch ( MisconfiguredToolchainException e ) + { + return false; + } + + if ( !found ) + { + return false; + } + } + + return true; + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/SystemPropertyPrinter.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/SystemPropertyPrinter.java new file mode 100644 index 000000000..9c28b1d9d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/SystemPropertyPrinter.java @@ -0,0 +1,42 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Print specified system properties to the output stream. Useful to detect certain values from a JVM different to the + * default JAVA_HOME. + * + * @author Robert Scholte + * @since 1.8 + */ +public class SystemPropertyPrinter +{ + /** + * @param args system properties to print + */ + public static void main( String[] args ) + { + for ( String arg : args ) + { + System.out.println( System.getProperty( arg, "" ) ); + } + } + +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/VerifyMojo.java b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/VerifyMojo.java new file mode 100644 index 000000000..bc4abc468 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/java/org/apache/maven/plugins/invoker/VerifyMojo.java @@ -0,0 +1,156 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Reader; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +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; + +/** + * Checks the results of maven-invoker-plugin based integration tests and fails the build if any tests failed. + * + * @author Olivier Lamy + * @since 1.4 + */ +@Mojo( name = "verify", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true ) +public class VerifyMojo + extends AbstractMojo +{ + + /** + * Flag used to suppress certain invocations. This is useful in tailoring the build using profiles. + * + * @since 1.1 + */ + @Parameter( property = "invoker.skip", defaultValue = "false" ) + private boolean skipInvocation; + + /** + * Base directory where all build reports are read from. + * + * @since 1.4 + */ + @Parameter( property = "invoker.reportsDirectory", defaultValue = "${project.build.directory}/invoker-reports" ) + private File reportsDirectory; + + /** + * A flag controlling whether failures of the sub builds should fail the main build, too. If set to + * true, the main build will proceed even if one or more sub builds failed. + * + * @since 1.3 + */ + @Parameter( property = "maven.test.failure.ignore", defaultValue = "false" ) + private boolean ignoreFailures; + + /** + * Flag used to suppress the summary output notifying of successes and failures. If set to true, the + * only indication of the build's success or failure will be the effect it has on the main build (if it fails, the + * main build should fail as well). + */ + @Parameter( defaultValue = "false" ) + private boolean suppressSummaries; + + /** + * Set this to true to cause a failure if there are no projects to invoke. + * + * @since 1.9 + */ + @Parameter( property = "invoker.failIfNoProjects" ) + private Boolean failIfNoProjects; + + /** + * Set to true to output build.log to mojo log in case of failed jobs. + * + * @since 3.2.2 + */ + @Parameter( property = "invoker.streamLogsOnFailures", defaultValue = "false" ) + private boolean streamLogsOnFailures; + + /** + * Invokes Maven on the configured test projects. + * + * @throws org.apache.maven.plugin.MojoExecutionException If the goal encountered severe errors. + * @throws org.apache.maven.plugin.MojoFailureException If any of the Maven builds failed. + */ + public void execute() + throws MojoExecutionException, MojoFailureException + { + if ( skipInvocation ) + { + getLog().info( "Skipping invocation per configuration." + + " If this is incorrect, ensure the skipInvocation parameter is not set to true." ); + return; + } + + File[] reportFiles = ReportUtils.getReportFiles( reportsDirectory ); + if ( reportFiles.length <= 0 ) + { + if ( Boolean.TRUE.equals( failIfNoProjects ) ) + { + throw new MojoFailureException( "No projects to invoke!" ); + } + getLog().info( "No invoker report files found, nothing to check." ); + return; + } + + BuildJobXpp3Reader reader = new BuildJobXpp3Reader(); + + InvokerSession invokerSession = new InvokerSession(); + + for ( File reportFile : reportFiles ) + { + try ( Reader xmlReader = ReaderFactory.newXmlReader( reportFile ) ) + { + invokerSession.addJob( reader.read( xmlReader ) ); + } + catch ( XmlPullParserException e ) + { + throw new MojoExecutionException( "Failed to parse report file: " + reportFile, e ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to read report file: " + reportFile, e ); + } + } + + if ( !suppressSummaries ) + { + invokerSession.logSummary( getLog(), ignoreFailures ); + } + + if ( streamLogsOnFailures ) + { + invokerSession.logFailedBuildLog( getLog(), ignoreFailures ); + } + + invokerSession.handleFailures( getLog(), ignoreFailures ); + } + +} diff --git a/Java-base/maven-invoker-plugin/src/src/main/mdo/invocation.mdo b/Java-base/maven-invoker-plugin/src/src/main/mdo/invocation.mdo new file mode 100644 index 000000000..bc488f4c9 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/mdo/invocation.mdo @@ -0,0 +1,226 @@ + + + + + + build-job + BuildJob + reportsDirectory.]]> + + + + package + org.apache.maven.plugins.invoker.model + + + + namespace + + + + BuildJob + + Describes a build job processed by the Maven Invoker Plugin. A build job can consist of a pre-build hook script, + one ore more invocations of Maven and a post-build hook script. + + 1.0.0 + + + project + 1.0.0 + true + String + The path to the project to build. This path is usually relative and can denote both a POM file or a project directory. + + + name + 1.0.0 + false + String + The name of this build job. + + + description + 1.0.0 + false + String + The description of this build job. + + + result + 1.0.0 + true + String + The result of this build job. + + + failureMessage + 1.0.0 + false + String + Any failure message(s) in case this build job failed. + + + time + 1.0.0 + true + double + The number of seconds that this build job took to complete. + + + type + 1.0.0 + true + String + The type of the build job. + + + ordinal + 1.0.0 + false + int + BuildJobs will be sorted in the descending order of the ordinal. In other words, the BuildJobs with the highest numbers will be executed first + + + buildlog + 1.0.0 + false + String + The build log filename + + + + + 1.0.0+ + + + + 1.0.0+ + + + + 1.0.0+ + -Dinvoker.test=xxx,yyy parameter. + */ + public static final String DIRECT = "direct"; + + } + ]]> + + + 1.0.0+ + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report.properties b/Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report.properties new file mode 100644 index 000000000..a174ec8f6 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report.properties @@ -0,0 +1,35 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +report.invoker.result.description = The results of the Maven invocations. +report.invoker.result.name = Invoker Build Results +report.invoker.result.title = Invoker Report +report.invoker.summary.title = Summary +report.invoker.summary.number = Builds +report.invoker.summary.success = Success +report.invoker.summary.failed = Failures +report.invoker.summary.skipped = Skipped +report.invoker.summary.success.rate = Success Rate +report.invoker.summary.time.total = Total Time +report.invoker.summary.time.avg = Avg Time +report.invoker.detail.title = Build Details +report.invoker.detail.name = Name +report.invoker.detail.result = Result +report.invoker.detail.time = Time +report.invoker.detail.message = Message +report.invoker.format.percent = 0.0% +report.invoker.format.seconds = 0.0\u00A0s diff --git a/Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report_de.properties b/Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report_de.properties new file mode 100644 index 000000000..d1016e305 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report_de.properties @@ -0,0 +1,35 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +report.invoker.result.description = Die Ergebnisse der Maven-Ausf\u00FChrungen. +report.invoker.result.name = Invoker-Build-Ergebnisse +report.invoker.result.title = Invoker-Bericht +report.invoker.summary.title = Zusammenfassungen +report.invoker.summary.number = Builds +report.invoker.summary.success = Erfolge +report.invoker.summary.failed = Fehlschl\u00E4ge +report.invoker.summary.skipped = Ausgelassen +report.invoker.summary.success.rate = Erfolgsrate +report.invoker.summary.time.total = Gesamtzeit +report.invoker.summary.time.avg = Durchschnittszeit +report.invoker.detail.title = Build-Details +report.invoker.detail.name = Name +report.invoker.detail.result = Ergebnis +report.invoker.detail.time = Zeit +report.invoker.detail.message = Meldung +report.invoker.format.percent = 0.0\u00A0% +report.invoker.format.seconds = 0.0\u00A0s diff --git a/Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report_en.properties b/Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report_en.properties new file mode 100644 index 000000000..e1bb9d4b1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report_en.properties @@ -0,0 +1,23 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# NOTE: +# This bundle is intentionally empty because English strings are provided by the base bundle via the parent chain. It +# must be provided nevertheless such that a request for locale "en" will not erroneously pick up the bundle for the +# JVM's default locale (which need not be "en"). See the method javadoc about +# ResourceBundle.getBundle(String, Locale, ClassLoader) +# for a full description of the lookup strategy. \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report_fr.properties b/Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report_fr.properties new file mode 100644 index 000000000..64e4a5a99 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/main/resources/invoker-report_fr.properties @@ -0,0 +1,35 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +report.invoker.result.description = Résultat des invocations de Maven +report.invoker.result.name = Invoker Résultat de builds +report.invoker.result.title = Invoker Rapport +report.invoker.summary.title = Sommaire +report.invoker.summary.number = Builds +report.invoker.summary.success = Réussis +report.invoker.summary.failed = Echecs +report.invoker.summary.skipped = Ignorés +report.invoker.summary.success.rate = Taux de réussite +report.invoker.summary.time.total = Durée totale +report.invoker.summary.time.avg = Durée moyenne +report.invoker.detail.title = Détails de Build +report.invoker.detail.name = Nom +report.invoker.detail.result = Résultat +report.invoker.detail.time = Durée +report.invoker.detail.message = Message +report.invoker.format.percent = 0.0% +report.invoker.format.seconds = 0.0\u00A0s diff --git a/Java-base/maven-invoker-plugin/src/src/site/apt/examples/access-test-classes.apt.vm b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/access-test-classes.apt.vm new file mode 100644 index 000000000..74fabd4ef --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/access-test-classes.apt.vm @@ -0,0 +1,64 @@ + ------ + Accessing Test Classes + ------ + Benjamin Bentmann + ------ + 2008-08-02 + ------ + + ~~ Licensed to the Apache Software Foundation (ASF) under one + ~~ or more contributor license agreements. See the NOTICE file + ~~ distributed with this work for additional information + ~~ regarding copyright ownership. The ASF licenses this file + ~~ to you under the Apache License, Version 2.0 (the + ~~ "License"); you may not use this file except in compliance + ~~ with the License. You may obtain a copy of the License at + ~~ + ~~ http://www.apache.org/licenses/LICENSE-2.0 + ~~ + ~~ Unless required by applicable law or agreed to in writing, + ~~ software distributed under the License is distributed on an + ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~~ KIND, either express or implied. See the License for the + ~~ specific language governing permissions and limitations + ~~ under the License. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Accessing Test Classes + + In case your pre-/post-build scripts perform complex operations that you would rather like to refactor out into some + utility class instead of copy&pasting them in each script, you can use the parameter <<>>: + ++---- + + + + + maven-invoker-plugin + ${project.version} + + true + + + + integration-test + + run + + + + + + + ++---- + + Setting <<>> to <<>> will prepend the directories <<<$\{project.build.testOutputDirectory\}>>>, + <<<$\{project.build.outputDirectory\}>>> and all dependencies of your project to the class path of the script + interpreter. Among others, this allows you to create some utility classes in your test source tree and use this code + for the hook scripts. + + Of course, this requires your test classes to be compiled before running the integration tests but this is + usually the case if you employ the Invoker Plugin during the lifecycle phase <<>>. diff --git a/Java-base/maven-invoker-plugin/src/src/site/apt/examples/clone-projects.apt.vm b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/clone-projects.apt.vm new file mode 100644 index 000000000..0c52bffa1 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/clone-projects.apt.vm @@ -0,0 +1,72 @@ + ------ + Cloning Projects + ------ + Paul Gier + ------ + 2008-08-02 + ------ + + ~~ Licensed to the Apache Software Foundation (ASF) under one + ~~ or more contributor license agreements. See the NOTICE file + ~~ distributed with this work for additional information + ~~ regarding copyright ownership. The ASF licenses this file + ~~ to you under the Apache License, Version 2.0 (the + ~~ "License"); you may not use this file except in compliance + ~~ with the License. You may obtain a copy of the License at + ~~ + ~~ http://www.apache.org/licenses/LICENSE-2.0 + ~~ + ~~ Unless required by applicable law or agreed to in writing, + ~~ software distributed under the License is distributed on an + ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~~ KIND, either express or implied. See the License for the + ~~ specific language governing permissions and limitations + ~~ under the License. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Cloning Projects + + By default the projects will be executed in the same directory where they are found. + This means that build output will be generated with the project files. It may be + helpful to copy the projects to another directory before running them, for example + <<>>. This will allow <<>> to remove the output generated + by all of the test projects. + ++------------------ + + ... + + + + maven-invoker-plugin + ${project.version} + + src/it + \${project.build.directory}/it + + + + integration-test + + run + + + + + + + ... + ++------------------ + + There is another benefit of cloning the projects to a temporary location besides keeping the source tree free of build + output. When the projects are not cloned, the plugin must use temporary POMs to perform their filtering. In contrast, + cloning the projects enables the plugin to simply filter the cloned POMs in-place. Since a POM's file name remains + unchanged this way, the inter-project dependencies expressed in the POMs via <<<\>>> and <<<\>>> + elements remain intact, too. This in turn allows the plugin to filter all POMs that participate in a forked build + rather than only the root POM of the execution. + + Last but not least, once the projects have been cloned and filtered by an execution of <<>>, you can + browse to a cloned project and manually invoke Maven on it. This can be useful to debug the build. diff --git a/Java-base/maven-invoker-plugin/src/src/site/apt/examples/fast-use.apt.vm b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/fast-use.apt.vm new file mode 100644 index 000000000..c6076628a --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/fast-use.apt.vm @@ -0,0 +1,143 @@ + ------ + Fast Build Configuration + ------ + Olivier Lamy + ------ + 2008-08-02 + ------ + + ~~ Licensed to the Apache Software Foundation (ASF) under one + ~~ or more contributor license agreements. See the NOTICE file + ~~ distributed with this work for additional information + ~~ regarding copyright ownership. The ASF licenses this file + ~~ to you under the Apache License, Version 2.0 (the + ~~ "License"); you may not use this file except in compliance + ~~ with the License. You may obtain a copy of the License at + ~~ + ~~ http://www.apache.org/licenses/LICENSE-2.0 + ~~ + ~~ Unless required by applicable law or agreed to in writing, + ~~ software distributed under the License is distributed on an + ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~~ KIND, either express or implied. See the License for the + ~~ specific language governing permissions and limitations + ~~ under the License. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Fast Build Configuration + + If you follow the recommended approach and use a dedicated local repository for the integration tests (e.g. + <<>>), you will likely encounter long build times. If the test repository has been cleaned, the + plugin needs to re-download all artifacts from the central repo and the resulting network traffic slows the test + execution down. + + But you can configure the plugin to download released artifacts from your local repo. + This will work without optional settings with Maven >= 2.0.9 because many plugins + versions are locked in the super POM. For older versions, you have to lock plugins versions. + + To enable this feature, you have to add a <<>> file in your project (for example in <<>>) + and modify the plugin configuration as this: + ++------------------ + + ... + + + + org.apache.maven.plugins + maven-invoker-plugin + ${project.version} + + ... + src/it/settings.xml + ... + + + + + ... + ++------------------ + + The settings must contain the following content which effectively tells Maven to use the local repository as a remote + repository: + ++------------------ + + + + + it-repo + + true + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + ++------------------ + + The token <<<@localRepositoryUrl@>>> will be automatically replaced by the Invoker Plugin with the URL to the local + repository used for the Maven invocation. + +Fast Build Configuration - mergeUserSettings and mirrors + + When you want to use Fast Build Configuration with options <<>> + you should take care for your mirror setting. + + If you have in <<<~/.m2/settings.xml>>> something like: + ++------------------ + + + mirrorId + Public Mirrors + url_to_my_mirror + *,!repo1,!repo2 + + ++------------------ + + Please look at <<>> tag, single <<<*>>> means match all repositories for mirroring + - also repository with id <<>> will be mirrored. + In effective Fast Build Configuration will not work as expected. + + You should change this to similar: + ++------------------ + + + mirrorId + Public Mirrors + url_to_my_mirror + external:*,!repo1,!repo2 + + ++------------------ + + Where <<>> - matches all repositories except those using localhost or file based repositories. diff --git a/Java-base/maven-invoker-plugin/src/src/site/apt/examples/filtering.apt.vm b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/filtering.apt.vm new file mode 100644 index 000000000..0f5c09e41 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/filtering.apt.vm @@ -0,0 +1,136 @@ + ------ + Filtering Files + ------ + Benjamin Bentmann + ------ + 2008-08-30 + ------ + + ~~ Licensed to the Apache Software Foundation (ASF) under one + ~~ or more contributor license agreements. See the NOTICE file + ~~ distributed with this work for additional information + ~~ regarding copyright ownership. The ASF licenses this file + ~~ to you under the Apache License, Version 2.0 (the + ~~ "License"); you may not use this file except in compliance + ~~ with the License. You may obtain a copy of the License at + ~~ + ~~ http://www.apache.org/licenses/LICENSE-2.0 + ~~ + ~~ Unless required by applicable law or agreed to in writing, + ~~ software distributed under the License is distributed on an + ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~~ KIND, either express or implied. See the License for the + ~~ specific language governing permissions and limitations + ~~ under the License. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Filtering Files + + Some files of the sub projects can be filtered, i.e. special tokens will be replaced by some other string before the + actual build is started. In detail, the following files will be filtered: + + * POM files selected by the include/exclude patterns. The tokens to be filtered must be enclosed in <<<@...@>>> to + avoid interferences with Maven's normal POM interpolation, i.e. use <<<@project.version@>>> instead of + <<<$\{project.version\}>>>. Starting with version 1.3, the plugin will also (recursively) filter all POM files + referenced via <<<\>>> or <<<\>>> tags, if the projects are cloned to a temporary location. + + * The custom user setting file. Again, the tokens to be filtered in this file must be enclosed in <<<@...@>>>. + + * The invoker properties, the goals file and the profiles file. Tokens in these files must use the usual Maven syntax + <<<$\{...\}>>>. + + [] + + The following example directory structure highlights the files which are filtered by the Invoker Plugin: + ++------------------ +./ ++- pom.xml ++- src/ + +- it/ + +- settings.xml <- Filtered + +- aggregator-project/ + +- child-module-1/ + | +- pom.xml <- Filtered + +- child-module-2/ + | +- pom.xml <- Filtered + +- pom.xml <- Filtered + +- invoker.properties <- Filtered + +- goals.txt <- Filtered + +- profiles.txt <- Filtered ++------------------ + + Below is the corresponding POM snippet for the plugin configuration: + ++------------------ + + + another-value + + ... + + + + maven-invoker-plugin + ${project.version} + + src/it + \${project.build.directory}/it + + */pom.xml + + src/it/settings.xml + + some-value + + + + + integration-test + + run + + + + + + + ++------------------ + + When filtering the files, the plugin searches various data sources for a token's replacement value in the order + indicated below. The search terminates as soon as an existing replacement value has been found, i.e. the value + is not <<>>. + + [[1]] Tokens of the form <<>> and <<>> will be expanded to the referenced POM value if possible, + e.g. <<>> refers to the version given in the <<>> that executed the Invoker Plugin. + If no such POM element exists, the value lookup continues as outlined next. + + [[2]] Built-in properties defined by the Invoker Plugin will be processed. See this table for a list of available + built-in properties: + +*--------------------------+----------------------------------------------------------------------------------+--------+ +|| Built-in Property || Value || Since | +*--------------------------+----------------------------------------------------------------------------------+--------+ +| <<>> | The absolute path to the project base directory of the main build. | 1.1 | +*--------------------------+----------------------------------------------------------------------------------+--------+ +| <<>> | The <<>> URL to the project base directory of the main build. | 1.4 | +*--------------------------+----------------------------------------------------------------------------------+--------+ +| <<>> | The absolute path to the local repository used for the main build. | 1.2 | +*--------------------------+----------------------------------------------------------------------------------+--------+ +| <<>> | The <<>> URL to the local repository used for the main build. | 1.3 | +*--------------------------+----------------------------------------------------------------------------------+--------+ + + [[3]] The properties given by the parameter <<>> in the plugin configuration will be consulted for + a property whose key equals the token. For the example POM shown above, the value <<>> has been + associated with the token <<>>. + + [[4]] The properties given by the POM's <<<\>>> section will be searched for a property whose key equals + the token. Regarding the example POM, the value <<>> has been associated with the token + <<>>. + + [] + + Tokens for which no replacement value could be determined will be left unchanged. diff --git a/Java-base/maven-invoker-plugin/src/src/site/apt/examples/install-artifacts.apt.vm b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/install-artifacts.apt.vm new file mode 100644 index 000000000..26f620e31 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/install-artifacts.apt.vm @@ -0,0 +1,66 @@ + ------ + Installing Artifacts + ------ + Paul Gier + ------ + 2008-08-02 + ------ + + ~~ Licensed to the Apache Software Foundation (ASF) under one + ~~ or more contributor license agreements. See the NOTICE file + ~~ distributed with this work for additional information + ~~ regarding copyright ownership. The ASF licenses this file + ~~ to you under the Apache License, Version 2.0 (the + ~~ "License"); you may not use this file except in compliance + ~~ with the License. You may obtain a copy of the License at + ~~ + ~~ http://www.apache.org/licenses/LICENSE-2.0 + ~~ + ~~ Unless required by applicable law or agreed to in writing, + ~~ software distributed under the License is distributed on an + ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~~ KIND, either express or implied. See the License for the + ~~ specific language governing permissions and limitations + ~~ under the License. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Installing Artifacts + + The following example shows a plugin configuration using the <<<{{{../install-mojo.html}invoker:install}}>>> + goal. This will cause the project artifact(s) to be installed to a dedicated local + repository before executing the projects. This can be helpful if you + want to build your project and test the new artifact(s) in a single step instead of + installing first and then running tests. + ++------------------ + + ... + + + + maven-invoker-plugin + ${project.version} + + src/it + target/local-repo + + + + integration-test + + install + run + + + + + + + ... + ++------------------ + + + \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/site/apt/examples/integration-test-verify.apt.vm b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/integration-test-verify.apt.vm new file mode 100644 index 000000000..c5a363e7d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/integration-test-verify.apt.vm @@ -0,0 +1,60 @@ + ------ + Using with other integration test frameworks + ------ + Stephen Connolly + ------ + 2009-08-15 + ------ + + ~~ Licensed to the Apache Software Foundation (ASF) under one + ~~ or more contributor license agreements. See the NOTICE file + ~~ distributed with this work for additional information + ~~ regarding copyright ownership. The ASF licenses this file + ~~ to you under the Apache License, Version 2.0 (the + ~~ "License"); you may not use this file except in compliance + ~~ with the License. You may obtain a copy of the License at + ~~ + ~~ http://www.apache.org/licenses/LICENSE-2.0 + ~~ + ~~ Unless required by applicable law or agreed to in writing, + ~~ software distributed under the License is distributed on an + ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~~ KIND, either express or implied. See the License for the + ~~ specific language governing permissions and limitations + ~~ under the License. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Using with other integration test frameworks + + If you are using other integration test frameworks, or if you need to setup an integration test enviroment prior to + test execution and tear that envronment down afterwards, then you need to use the <<>> and + <<>> goals in place of <<>>. For example: + ++---- + + + + + org.apache.maven.plugins + maven-invoker-plugin + ${project.version} + + + integration-test + + + integration-test + verify + + + + + + + ++---- + + This will allow any plugins bound to the <<>> phase to execute before the <<>> phase + executes the <<>> goal that we have just bound. diff --git a/Java-base/maven-invoker-plugin/src/src/site/apt/examples/invoker-properties.apt.vm b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/invoker-properties.apt.vm new file mode 100644 index 000000000..f226aa950 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/invoker-properties.apt.vm @@ -0,0 +1,93 @@ + ------ + Invoker Properties + ------ + Benjamin Bentmann + ------ + 2008-08-09 + ------ + + ~~ Licensed to the Apache Software Foundation (ASF) under one + ~~ or more contributor license agreements. See the NOTICE file + ~~ distributed with this work for additional information + ~~ regarding copyright ownership. The ASF licenses this file + ~~ to you under the Apache License, Version 2.0 (the + ~~ "License"); you may not use this file except in compliance + ~~ with the License. You may obtain a copy of the License at + ~~ + ~~ http://www.apache.org/licenses/LICENSE-2.0 + ~~ + ~~ Unless required by applicable law or agreed to in writing, + ~~ software distributed under the License is distributed on an + ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~~ KIND, either express or implied. See the License for the + ~~ specific language governing permissions and limitations + ~~ under the License. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Invoker Properties + + The various parameters in the plugin configuration provide a means to globally configure the goals, profiles etc. + used to run a Maven build on the projects. However, for certain projects you might want to specify different settings. + To avoid the hassle of multiple plugin executions, you can simply use a file named <<>> to + control the build settings on a per project basis or in one of its ancestor folders to apply it for a group of projects. + The exact name of this properties file is configurable but it needs to reside in the base directory of the respective + project as shown below: + + ++------------------ +./ ++- src/ + +- it/ + +- group-1 + +- invoker.properties + +- test-project/ + +- pom.xml + +- invoker.properties + +- src/ ++------------------ + + There are only a few keys supported in this file and their names typically match the corresponding parameters in the + plugin configuration. For a complete overview of supported properties, see the example given in the documentation of + the plugin parameter <<<{{{../run-mojo.html#invokerPropertiesFile}invokerPropertiesFile}}>>>. + + The comments given in the example should be rather self-explanatory. Looking closely, you can also notice that the + syntax <<<$\{expression\}>>> can be used to filter the property values. What deserves some more description is the + possibility to perform several Maven builds on the same project. By default, the Invoker Plugin will perform the + following steps for each project: + + * Run the pre build hook script if existent + + * Invoke Maven in the project directory + + * Run the post build hook script if existent + + [] + + Since plugin version 1.3, you can append a one-based index to the invoker properties in order to enable/configure + further invocations of Maven. More precisely, <<>> specifies the goals for the first build, + <<>> lists the goals for the second build and so on. These builds will be performed one after the + other: + + * Run the pre build hook script if existent + + * Invoke Maven in the project directory + + * Invoke Maven in the project directory + + * ... + + * Invoke Maven in the project directory + + * Run the post build hook script if existent + + [] + + Most of the properties can be indexed this way, e.g. <<>> would specify the profiles to use for + the third invocation. If the property <<>> was not defined, the plugin would query the property + <<>> as a fallback to determine the profiles for the third build. This build loop ends after + invocation if no property <<>> is defined. + + The invoker properties can also be used to skip projects based on the current JRE version or OS family. For more + information on this feature, please see {{{./selector-conditions.html}Selector Conditions}}. diff --git a/Java-base/maven-invoker-plugin/src/src/site/apt/examples/logs-for-failed-tests.apt.vm b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/logs-for-failed-tests.apt.vm new file mode 100644 index 000000000..57e3f6291 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/logs-for-failed-tests.apt.vm @@ -0,0 +1,56 @@ + ------ + Inspect logs for failed tests + ------ + Slawomir Jaranowski + ------ + 2020-05-20 + ------ + + ~~ Licensed to the Apache Software Foundation (ASF) under one + ~~ or more contributor license agreements. See the NOTICE file + ~~ distributed with this work for additional information + ~~ regarding copyright ownership. The ASF licenses this file + ~~ to you under the Apache License, Version 2.0 (the + ~~ "License"); you may not use this file except in compliance + ~~ with the License. You may obtain a copy of the License at + ~~ + ~~ http://www.apache.org/licenses/LICENSE-2.0 + ~~ + ~~ Unless required by applicable law or agreed to in writing, + ~~ software distributed under the License is distributed on an + ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~~ KIND, either express or implied. See the License for the + ~~ specific language governing permissions and limitations + ~~ under the License. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Inspect logs for failed tests + + In the usual build all tests pass as we expect, + so printing logs from all tests to project build log make our standard build log illegible. + The problem begin when some of test was failed, + especially when happened on CI system when access to files from build workspace is difficult. + + In order to help investigation on failed test we can use option: <<>>. + Now logs from all failed test will be printed to project build log when all test will have finished. + ++---+ + + ... + + + + org.apache.maven.plugins + maven-invoker-plugin + ${project.version} + + true + + + + + ... + ++---+ diff --git a/Java-base/maven-invoker-plugin/src/src/site/apt/examples/post-build-script.apt.vm b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/post-build-script.apt.vm new file mode 100644 index 000000000..a58bda52b --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/post-build-script.apt.vm @@ -0,0 +1,97 @@ + ------ + Using a Post-Build Script + ------ + Paul Gier + ------ + 2008-08-02 + ------ + + ~~ Licensed to the Apache Software Foundation (ASF) under one + ~~ or more contributor license agreements. See the NOTICE file + ~~ distributed with this work for additional information + ~~ regarding copyright ownership. The ASF licenses this file + ~~ to you under the Apache License, Version 2.0 (the + ~~ "License"); you may not use this file except in compliance + ~~ with the License. You may obtain a copy of the License at + ~~ + ~~ http://www.apache.org/licenses/LICENSE-2.0 + ~~ + ~~ Unless required by applicable law or agreed to in writing, + ~~ software distributed under the License is distributed on an + ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~~ KIND, either express or implied. See the License for the + ~~ specific language governing permissions and limitations + ~~ under the License. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Using a Post-Build Script + + Here is an example of how the Invoker Plugin can be used to run a set of Maven projects and then verify their output + with a {{{http://www.beanshell.org/}BeanShell}} or {{{http://groovy-lang.org/}Groovy}} script. The name of the + script file in this case is <<>>. + ++------------------ + + + + + maven-invoker-plugin + ${project.version} + + true + src/it + setup.bsh + verify.bsh + + + + integration-test + + run + + + + + + + ++------------------ + + Below is an example post-build BeanShell script (<<>>) that checks for the existence of a JAR file after + the build has run. If the JAR file does not exist, the script throws an exception which causes the Invoker Plugin to + log that the build failed. More precisely, any non-null return value which does not equal <<>> will be interpreted + as a failure condition. And of course, if the script exists abnormally due to an exception, the plugin will flag the + corresponding build as a failure, too. + ++------------------ +import java.io.*; + +File file = new File( basedir, "target/my-test-project-1.0-SNAPSHOT.jar" ); +if ( !file.isFile() ) +{ + throw new FileNotFoundException( "Could not find generated JAR: " + file ); +} ++------------------ + + Complementary to the post-build hook script, you can also create a pre-build hook script that will be run before + the invocation of Maven. This can be used to do some preparations for the build. + + To allow the scripts to access some useful data about the test project, the following global variables will be + defined by the Invoker Plugin before running the script: + +*--------------------------+----------------------+-----------------------------------------------------------+--------+ +|| Name || Type || Description || Since | +*--------------------------+----------------------+-----------------------------------------------------------+--------+ +| <<>> | <<>> | The absolute path to the base directory of the test project. | 1.0 | +*--------------------------+----------------------+-----------------------------------------------------------+--------+ +| <<>>| <<>> | The absolute path to the local repository used for the Maven invocation on the test project. | 1.3 | +*--------------------------+----------------------+-----------------------------------------------------------+--------+ +| <<>> | <<>> | The storage of key-value pairs used to pass data from the pre-build hook script to the post-build hook script. | 1.4 | +*--------------------------+----------------------+-----------------------------------------------------------+--------+ +| <<>> | <<>> | The version of Maven executing on the test project. | 1.9 | +*--------------------------+----------------------+-----------------------------------------------------------+--------+ + + Additional variables that can be accessed in the hook scripts can be defined through the + <<<{{{../run-mojo.html#scriptVariables}scriptVariables}}>>> parameter in the Invoker Plugin's configuration. \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/site/apt/examples/prepare-build-env.apt.vm b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/prepare-build-env.apt.vm new file mode 100644 index 000000000..f99683d0c --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/prepare-build-env.apt.vm @@ -0,0 +1,75 @@ + ------ + Preparing the Build Environment + ------ + Benjamin Bentmann + ------ + 2008-08-17 + ------ + + ~~ Licensed to the Apache Software Foundation (ASF) under one + ~~ or more contributor license agreements. See the NOTICE file + ~~ distributed with this work for additional information + ~~ regarding copyright ownership. The ASF licenses this file + ~~ to you under the Apache License, Version 2.0 (the + ~~ "License"); you may not use this file except in compliance + ~~ with the License. You may obtain a copy of the License at + ~~ + ~~ http://www.apache.org/licenses/LICENSE-2.0 + ~~ + ~~ Unless required by applicable law or agreed to in writing, + ~~ software distributed under the License is distributed on an + ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~~ KIND, either express or implied. See the License for the + ~~ specific language governing permissions and limitations + ~~ under the License. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Preparing the Build Environment + + In general, the plugin assumes that the projects to build are unrelated to one other such that their build order does + not matter. However, you might sometimes want to ensure that certain projects are build before others. As a + motivation, imagine that a project performs some kind of common setup for the other projects, e.g. installing utility + artifacts into the local repository. + + Starting with plugin version 1.3, you can declare a group of setup projects that must be run before all the other + projects by means of the parameter <<<\>>> as shown in the following example: + ++---- + + + + + maven-invoker-plugin + ${project.version} + + + utility-plugin/pom.xml + + + */pom.xml + + + + + integration-test + + run + + + + + + + ++---- + + This tells the plugin that the project <<>> must be run before the other projects selected by + the pattern <<<*/pom.xml>>>. Please note that although the pattern <<<*/pom.xml>>> also matches the path + <<>>, this project will not be run twice. In other words, any project selected by both + <<<\>>> and <<<\>>> will only be run once, namely during the setup phase. + + The build order of several such setup projects is still undefined. So if the setup projects have inter-dependencies + that require a certain build order, you should group them by an aggregator POM and feed that into the Invoker Plugin + such that the correct build order will be determined by Maven's multi-module reactor. diff --git a/Java-base/maven-invoker-plugin/src/src/site/apt/examples/selector-conditions.apt.vm b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/selector-conditions.apt.vm new file mode 100644 index 000000000..d16561932 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/selector-conditions.apt.vm @@ -0,0 +1,67 @@ + ------ + Selector Conditions + ------ + Benjamin Bentmann + ------ + 2009-09-19 + ------ + + ~~ Licensed to the Apache Software Foundation (ASF) under one + ~~ or more contributor license agreements. See the NOTICE file + ~~ distributed with this work for additional information + ~~ regarding copyright ownership. The ASF licenses this file + ~~ to you under the Apache License, Version 2.0 (the + ~~ "License"); you may not use this file except in compliance + ~~ with the License. You may obtain a copy of the License at + ~~ + ~~ http://www.apache.org/licenses/LICENSE-2.0 + ~~ + ~~ Unless required by applicable law or agreed to in writing, + ~~ software distributed under the License is distributed on an + ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~~ KIND, either express or implied. See the License for the + ~~ specific language governing permissions and limitations + ~~ under the License. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Selector Conditions + + Starting with plugin version 1.4, some keys of the {{{./invoker-properties.html}Invoker Properties}} can be used to + skip individual projects based on the current JRE version or OS family as illustrated in the example below: + ++------------------ +# build project if JRE version is 1.4 or higher, but exclude version 1.4.1 +invoker.java.version = 1.4+, !1.4.1 + +# build project if OS family is not Windows +invoker.os.family = !windows ++------------------ + + In addition, with plugin version 1.5, there is the ability to skip individual projects based on the current Maven + version as illustrated in the example below: + ++------------------ +# build project if Maven version is 2.0.10 or higher, but exclude versions 2.1.0 and 2.2.0 +invoker.maven.version = 2.0.10+, !2.1.0, !2.2.0 ++------------------ + + The values of these keys are comma separated tokens. A token prefixed with "!" denotes an exclusion, otherwise it + denotes an inclusion. A project is build if no exclusion matches and if no inclusions are given or at least one of + them matches the current environment. + + The tokens to describe versions can be suffixed with "+" or "-". The table below shows how the different styles + of version tokens translate to a version range: + +*----------------+----------------------------+ +|| Version Token || Equivalent Version Range | +*----------------+----------------------------+ +| 1.5 | [1.5,1.6) | +*----------------+----------------------------+ +| 1.5+ | [1.5,) | +*----------------+----------------------------+ +| 1.5- | (,1.5) | +*----------------+----------------------------+ + + For the OS family, the tokens "windows", "unix" and "mac" are supported. diff --git a/Java-base/maven-invoker-plugin/src/src/site/apt/examples/selector-scripts.apt.vm b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/selector-scripts.apt.vm new file mode 100644 index 000000000..43072dfe9 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/selector-scripts.apt.vm @@ -0,0 +1,88 @@ + ------ + Selector Scripts + ------ + Stephen Connolly + ------ + 2009-10-20 + ------ + + ~~ Licensed to the Apache Software Foundation (ASF) under one + ~~ or more contributor license agreements. See the NOTICE file + ~~ distributed with this work for additional information + ~~ regarding copyright ownership. The ASF licenses this file + ~~ to you under the Apache License, Version 2.0 (the + ~~ "License"); you may not use this file except in compliance + ~~ with the License. You may obtain a copy of the License at + ~~ + ~~ http://www.apache.org/licenses/LICENSE-2.0 + ~~ + ~~ Unless required by applicable law or agreed to in writing, + ~~ software distributed under the License is distributed on an + ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~~ KIND, either express or implied. See the License for the + ~~ specific language governing permissions and limitations + ~~ under the License. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Selector Scripts + + Starting with plugin version 1.5, a custom script can be used to skip individual projects based on + whatever criteria expressed in the script as illustrated in the following example. Assume the + following directory structure: + ++------------------ +./ ++- pom.xml ++- src/ + +- it/ + +- settings.xml + +- conditional-it/ + +- pom.xml + +- check-assumptions.bsh + +- src/ ++------------------ + + The plugin configuration for this example would look like this: + ++------------------ + + ... + + + + maven-invoker-plugin + ${project.version} + + src/it + \${project.build.directory}/it + + */pom.xml + + src/it/settings.xml + \${project.build.directory}/local-repo + check-assumptions.bsh + + + + integration-test + + install + run + + + + + + + ... + ++------------------ + + If the check-assumptions.bsh script returns <<>> or does not return a value, then the project will be executed. + + If the script returns any value other than <<>>, then the project will not be executed. + + If the script throws an exception, then the project will be marked as being in ERROR. + diff --git a/Java-base/maven-invoker-plugin/src/src/site/apt/examples/skipping.apt.vm b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/skipping.apt.vm new file mode 100644 index 000000000..064bc5b10 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/apt/examples/skipping.apt.vm @@ -0,0 +1,62 @@ + ------ + Skipping Invocations + ------ + Mark Struberg + ------ + 2009-12-20 + ------ + + ~~ Licensed to the Apache Software Foundation (ASF) under one + ~~ or more contributor license agreements. See the NOTICE file + ~~ distributed with this work for additional information + ~~ regarding copyright ownership. The ASF licenses this file + ~~ to you under the Apache License, Version 2.0 (the + ~~ "License"); you may not use this file except in compliance + ~~ with the License. You may obtain a copy of the License at + ~~ + ~~ http://www.apache.org/licenses/LICENSE-2.0 + ~~ + ~~ Unless required by applicable law or agreed to in writing, + ~~ software distributed under the License is distributed on an + ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~~ KIND, either express or implied. See the License for the + ~~ specific language governing permissions and limitations + ~~ under the License. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Skipping Invocations + + The Invoker Plugin usually performs an installation setup and runs the configured Maven invocations. Since version + 1.4 of the plugin all these steps may be skipped. + + To skip running the invocations for a particular project, set the <<>> property to <<>>. The + artifact staging to a local repository can be skipped by setting the parameter <<>> to <<>>. + ++---+ + + ... + + + + org.apache.maven.plugins + maven-invoker-plugin + ${project.version} + + true + true + + + + + ... + ++---+ + + All these steps can also be omited via the command line by use of the <<>> property: + ++---+ +mvn install -Dinvoker.skip=true ++---+ + diff --git a/Java-base/maven-invoker-plugin/src/src/site/apt/index.apt.vm b/Java-base/maven-invoker-plugin/src/src/site/apt/index.apt.vm new file mode 100644 index 000000000..59e665ef9 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/apt/index.apt.vm @@ -0,0 +1,105 @@ + ------ + Introduction + ------ + Jason van Zyl + ------ + 2013-07-22 + ------ + + ~~ Licensed to the Apache Software Foundation (ASF) under one + ~~ or more contributor license agreements. See the NOTICE file + ~~ distributed with this work for additional information + ~~ regarding copyright ownership. The ASF licenses this file + ~~ to you under the Apache License, Version 2.0 (the + ~~ "License"); you may not use this file except in compliance + ~~ with the License. You may obtain a copy of the License at + ~~ + ~~ http://www.apache.org/licenses/LICENSE-2.0 + ~~ + ~~ Unless required by applicable law or agreed to in writing, + ~~ software distributed under the License is distributed on an + ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~~ KIND, either express or implied. See the License for the + ~~ specific language governing permissions and limitations + ~~ under the License. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +${project.name} + + The Invoker Plugin is used to run a set of Maven projects. The plugin can determine whether each project execution + is successful, and optionally can verify the output generated from a given project execution. + + This plugin is in particular handy to perform integration tests for other Maven plugins. The Invoker Plugin can be + employed to run a set of test projects that have been designed to assert certain features of the plugin under test. + +* Goals Overview + + The plugin has four goals meant to participate in the default build lifecycle: + + * {{{./install-mojo.html}invoker:install}} copies the project artifacts and dependencies of the main build into a + dedicated local repository to prepare the execution of the selected sub projects in an isolated environment. + + * {{{./integration-test-mojo.html}invoker:integration-test}} runs a set of Maven projects in a directory. + + * {{{./verify-mojo.html}invoker:verify}} verifies the result of <<>>. + + * {{{./run-mojo.html}invoker:run}} runs a set of Maven projects in a directory and verifies the result. This is + equivalent to running both <<>> and <<>>. + + [] + + This last goal is intended for usage with the site lifecycle: + + * {{{./report-mojo.html}invoker:report}} integrates the results from previous builds into the site. + + [] + +* Usage + + General instructions on how to use the Invoker Plugin can be found on the {{{./usage.html}usage page}}. Some more + specific use cases are described in the examples given below. + + In case you still have questions regarding the plugin's usage, please have a look at the {{{./faq.html}FAQ}} and feel + free to contact the {{{./mailing-lists.html}user mailing list}}. The posts to the mailing list are archived and could + already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching + the {{{./mailing-lists.html}mail archive}}. + + If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our + {{{./issue-management.html}issue tracker}}. When creating a new issue, please provide a comprehensive description of your + concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, + entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. + Of course, patches are welcome, too. Contributors can check out the project from our + {{{./scm.html}source repository}} and will find supplementary information in the + {{{http://maven.apache.org/guides/development/guide-helping.html}guide to helping with Maven}}. + +* Examples + + The following example configurations are available to illustrate selected use cases in more detail: + + * {{{./examples/clone-projects.html}Clone projects}} to a temporary directory before running. + + * {{{./examples/filtering.html}Filter files}} to introduce some updates before starting the build. + + * {{{./examples/install-artifacts.html}Install}} projects artifacts to a local repository before running. + + * {{{./examples/post-build-script.html}Run a BeanShell or Groovy script}} to verify project output. + + * {{{./examples/fast-use.html}Fast Invoker Plugin configuration}} to accelerate project execution. + + * {{{./examples/access-test-classes.html}Access test classes}} to share code between hook scripts. + + * {{{./examples/invoker-properties.html}Use Invoker Properties}} to configure goals, profiles etc. for individual projects. + + * {{{./examples/selector-conditions.html}Use Selector Conditions}} to skip projects based on JRE version or OS family. + + * {{{./examples/prepare-build-env.html}Prepare the Build Environment}} by building some setup projects before other projects. + + * {{{./examples/integration-test-verify.html}Using with other integration test frameworks}} by decoupling checking + the results of the integration tests from executing the integration tests. + + [] + + You can also study some real-life usages of the Invoker Plugin by browsing its own integration tests which are located + in the directory <<>> of the {{{./scm.html}project source tree}}. diff --git a/Java-base/maven-invoker-plugin/src/src/site/apt/usage.apt.vm b/Java-base/maven-invoker-plugin/src/src/site/apt/usage.apt.vm new file mode 100644 index 000000000..8269569f4 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/apt/usage.apt.vm @@ -0,0 +1,137 @@ + ------ + Usage + ------ + Jason van Zyl + ------ + 2008-08-02 + ------ + + ~~ Licensed to the Apache Software Foundation (ASF) under one + ~~ or more contributor license agreements. See the NOTICE file + ~~ distributed with this work for additional information + ~~ regarding copyright ownership. The ASF licenses this file + ~~ to you under the Apache License, Version 2.0 (the + ~~ "License"); you may not use this file except in compliance + ~~ with the License. You may obtain a copy of the License at + ~~ + ~~ http://www.apache.org/licenses/LICENSE-2.0 + ~~ + ~~ Unless required by applicable law or agreed to in writing, + ~~ software distributed under the License is distributed on an + ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~~ KIND, either express or implied. See the License for the + ~~ specific language governing permissions and limitations + ~~ under the License. + + ~~ NOTE: For help with the syntax of this file, see: + ~~ http://maven.apache.org/doxia/references/apt-format.html + +Usage + + This page provides general usage information along with a basic example. The plugin + is commonly used to run and verify integration tests for a project, say a Maven plugin. This is done using + the <<<{{{./run-mojo.html} invoker:run }}>>> goal. And as a preparation for the integration tests, one usually wants to + stage the artifacts under tests into a testing repository. For this job, the + <<<{{{./install-mojo.html} invoker:install }}>>> goal can be used. + +* Basic Example + + The following example demonstrates a basic plugin configuration for running integration tests. Let's assume the following + directory structure of your project: + ++------------------ +./ ++- pom.xml ++- src/ + +- it/ + +- settings.xml + +- first-it/ + | +- pom.xml + | +- src/ + +- second-it/ + +- pom.xml + +- invoker.properties + +- test.properties + +- verify.bsh + +- src/ ++------------------ + + In this example, the directory <<>> is the location where all the IT projects reside. You simply put each + integration test into a distinct sub directory, like shown by <<>> and <<>>. The plugin + configuration for this example would look like this: + ++------------------ + + ... + + + + maven-invoker-plugin + ${project.version} + + \${project.build.directory}/it + src/it/settings.xml + \${project.build.directory}/local-repo + verify + + + + integration-test + + install + run + + + + + + + ... + ++------------------ + + Now, to get things going, just tell Maven to execute the lifecycle phase <<>>: + ++------------------ + mvn integration-test ++------------------ + + First, the <<>> goal will be executed during the phase <<>> and will copy the + main artifact of the project along with any attached artifacts over to <<>>. Furthermore, any + locally reachable parent POMs of the project will be copied to the staging repository. Last but not least, if you are + running a reactor build, all project dependencies that reside in the reactor will be staged, too. + + Next up, the <<>> goal will execute during the phase <<>> and will use the configured + include/exclude patterns to search the directory <<>> for IT POMs. Every directory where an IT POM is found + will be copied over to <<>>. Additionally, the IT POMs will be filtered, i.e. expressions like + <<<@project.version@>>> will be replaced with the corresponding values from the project's POM. This is especially + handy to make sure your IT POMs always reference the currently built version of the project artifact. You can also + define other properties via the plugin configuration that you wish to use for filtering. + + Once the IT POMs have been filtered, a Maven build will be started on them. By default, the Invoker Plugin will execute the + phase <<>> on the IT POMs but that can be changed globally in the plugin configuration or for an individual + integration test by using the <<<{{{./examples/invoker-properties.html}invoker.properties}}>>> as done in the example + for <<>>. Likewise, system properties can be passed to the IT builds via the file <<>>. + And the file <<>> can be used to specify custom user settings for the tests. Among others, this + allows you to make the integration tests use your local repository as a remote repository, avoiding time-consuming + downloads from <<>> in order to fill up the initially empty staging repository. Please see the example + {{{./examples/fast-use.html}Fast Invoker Plugin Configuration}} for more details on this technique. The output of the + IT builds is written to a log file named <<>> (e.g. <<>>) and allows + diagnostics in case an integration test fails. + + When an integration test has finished, the plugin will invoke an optional post build hook script. In the example, + this is the case for <<>> where <<>> will be run. The purpose of this script is usually to + check that the build of the integration test did not only succeed but also produced the intended output. Have a look + at the example {{{./examples/post-build-script.html}Using a Post Build Script}} for a code snippet. + +* Running Only Some Tests + + The plugin also supports a parameter <<<-Dinvoker.test>>> to run only ITs in the directories matched by the patterns + used in the parameter. This enables you to quickly rerun individual tests. See this example command line: + ++--- + mvn invoker:run -Dinvoker.test=*MWAR*,simple* ++--- + + Assuming the base directory of the sub projects is <<>>, the plugin will only run projects from directories + matching the path <<>> and <<>>. diff --git a/Java-base/maven-invoker-plugin/src/src/site/fml/faq.fml b/Java-base/maven-invoker-plugin/src/src/site/fml/faq.fml new file mode 100644 index 000000000..a8f093579 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/fml/faq.fml @@ -0,0 +1,76 @@ + + + + + + + + Why do I need to use this plugin? + +

    + It is essential that you provide some form of integration testing for your projects and the Invoker Plugin + tries to make is easy for you to create integration tests for your Maven Plugins, new Lifecycles, or any other + type of Maven component that you've created. Currently the Invoker Plugin forks Maven to execute the specified + projects, but it is hoped that soon we will integrate the Maven Embedder into the mix to allow you run your + projects in process for great speed. +

    +
    +
    + + How can I assert that the build of an IT project fails? + +

    + Sometimes you might want to test that error conditions are properly dealt with, i.e. fail a build. To assert + a failure for a particular IT project, put the following setting into the properties file denoted by the + plugin's invokerPropertiesFile parameter: + invoker.buildResult=failure. + Now, the failure of the IT build will be interpreted as a test success. Likewise, a successful IT build will + be considered a test failure. +

    +
    +
    + + How can I share common code between the pre-/post-build scripts? + +

    + If you want to avoid copy&paste of lengthy code snippets within the hook scripts, you can move this code + into a regular Java class. More precisely, you would place this utility code somewhere in your test source + tree and set the plugin parameter addTestClassPath + to true. For more details, please see the example + Accessing Test Classes. +

    +
    +
    + + How can I invoke multiple Maven builds on the same IT project? + +

    + This is not supported in the plugin configuration but rather on a per project basis by means of the invoker + properties. This way, you use properties like invoker.goals.2 to configure the goals for a second + invocation of Maven. Have a look at the example about using + Invoker Properties. +

    +
    +
    +
    +
    diff --git a/Java-base/maven-invoker-plugin/src/src/site/resources/download.cgi b/Java-base/maven-invoker-plugin/src/src/site/resources/download.cgi new file mode 100644 index 000000000..1b178d2e6 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/resources/download.cgi @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Just call the standard mirrors.cgi script. It will use download.html +# as the input template. +exec /www/www.apache.org/dyn/mirrors/mirrors.cgi $* \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/site/site.xml b/Java-base/maven-invoker-plugin/src/src/site/site.xml new file mode 100644 index 000000000..5c9f2c2ef --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/site.xml @@ -0,0 +1,82 @@ + + + + + + + + http://maven.apache.org/images/apache-maven-project.png + http://www.apache.org/ + + + + http://maven.apache.org/images/maven-logo-black-on-white.png + http://maven.apache.org/ + + + org.apache.maven.skins + maven-fluido-skin + 1.6 + + + + + true + + + maven.apache.org/plugins/maven-invoker-plugin/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Java-base/maven-invoker-plugin/src/src/site/xdoc/download.xml.vm b/Java-base/maven-invoker-plugin/src/src/site/xdoc/download.xml.vm new file mode 100644 index 000000000..3f710359a --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/site/xdoc/download.xml.vm @@ -0,0 +1,126 @@ + + + + + + + Download ${project.name} Source + + +
    + +

    ${project.name} ${project.version} is distributed in source format. Use a source archive if you intend to build + ${project.name} yourself. Otherwise, simply use the ready-made binary artifacts from central repository.

    + +

    You will be prompted for a mirror - if the file is not found on yours, please be patient, as it may take 24 + hours to reach all mirrors.

    + +

    In order to guard against corrupted downloads/installations, it is highly recommended to + verify the signature + of the release bundles against the public KEYS used by the Apache Maven + developers.

    + +

    ${project.name} is distributed under the Apache License, version 2.0.

    + +

    We strongly encourage our users to configure a Maven repository mirror closer to their location, please read How to Use Mirrors for Repositories.

    + + + + +

    + [if-any logo] + + logo + + [end] + The currently selected mirror is + [preferred]. + If you encounter a problem with this mirror, + please select another mirror. + If all mirrors are failing, there are + backup + mirrors + (at the end of the mirrors list) that should be available. +

    + +
    + Other mirrors: + + +
    + +

    + You may also consult the + complete list of + mirrors. +

    + + + + + +

    This is the current stable version of ${project.name}.

    + + + + + + + + + + + + + + + + + + +
    LinkChecksumSignature
    ${project.name} ${project.version} (Source zip)maven/plugins/${project.artifactId}-${project.version}-source-release.zipmaven/plugins/${project.artifactId}-${project.version}-source-release.zip.sha512maven/plugins/${project.artifactId}-${project.version}-source-release.zip.asc
    +
    + + + +

    Older non-recommended releases can be found on our archive site.

    + +
    +
    + +
    + diff --git a/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/ExtendedMavenProjectStub.java b/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/ExtendedMavenProjectStub.java new file mode 100644 index 000000000..50c624591 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/ExtendedMavenProjectStub.java @@ -0,0 +1,57 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES 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.Scm; +import org.apache.maven.plugin.testing.stubs.MavenProjectStub; + +import java.util.Properties; + +/** + * @author Olivier Lamy + * @since 22 nov. 07 + */ +public class ExtendedMavenProjectStub + extends MavenProjectStub +{ + private Scm scm; + + private Properties properties; + + public Scm getScm() + { + return scm; + } + + public void setScm( Scm scm ) + { + this.scm = scm; + } + + public Properties getProperties() + { + return properties; + } + + public void setProperties( Properties properties ) + { + this.properties = properties; + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/InterpolationTest.java b/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/InterpolationTest.java new file mode 100644 index 000000000..1edcdb105 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/InterpolationTest.java @@ -0,0 +1,126 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.Reader; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.apache.maven.model.Scm; +import org.apache.maven.plugin.testing.AbstractMojoTestCase; +import org.apache.maven.plugin.testing.stubs.MavenProjectStub; +import org.apache.maven.settings.Settings; +import org.codehaus.plexus.util.IOUtil; +import org.codehaus.plexus.util.ReaderFactory; + +/** + * @author Olivier Lamy + * @since 22 nov. 07 + */ +public class InterpolationTest + extends AbstractMojoTestCase +{ + + protected MavenProjectStub buildMavenProjectStub() + { + ExtendedMavenProjectStub project = new ExtendedMavenProjectStub(); + project.setVersion( "1.0-SNAPSHOT" ); + project.setArtifactId( "foo" ); + project.setGroupId( "bar" ); + Properties properties = new Properties(); + properties.put( "fooOnProject", "barOnProject" ); + project.setProperties( properties ); + Scm scm = new Scm(); + scm.setConnection( "http://blabla" ); + project.setScm( scm ); + return project; + } + + public void testCompositeMap() + throws Exception + { + + Properties properties = new Properties(); + properties.put( "foo", "bar" ); + properties.put( "version", "2.0-SNAPSHOT" ); + CompositeMap compositeMap = new CompositeMap( buildMavenProjectStub(), (Map) properties, false ); + assertEquals( "1.0-SNAPSHOT", compositeMap.get( "pom.version" ) ); + assertEquals( "bar", compositeMap.get( "foo" ) ); + assertEquals( "bar", compositeMap.get( "pom.groupId" ) ); + assertEquals( "http://blabla", compositeMap.get( "pom.scm.connection" ) ); + assertEquals( "barOnProject", compositeMap.get( "fooOnProject" ) ); + } + + public void testPomInterpolation() + throws Exception + { + Reader reader = null; + File interpolatedPomFile; + try + { + InvokerMojo invokerMojo = new InvokerMojo(); + setVariableValueToObject( invokerMojo, "project", buildMavenProjectStub() ); + setVariableValueToObject( invokerMojo, "settings", new Settings() ); + Properties properties = new Properties(); + properties.put( "foo", "bar" ); + properties.put( "version", "2.0-SNAPSHOT" ); + setVariableValueToObject( invokerMojo, "filterProperties", properties ); + String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test" + + File.separatorChar + "resources" + File.separatorChar + "unit" + File.separatorChar + "interpolation"; + + interpolatedPomFile = new File( getBasedir(), "target/interpolated-pom.xml" ); + invokerMojo.buildInterpolatedFile( new File( dirPath, "pom.xml" ), interpolatedPomFile ); + reader = ReaderFactory.newXmlReader( interpolatedPomFile ); + String content = IOUtil.toString( reader ); + assertTrue( content.indexOf( "bar" ) > 0 ); + reader.close(); + reader = null; + // recreate it to test delete if exists before creation + invokerMojo.buildInterpolatedFile( new File( dirPath, "pom.xml" ), interpolatedPomFile ); + reader = ReaderFactory.newXmlReader( interpolatedPomFile ); + content = IOUtil.toString( reader ); + assertTrue( content.indexOf( "bar" ) > 0 ); + reader.close(); + reader = null; + } + finally + { + IOUtil.close( reader ); + } + } + + public void testProfilesWithNoFile() + throws Exception + { + + InvokerMojo invokerMojo = new InvokerMojo(); + setVariableValueToObject( invokerMojo, "profiles", Arrays.asList( "zloug" ) ); + setVariableValueToObject( invokerMojo, "settings", new Settings() ); + String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar + + "resources" + File.separatorChar + "unit" + File.separatorChar + "profiles-from-file"; + List profiles = invokerMojo.getProfiles( new File( dirPath ) ); + assertTrue( profiles.contains( "zloug" ) ); + assertEquals( 1, profiles.size() ); + + } +} diff --git a/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/InvokerMojoTest.java b/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/InvokerMojoTest.java new file mode 100644 index 000000000..77656f402 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/InvokerMojoTest.java @@ -0,0 +1,120 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.plugin.testing.AbstractMojoTestCase; +import org.apache.maven.plugins.invoker.model.BuildJob; +import org.apache.maven.project.MavenProject; +import org.apache.maven.settings.Settings; + +/** + * @author Olivier Lamy + * @since 18 nov. 07 + */ +public class InvokerMojoTest extends AbstractMojoTestCase +{ + + private MavenProject getMavenProject() + { + MavenProject mavenProject = new MavenProject(); + mavenProject.setFile( new File( "target/foo.txt" ) ); + return mavenProject; + } + + public void testSingleInvokerTest() throws Exception + { + InvokerMojo invokerMojo = new InvokerMojo(); + String dirPath = getBasedir() + "/src/test/resources/unit"; + List goals = invokerMojo.getGoals( new File( dirPath ) ); + assertEquals( 1, goals.size() ); + setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) ); + setVariableValueToObject( invokerMojo, "invokerPropertiesFile", "invoker.properties" ); + setVariableValueToObject( invokerMojo, "project", getMavenProject() ); + setVariableValueToObject( invokerMojo, "invokerTest", "*dummy*" ); + setVariableValueToObject( invokerMojo, "settings", new Settings() ); + List poms = invokerMojo.getBuildJobs(); + assertEquals( 1, poms.size() ); + } + + public void testMultiInvokerTest() throws Exception + { + InvokerMojo invokerMojo = new InvokerMojo(); + String dirPath = getBasedir() + "/src/test/resources/unit"; + List goals = invokerMojo.getGoals( new File( dirPath ) ); + assertEquals( 1, goals.size() ); + setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) ); + setVariableValueToObject( invokerMojo, "invokerPropertiesFile", "invoker.properties" ); + setVariableValueToObject( invokerMojo, "project", getMavenProject() ); + setVariableValueToObject( invokerMojo, "invokerTest", "*dummy*,*terpolatio*" ); + setVariableValueToObject( invokerMojo, "settings", new Settings() ); + List poms = invokerMojo.getBuildJobs(); + assertEquals( 2, poms.size() ); + } + + public void testFullPatternInvokerTest() throws Exception + { + InvokerMojo invokerMojo = new InvokerMojo(); + String dirPath = getBasedir() + "/src/test/resources/unit"; + List goals = invokerMojo.getGoals( new File( dirPath ) ); + assertEquals( 1, goals.size() ); + setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) ); + setVariableValueToObject( invokerMojo, "invokerPropertiesFile", "invoker.properties" ); + setVariableValueToObject( invokerMojo, "project", getMavenProject() ); + setVariableValueToObject( invokerMojo, "invokerTest", "*" ); + setVariableValueToObject( invokerMojo, "settings", new Settings() ); + List poms = invokerMojo.getBuildJobs(); + assertEquals( 4, poms.size() ); + } + + public void testAlreadyCloned() + { + assertFalse( AbstractInvokerMojo.alreadyCloned( "dir", Collections.emptyList() ) ); + assertTrue( AbstractInvokerMojo.alreadyCloned( "dir", Collections.singletonList( "dir" ) ) ); + assertTrue( AbstractInvokerMojo.alreadyCloned( "dir" + File.separator + "sub", + Collections.singletonList( "dir" ) ) ); + assertFalse( AbstractInvokerMojo.alreadyCloned( "dirs", Collections.singletonList( "dir" ) ) ); + } + + public void testParallelThreadsSettings() throws IllegalAccessException + { + Object[][] testValues = { + {"4", 4}, + {"1C", Runtime.getRuntime().availableProcessors()}, + {"2.5C", (int) ( Double.parseDouble( "2.5" ) * Runtime.getRuntime().availableProcessors() )} + }; + + InvokerMojo invokerMojo = new InvokerMojo(); + + for ( Object[] testValue : testValues ) + { + String parallelThreads = (String) testValue[0]; + int expectedParallelThreads = (Integer) testValue[1]; + + setVariableValueToObject( invokerMojo, "parallelThreads", parallelThreads ); + + assertEquals( expectedParallelThreads, invokerMojo.getParallelThreadsCount() ); + } + } + +} diff --git a/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java b/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java new file mode 100644 index 000000000..3c1e94939 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java @@ -0,0 +1,441 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.Collection; +import java.util.Collections; +import java.util.Properties; + +import org.apache.maven.shared.invoker.InvocationRequest; +import org.apache.maven.shared.invoker.InvocationRequest.ReactorFailureBehavior; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.clearInvocations; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +/** + * Tests the invoker properties facade. + * + * @author Benjamin Bentmann + */ +@RunWith( MockitoJUnitRunner.class ) +public class InvokerPropertiesTest +{ + + @Mock + private InvocationRequest request; + + @Test + public void testConstructorNullSafe() + { + InvokerProperties facade = new InvokerProperties( null ); + assertNotNull( facade.getProperties() ); + } + + @Test + public void testGetInvokerProperty() + { + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + assertNull( facade.get( "undefined-key", 0 ) ); + + props.setProperty( "key", "value" ); + assertEquals( "value", facade.get( "key", 1 ) ); + + props.setProperty( "key.1", "another-value" ); + assertEquals( "another-value", facade.get( "key", 1 ) ); + assertEquals( "value", facade.get( "key", 2 ) ); + } + + @Test + public void testGetJobName() + { + Properties props = new Properties(); + final String jobName = "Build Job name"; + props.put( "invoker.name", jobName ); + InvokerProperties facade = new InvokerProperties( props ); + + assertEquals( jobName, facade.getJobName() ); + } + + @Test + public void testIsExpectedResult() + { + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + assertTrue( facade.isExpectedResult( 0, 0 ) ); + assertFalse( facade.isExpectedResult( 1, 0 ) ); + + props.setProperty( "invoker.buildResult", "success" ); + assertTrue( facade.isExpectedResult( 0, 0 ) ); + assertFalse( facade.isExpectedResult( 1, 0 ) ); + + props.setProperty( "invoker.buildResult", "failure" ); + assertFalse( facade.isExpectedResult( 0, 0 ) ); + assertTrue( facade.isExpectedResult( 1, 0 ) ); + } + + @Test + public void testConfigureRequestEmptyProperties() + { + + InvokerProperties facade = new InvokerProperties( null ); + + facade.configureInvocation( request, 0 ); + verifyZeroInteractions( request ); + } + + @Test + public void testConfigureRequestGoals() + { + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + props.setProperty( "invoker.goals", "verify" ); + facade.configureInvocation( request, 0 ); + verify( request ).setGoals( eq( Collections.singletonList( "verify" ) ) ); + verifyNoMoreInteractions( request ); + clearInvocations( request ); + + props.setProperty( "invoker.goals", " " ); + facade.configureInvocation( request, 0 ); + verify( request ).setGoals( eq( Collections.emptyList() ) ); + verifyNoMoreInteractions( request ); + clearInvocations( request ); + + props.setProperty( "invoker.goals", "" ); + facade.configureInvocation( request, 0 ); + verify( request ).setGoals( eq( Collections.emptyList() ) ); + verifyNoMoreInteractions( request ); + clearInvocations( request ); + + props.setProperty( "invoker.goals", " clean , test verify " ); + facade.configureInvocation( request, 0 ); + verify( request ).setGoals( eq( Arrays.asList( "clean", "test", "verify" ) ) ); + verifyNoMoreInteractions( request ); + } + + @Test + public void testConfigureRequestProfiles() + { + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + props.setProperty( "invoker.profiles", "verify" ); + facade.configureInvocation( request, 0 ); + verify( request ).setProfiles( eq( Collections.singletonList( "verify" ) ) ); + verifyNoMoreInteractions( request ); + clearInvocations( request ); + + props.setProperty( "invoker.profiles", " " ); + facade.configureInvocation( request, 0 ); + verify( request ).setProfiles( eq( Collections.emptyList() ) ); + verifyNoMoreInteractions( request ); + clearInvocations( request ); + + props.setProperty( "invoker.profiles", "" ); + facade.configureInvocation( request, 0 ); + verify( request ).setProfiles( eq( Collections.emptyList() ) ); + verifyNoMoreInteractions( request ); + clearInvocations( request ); + + props.setProperty( "invoker.profiles", " clean , test verify ," ); + facade.configureInvocation( request, 0 ); + verify( request ).setProfiles( eq( Arrays.asList( "clean", "test", "verify" ) ) ); + verifyNoMoreInteractions( request ); + } + + @Test + public void testConfigureRequestProject() throws Exception + { + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + File tempPom = File.createTempFile( "maven-invoker-plugin-test", ".pom" ); + try + { + File tempDir = tempPom.getParentFile(); + when( request.getBaseDirectory() ).thenReturn( tempDir ); + + props.setProperty( "invoker.project", tempPom.getName() ); + facade.configureInvocation( request, 0 ); + verify( request ).getBaseDirectory(); + verify( request ).setBaseDirectory( eq( tempDir ) ); + verify( request ).setPomFile( eq( tempPom ) ); + verifyNoMoreInteractions( request ); + clearInvocations( request ); + + props.setProperty( "invoker.project", "" ); + facade.configureInvocation( request, 0 ); + verify( request ).getBaseDirectory(); + verify( request ).setBaseDirectory( eq( tempDir ) ); + verify( request ).setPomFile( null ); + verifyNoMoreInteractions( request ); + } + finally + { + tempPom.delete(); + } + } + + @Test + public void testConfigureRequestMavenOpts() + { + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + props.setProperty( "invoker.mavenOpts", "-Xmx512m" ); + facade.configureInvocation( request, 0 ); + verify( request ).setMavenOpts( "-Xmx512m" ); + verifyNoMoreInteractions( request ); + } + + @Test + public void testConfigureRequestFailureBehavior() + { + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + props.setProperty( "invoker.failureBehavior", ReactorFailureBehavior.FailNever.getLongOption() ); + facade.configureInvocation( request, 0 ); + verify( request ).setReactorFailureBehavior( eq( ReactorFailureBehavior.FailNever ) ); + verifyNoMoreInteractions( request ); + } + + @Test + public void testConfigureRequestFailureBehaviorUnKnownName() + { + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + props.setProperty( "invoker.failureBehavior", "xxxUnKnown" ); + try + { + facade.configureInvocation( request, 0 ); + } + catch ( IllegalArgumentException e ) + { + assertEquals( "The string 'xxxUnKnown' can not be converted to enumeration.", e.getMessage() ); + } + verifyZeroInteractions( request ); + } + + + @Test + public void testConfigureRequestRecursion() + { + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + props.setProperty( "invoker.nonRecursive", "true" ); + facade.configureInvocation( request, 0 ); + verify( request ).setRecursive( false ); + verifyNoMoreInteractions( request ); + clearInvocations( request ); + + props.setProperty( "invoker.nonRecursive", "false" ); + facade.configureInvocation( request, 0 ); + verify( request ).setRecursive( true ); + verifyNoMoreInteractions( request ); + } + + @Test + public void testConfigureRequestOffline() + { + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + props.setProperty( "invoker.offline", "true" ); + facade.configureInvocation( request, 0 ); + verify( request ).setOffline( true ); + verifyNoMoreInteractions( request ); + clearInvocations( request ); + + props.setProperty( "invoker.offline", "false" ); + facade.configureInvocation( request, 0 ); + verify( request ).setOffline( false ); + verifyNoMoreInteractions( request ); + } + + @Test + public void testConfigureRequestDebug() + { + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + props.setProperty( "invoker.debug", "true" ); + facade.configureInvocation( request, 0 ); + verify( request ).setDebug( true ); + verifyNoMoreInteractions( request ); + clearInvocations( request ); + + props.setProperty( "invoker.debug", "false" ); + facade.configureInvocation( request, 0 ); + verify( request ).setDebug( false ); + verifyNoMoreInteractions( request ); + } + + @Test + public void testConfigureEnvironmentVariables() + { + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + props.setProperty( "invoker.abcdef", "abcdf" ); + props.setProperty( "invoker.environmentVariables.KEY1.1", "value1.1" ); + props.setProperty( "invoker.environmentVariables.KEY1", "value1" ); + props.setProperty( "invoker.environmentVariables.KEY2", "value2" ); + props.setProperty( "invoker.environmentVariables.KEY2.1", "value2.1" ); + props.setProperty( "invoker.environmentVariables.KEY3", "value3" ); + facade.configureInvocation( request, 0 ); + verify( request ).addShellEnvironment( "KEY1", "value1" ); + verify( request ).addShellEnvironment( "KEY2", "value2" ); + verify( request ).addShellEnvironment( "KEY3", "value3" ); + verifyNoMoreInteractions( request ); + } + + @Test + public void testConfigureEnvironmentVariablesWithIndex() + { + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + props.setProperty( "invoker.abcdef", "abcdf" ); + props.setProperty( "invoker.environmentVariables.KEY1.1", "value1.1" ); + props.setProperty( "invoker.environmentVariables.KEY1", "value1" ); + props.setProperty( "invoker.environmentVariables.KEY2", "value2" ); + props.setProperty( "invoker.environmentVariables.KEY2.1", "value2.1" ); + props.setProperty( "invoker.environmentVariables.KEY3", "value3" ); + facade.configureInvocation( request, 1 ); + verify( request ).addShellEnvironment( "KEY1", "value1.1" ); + verify( request ).addShellEnvironment( "KEY2", "value2.1" ); + verify( request ).addShellEnvironment( "KEY3", "value3" ); + verifyNoMoreInteractions( request ); + } + + @Test + public void testIsInvocationDefined() + { + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + assertFalse( facade.isInvocationDefined( 1 ) ); + + props.setProperty( "invoker.goals", "install" ); + assertFalse( facade.isInvocationDefined( 1 ) ); + + props.setProperty( "invoker.goals.2", "install" ); + assertFalse( facade.isInvocationDefined( 1 ) ); + assertTrue( facade.isInvocationDefined( 2 ) ); + assertFalse( facade.isInvocationDefined( 3 ) ); + + props.setProperty( "invoker.goals.3", "install" ); + assertFalse( facade.isInvocationDefined( 1 ) ); + assertTrue( facade.isInvocationDefined( 2 ) ); + assertTrue( facade.isInvocationDefined( 3 ) ); + assertFalse( facade.isInvocationDefined( 4 ) ); + } + + @Test + public void testIsSelectedDefined() + { + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + assertFalse( facade.isSelectorDefined( 1 ) ); + + props.setProperty( "invoker.java.version", "1.6+" ); + props.setProperty( "invoker.maven.version", "3.0+" ); + props.setProperty( "invoker.os.family", "windows" ); + assertFalse( facade.isSelectorDefined( 1 ) ); + + props.setProperty( "selector.2.java.version", "1.6+" ); + props.setProperty( "selector.3.maven.version", "3.0+" ); + props.setProperty( "selector.4.os.family", "windows" ); + assertFalse( facade.isSelectorDefined( 1 ) ); + assertTrue( facade.isSelectorDefined( 2 ) ); + assertTrue( facade.isSelectorDefined( 3 ) ); + assertTrue( facade.isSelectorDefined( 4 ) ); + assertFalse( facade.isSelectorDefined( 5 ) ); + } + + @Test + public void testGetToolchainsForEmptyProperties() + { + + Properties props = new Properties(); + InvokerProperties facade = new InvokerProperties( props ); + + Collection toolchains = facade.getToolchains(); + assertNotNull( toolchains ); + assertEquals( 0, toolchains.size() ); + + toolchains = facade.getToolchains( 1 ); + assertNotNull( toolchains ); + assertEquals( 0, toolchains.size() ); + } + + @Test + public void testGetToolchains() + { + Properties props = new Properties(); + props.put( "invoker.toolchain.jdk.version", "11" ); + InvokerProperties facade = new InvokerProperties( props ); + + Collection toolchains = facade.getToolchains(); + assertNotNull( toolchains ); + assertEquals( 1, toolchains.size() ); + InvokerToolchain toolchain = toolchains.iterator().next(); + assertEquals( "jdk", toolchain.getType() ); + assertEquals( Collections.singletonMap( "version", "11" ), toolchain.getProvides() ); + } + + @Test + public void testGetToolchainsWithIndex() + { + Properties props = new Properties(); + props.put( "selector.1.invoker.toolchain.jdk.version", "11" ); + InvokerProperties facade = new InvokerProperties( props ); + + Collection toolchains = facade.getToolchains( 1 ); + assertNotNull( toolchains ); + assertEquals( 1, toolchains.size() ); + InvokerToolchain toolchain = toolchains.iterator().next(); + assertEquals( "jdk", toolchain.getType() ); + assertEquals( Collections.singletonMap( "version", "11" ), toolchain.getProvides() ); + } + +} diff --git a/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/SelectorTest.java b/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/SelectorTest.java new file mode 100644 index 000000000..8efa4967d --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/SelectorTest.java @@ -0,0 +1,81 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import java.util.Properties; + +import org.junit.Test; + +/** + * Test for {@link Selector}. + */ +public class SelectorTest +{ + @Test + public void testGlobalMatch() + { + Selector selector = new Selector( "3.2.5", "1.7", null ); + + Properties props = new Properties(); + props.setProperty( "invoker.maven.version", "3.0+" ); + InvokerProperties invokerProperties = new InvokerProperties( props ); + assertEquals( 0, selector.getSelection( invokerProperties ) ); + } + + @Test + public void testSelectorMatch() + { + Selector selector = new Selector( "3.2.5", "1.7", null ); + + Properties props = new Properties(); + props.setProperty( "selector.1.maven.version", "3.0+" ); + InvokerProperties invokerProperties = new InvokerProperties( props ); + assertEquals( 0, selector.getSelection( invokerProperties ) ); + + props.setProperty( "selector.1.maven.version", "3.3.1+" ); + assertEquals( Selector.SELECTOR_MULTI, selector.getSelection( invokerProperties ) ); + } + + @Test + public void testSelectorWithGlobalMatch() + { + Selector selector = new Selector( "3.2.5", "1.7", null ); + + Properties props = new Properties(); + // invoker.maven.version is used by all selectors + props.setProperty( "invoker.maven.version", "3.0+" ); + props.setProperty( "selector.1.java.version", "1.4+" ); + props.setProperty( "selector.2.os.family", "myos" ); + InvokerProperties invokerProperties = new InvokerProperties( props ); + assertEquals( 0, selector.getSelection( invokerProperties ) ); + + props.setProperty( "invoker.maven.version", "3.3.1+" ); + assertEquals( Selector.SELECTOR_MULTI, selector.getSelection( invokerProperties ) ); + + props.setProperty( "invoker.maven.version", "3.0+" ); + props.setProperty( "selector.1.maven.version", "3.3.1+" ); + assertEquals( Selector.SELECTOR_MULTI, selector.getSelection( invokerProperties ) ); + + props.setProperty( "selector.2.os.family", "!myos" ); + assertEquals( 0, selector.getSelection( invokerProperties ) ); + } + +} diff --git a/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/SelectorUtilsTest.java b/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/SelectorUtilsTest.java new file mode 100644 index 000000000..bdeff50bc --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/test/java/org/apache/maven/plugins/invoker/SelectorUtilsTest.java @@ -0,0 +1,145 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.mockito.Mockito.isA; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.apache.maven.plugins.invoker.AbstractInvokerMojo.ToolchainPrivateManager; +import org.apache.maven.toolchain.ToolchainPrivate; +import org.junit.Test; + +/** + * Tests {@link SelectorUtils}. + * + * @author Benjamin Bentmann + */ +public class SelectorUtilsTest +{ + + @Test + public void testParseList() + { + List includes = new ArrayList(); + List excludes = new ArrayList(); + + SelectorUtils.parseList( null, includes, excludes ); + + SelectorUtils.parseList( " 1.5, !1.4, 1.6+ ", includes, excludes ); + assertEquals( Arrays.asList( "1.5", "1.6+" ), includes ); + assertEquals( Arrays.asList( "1.4" ), excludes ); + } + + @Test + public void testParseVersion() + { + assertEquals( Arrays.asList( 1, 6, 0, 12 ), SelectorUtils.parseVersion( "1.6.0_12" ) ); + + assertEquals( Arrays.asList( 1, 6, 0, 12 ), SelectorUtils.parseVersion( "1.6.0_12+" ) ); + assertEquals( Arrays.asList( 1, 6, 0, 12 ), SelectorUtils.parseVersion( "1.6.0_12-" ) ); + } + + @Test + public void testCompareVersions() + { + assertTrue( SelectorUtils.compareVersions( Arrays.asList( 1, 6 ), Arrays.asList( 1, 6 ) ) == 0 ); + + assertTrue( SelectorUtils.compareVersions( Arrays.asList( 1, 5 ), Arrays.asList( 1, 6 ) ) < 0 ); + assertTrue( SelectorUtils.compareVersions( Arrays.asList( 1, 6 ), Arrays.asList( 1, 5 ) ) > 0 ); + + assertTrue( SelectorUtils.compareVersions( Arrays.asList( 1 ), Arrays.asList( 1, 6 ) ) < 0 ); + assertTrue( SelectorUtils.compareVersions( Arrays.asList( 1, 6 ), Arrays.asList( 1 ) ) > 0 ); + } + + @Test + public void testIsMatchingJre() + { + + assertFalse( SelectorUtils.isJreVersion( Arrays.asList( 1, 4, 2, 8 ), "1.5" ) ); + assertTrue( SelectorUtils.isJreVersion( Arrays.asList( 1, 5 ), "1.5" ) ); + assertTrue( SelectorUtils.isJreVersion( Arrays.asList( 1, 5, 9 ), "1.5" ) ); + assertFalse( SelectorUtils.isJreVersion( Arrays.asList( 1, 6 ), "1.5" ) ); + + assertFalse( SelectorUtils.isJreVersion( Arrays.asList( 1, 4, 2, 8 ), "1.5+" ) ); + assertTrue( SelectorUtils.isJreVersion( Arrays.asList( 1, 5 ), "1.5+" ) ); + assertTrue( SelectorUtils.isJreVersion( Arrays.asList( 1, 5, 9 ), "1.5+" ) ); + assertTrue( SelectorUtils.isJreVersion( Arrays.asList( 1, 6 ), "1.5+" ) ); + + assertTrue( SelectorUtils.isJreVersion( Arrays.asList( 1, 4, 2, 8 ), "1.5-" ) ); + assertFalse( SelectorUtils.isJreVersion( Arrays.asList( 1, 5 ), "1.5-" ) ); + assertFalse( SelectorUtils.isJreVersion( Arrays.asList( 1, 5, 9 ), "1.5-" ) ); + assertFalse( SelectorUtils.isJreVersion( Arrays.asList( 1, 6 ), "1.5-" ) ); + + assertTrue( SelectorUtils.isJreVersion( (String) null, "1.5" ) ); + assertTrue( SelectorUtils.isJreVersion( "", "1.5" ) ); + } + + @Test + public void testIsMatchingToolchain() throws Exception + { + InvokerToolchain openJdk9 = new InvokerToolchain( "jdk" ); + openJdk9.addProvides( "version", "9" ); + openJdk9.addProvides( "vendor", "openJDK" ); + + InvokerToolchain maven360 = new InvokerToolchain( "maven" ); + openJdk9.addProvides( "version", "3.6.0" ); + + ToolchainPrivateManager toolchainPrivateManager = mock( ToolchainPrivateManager.class ); + ToolchainPrivate jdkMatching = mock( ToolchainPrivate.class ); + when( jdkMatching.matchesRequirements( isA( Map.class ) ) ).thenReturn( true ); + when( jdkMatching.getType() ).thenReturn( "jdk" ); + + ToolchainPrivate jdkMismatch = mock( ToolchainPrivate.class ); + when( jdkMismatch.getType() ).thenReturn( "jdk" ); + + when( toolchainPrivateManager.getToolchainPrivates( "jdk" ) ) + .thenReturn( new ToolchainPrivate[] { jdkMatching } ); + assertTrue( SelectorUtils.isToolchain( toolchainPrivateManager, Collections.singleton( openJdk9 ) ) ); + + when( toolchainPrivateManager.getToolchainPrivates( "jdk" ) ) + .thenReturn( new ToolchainPrivate[] { jdkMismatch } ); + assertFalse( SelectorUtils.isToolchain( toolchainPrivateManager, Collections.singleton( openJdk9 ) ) ); + + when( toolchainPrivateManager.getToolchainPrivates( "jdk" ) ) + .thenReturn( new ToolchainPrivate[] { jdkMatching, jdkMismatch, jdkMatching } ); + assertTrue( SelectorUtils.isToolchain( toolchainPrivateManager, Collections.singleton( openJdk9 ) ) ); + + when( toolchainPrivateManager.getToolchainPrivates( "jdk" ) ) + .thenReturn( new ToolchainPrivate[0] ); + assertFalse( SelectorUtils.isToolchain( toolchainPrivateManager, Collections.singleton( openJdk9 ) ) ); + + when( toolchainPrivateManager.getToolchainPrivates( "jdk" ) ) + .thenReturn( new ToolchainPrivate[] { jdkMatching } ); + when( toolchainPrivateManager.getToolchainPrivates( "maven" ) ) + .thenReturn( new ToolchainPrivate[0] ); + assertFalse( SelectorUtils.isToolchain( toolchainPrivateManager, Arrays.asList( openJdk9, maven360 ) ) ); + } + +} diff --git a/Java-base/maven-invoker-plugin/src/src/test/resources/unit/dummy/pom.xml b/Java-base/maven-invoker-plugin/src/src/test/resources/unit/dummy/pom.xml new file mode 100644 index 000000000..ab2014a89 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/test/resources/unit/dummy/pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + org.apache.maven.test + unit + pom + 0.1-SNAPSHOT + + @foo@ + + \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/test/resources/unit/goals-from-file/pom.xml b/Java-base/maven-invoker-plugin/src/src/test/resources/unit/goals-from-file/pom.xml new file mode 100644 index 000000000..fc80363ef --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/test/resources/unit/goals-from-file/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + org.apache.maven.test + unit + pom + 0.1-SNAPSHOT + \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/test/resources/unit/goals-from-file/verify.bsh b/Java-base/maven-invoker-plugin/src/src/test/resources/unit/goals-from-file/verify.bsh new file mode 100644 index 000000000..cdd4e7e55 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/test/resources/unit/goals-from-file/verify.bsh @@ -0,0 +1,48 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.*; +import org.codehaus.plexus.util.*; + +boolean result = true; + +try +{ + + File build = new File( basedir, "build.log" ); + if ( !build.exists() || build.isDirectory() ) + { + System.err.println( "build.log file is missing or a directory." ); + return false; + } + String buildContent = FileUtils.fileRead( build ); + int indexOf = buildContent.indexOf( "BUILD SUCCESSFUL" ); + if ( indexOf < 0 ) + { + System.err.println( "build.log doesn't contains BUILD SUCCESSFUL" ); + } +} +catch( IOException e ) +{ + e.printStackTrace(); + result = false; +} + +return result; diff --git a/Java-base/maven-invoker-plugin/src/src/test/resources/unit/interpolation/pom.xml b/Java-base/maven-invoker-plugin/src/src/test/resources/unit/interpolation/pom.xml new file mode 100644 index 000000000..ab2014a89 --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/test/resources/unit/interpolation/pom.xml @@ -0,0 +1,29 @@ + + + + 4.0.0 + org.apache.maven.test + unit + pom + 0.1-SNAPSHOT + + @foo@ + + \ No newline at end of file diff --git a/Java-base/maven-invoker-plugin/src/src/test/resources/unit/profiles-from-file/emptyProfiles.txt b/Java-base/maven-invoker-plugin/src/src/test/resources/unit/profiles-from-file/emptyProfiles.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Java-base/maven-invoker-plugin/src/src/test/resources/unit/profiles-from-file/profiles.txt b/Java-base/maven-invoker-plugin/src/src/test/resources/unit/profiles-from-file/profiles.txt new file mode 100644 index 000000000..f33f47f7f --- /dev/null +++ b/Java-base/maven-invoker-plugin/src/src/test/resources/unit/profiles-from-file/profiles.txt @@ -0,0 +1 @@ +foo, bar diff --git a/Java/maven-invoker-plugin-AbstractInvokerMojo_2646/Dockerfile b/Java/maven-invoker-plugin-AbstractInvokerMojo_2646/Dockerfile new file mode 100644 index 000000000..b3ce32683 --- /dev/null +++ b/Java/maven-invoker-plugin-AbstractInvokerMojo_2646/Dockerfile @@ -0,0 +1,18 @@ +FROM ghcr.io/kupl/starlab-benchmarks/java-base:maven-invoker-plugin + +ENV TZ=Asia/Seoul + +COPY ./metadata.json . +COPY ./npe.json . +COPY ./buggy.java /tmp/buggy.java +RUN export BUGGY_PATH=$(cat metadata.json | jq -r ".npe.filepath") \ + && export BUGGY_LINE=$(cat metadata.json | jq -r ".npe.line") \ + && export BUGGY_MTHD=$(cat metadata.json | jq -r ".npe.npe_method") \ + && mv /tmp/buggy.java $BUGGY_PATH \ + && echo "[{\"filepath\": \"$BUGGY_PATH\", \"line\": $BUGGY_LINE, \"method_name\": \"$BUGGY_MTHD\"}]" | jq . > traces.json + +RUN git init . && git add -A + +RUN $(cat metadata.json | jq -r ".buildCommand") + +RUN $(cat metadata.json | jq -r ".testCommand"); if [ $? -eq 0 ]; then exit 1; fi diff --git a/Java/maven-invoker-plugin-AbstractInvokerMojo_2646/buggy.java b/Java/maven-invoker-plugin-AbstractInvokerMojo_2646/buggy.java new file mode 100644 index 000000000..7883314f4 --- /dev/null +++ b/Java/maven-invoker-plugin-AbstractInvokerMojo_2646/buggy.java @@ -0,0 +1,2880 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.Model; +import org.apache.maven.model.Profile; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecution; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.invoker.model.BuildJob; +import org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Writer; +import org.apache.maven.project.MavenProject; +import org.apache.maven.settings.Settings; +import org.apache.maven.settings.SettingsUtils; +import org.apache.maven.settings.TrackableBase; +import org.apache.maven.settings.building.DefaultSettingsBuildingRequest; +import org.apache.maven.settings.building.SettingsBuilder; +import org.apache.maven.settings.building.SettingsBuildingException; +import org.apache.maven.settings.building.SettingsBuildingRequest; +import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer; +import org.apache.maven.shared.invoker.CommandLineConfigurationException; +import org.apache.maven.shared.invoker.DefaultInvocationRequest; +import org.apache.maven.shared.invoker.InvocationRequest; +import org.apache.maven.shared.invoker.InvocationResult; +import org.apache.maven.shared.invoker.Invoker; +import org.apache.maven.shared.invoker.MavenCommandLineBuilder; +import org.apache.maven.shared.invoker.MavenInvocationException; +import org.apache.maven.shared.scriptinterpreter.RunErrorException; +import org.apache.maven.shared.scriptinterpreter.RunFailureException; +import org.apache.maven.shared.scriptinterpreter.ScriptRunner; +import org.apache.maven.shared.utils.logging.MessageBuilder; +import org.apache.maven.toolchain.MisconfiguredToolchainException; +import org.apache.maven.toolchain.ToolchainManagerPrivate; +import org.apache.maven.toolchain.ToolchainPrivate; +import org.codehaus.plexus.interpolation.InterpolationException; +import org.codehaus.plexus.interpolation.Interpolator; +import org.codehaus.plexus.interpolation.MapBasedValueSource; +import org.codehaus.plexus.interpolation.RegexBasedInterpolator; +import org.codehaus.plexus.util.DirectoryScanner; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.IOUtil; +import org.codehaus.plexus.util.InterpolationFilterReader; +import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.ReflectionUtils; +import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.WriterFactory; +import org.codehaus.plexus.util.cli.CommandLineException; +import org.codehaus.plexus.util.cli.CommandLineUtils; +import org.codehaus.plexus.util.cli.Commandline; +import org.codehaus.plexus.util.cli.StreamConsumer; +import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.codehaus.plexus.util.xml.Xpp3DomWriter; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.Writer; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.TreeSet; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +import static org.apache.maven.shared.utils.logging.MessageUtils.buffer; + +/** + * Provides common code for mojos invoking sub builds. + * + * @author Stephen Connolly + * @since 15-Aug-2009 09:09:29 + */ +public abstract class AbstractInvokerMojo + extends AbstractMojo +{ + /** + * The zero-based column index where to print the invoker result. + */ + private static final int RESULT_COLUMN = 60; + + /** + * Flag used to suppress certain invocations. This is useful in tailoring the build using profiles. + * + * @since 1.1 + */ + @Parameter( property = "invoker.skip", defaultValue = "false" ) + private boolean skipInvocation; + + /** + * Flag used to suppress the summary output notifying of successes and failures. If set to true, the + * only indication of the build's success or failure will be the effect it has on the main build (if it fails, the + * main build should fail as well). If {@link #streamLogs} is enabled, the sub-build summary will also provide an + * indication. + */ + @Parameter( defaultValue = "false" ) + protected boolean suppressSummaries; + + /** + * Flag used to determine whether the build logs should be output to the normal mojo log. + */ + @Parameter( property = "invoker.streamLogs", defaultValue = "false" ) + private boolean streamLogs; + + /** + * The local repository for caching artifacts. It is strongly recommended to specify a path to an isolated + * repository like ${project.build.directory}/it-repo. Otherwise, your ordinary local repository will + * be used, potentially soiling it with broken artifacts. + */ + @Parameter( property = "invoker.localRepositoryPath", defaultValue = "${settings.localRepository}" ) + private File localRepositoryPath; + + /** + * Directory to search for integration tests. + */ + @Parameter( property = "invoker.projectsDirectory", defaultValue = "${basedir}/src/it/" ) + private File projectsDirectory; + + /** + * Base directory where all build reports are written to. Every execution of an integration test will produce an XML + * file which contains the information about success or failure of that particular build job. The format of the + * resulting XML file is documented in the given build-job reference. + * + * @since 1.4 + */ + @Parameter( property = "invoker.reportsDirectory", defaultValue = "${project.build.directory}/invoker-reports" ) + private File reportsDirectory; + + /** + * A flag to disable the generation of build reports. + * + * @since 1.4 + */ + @Parameter( property = "invoker.disableReports", defaultValue = "false" ) + private boolean disableReports; + + /** + * Directory to which projects should be cloned prior to execution. If set to {@code null}, each integration test + * will be run in the directory in which the corresponding IT POM was found. In this case, you most likely want to + * configure your SCM to ignore target and build.log in the test's base directory. + * + * @since 1.1 + */ + @Parameter( property = "invoker.cloneProjectsTo" ) + private File cloneProjectsTo; + + // CHECKSTYLE_OFF: LineLength + /** + * Some files are normally excluded when copying the IT projects from the directory specified by the parameter + * projectsDirectory to the directory given by cloneProjectsTo (e.g. .svn, CVS, + * *~, etc: see + * reference for full list). Setting this parameter to true will cause all files to be copied to + * the cloneProjectsTo directory. + * + * @since 1.2 + */ + @Parameter( defaultValue = "false" ) + private boolean cloneAllFiles; + // CHECKSTYLE_ON: LineLength + + /** + * Ensure the {@link #cloneProjectsTo} directory is not polluted with files from earlier invoker runs. + * + * @since 1.6 + */ + @Parameter( defaultValue = "true" ) + private boolean cloneClean; + + /** + * A single POM to build, skipping any scanning parameters and behavior. + */ + @Parameter( property = "invoker.pom" ) + private File pom; + + /** + * Include patterns for searching the integration test directory for projects. This parameter is meant to be set + * from the POM. If this parameter is not set, the plugin will search for all pom.xml files one + * directory below {@link #projectsDirectory} (i.e. */pom.xml).
    + *
    + * Starting with version 1.3, mere directories can also be matched by these patterns. For example, the include + * pattern * will run Maven builds on all immediate sub directories of {@link #projectsDirectory}, + * regardless if they contain a pom.xml. This allows to perform builds that need/should not depend on + * the existence of a POM. + */ + @Parameter + private List pomIncludes = Collections.singletonList( "*/pom.xml" ); + + /** + * Exclude patterns for searching the integration test directory. This parameter is meant to be set from the POM. By + * default, no POM files are excluded. For the convenience of using an include pattern like *, the + * custom settings file specified by the parameter {@link #settingsFile} will always be excluded automatically. + */ + @Parameter + private List pomExcludes = Collections.emptyList(); + + /** + * Include patterns for searching the projects directory for projects that need to be run before the other projects. + * This parameter allows to declare projects that perform setup tasks like installing utility artifacts into the + * local repository. Projects matched by these patterns are implicitly excluded from the scan for ordinary projects. + * Also, the exclusions defined by the parameter {@link #pomExcludes} apply to the setup projects, too. Default + * value is: setup*/pom.xml. + * + * @since 1.3 + */ + @Parameter + private List setupIncludes = Collections.singletonList( "setup*/pom.xml" ); + + /** + * The list of goals to execute on each project. Default value is: package. + */ + @Parameter + private List goals = Collections.singletonList( "package" ); + + /** + */ + @Component + private Invoker invoker; + + @Component + private SettingsBuilder settingsBuilder; + + @Component + private ToolchainManagerPrivate toolchainManagerPrivate; + + /** + * Relative path of a selector script to run prior in order to decide if the build should be executed. This script + * may be written with either BeanShell or Groovy. If the file extension is omitted (e.g. selector), + * the plugin searches for the file by trying out the well-known extensions .bsh and + * .groovy. If this script exists for a particular project but returns any non-null value different + * from true, the corresponding build is flagged as skipped. In this case, none of the pre-build hook + * script, Maven nor the post-build hook script will be invoked. If this script throws an exception, the + * corresponding build is flagged as in error, and none of the pre-build hook script, Maven not the post-build hook + * script will be invoked. + * + * @since 1.5 + */ + @Parameter( property = "invoker.selectorScript", defaultValue = "selector" ) + private String selectorScript; + + /** + * Relative path of a pre-build hook script to run prior to executing the build. This script may be written with + * either BeanShell or Groovy (since 1.3). If the file extension is omitted (e.g. prebuild), the plugin + * searches for the file by trying out the well-known extensions .bsh and .groovy. If this + * script exists for a particular project but returns any non-null value different from true or throws + * an exception, the corresponding build is flagged as a failure. In this case, neither Maven nor the post-build + * hook script will be invoked. + */ + @Parameter( property = "invoker.preBuildHookScript", defaultValue = "prebuild" ) + private String preBuildHookScript; + + /** + * Relative path of a cleanup/verification hook script to run after executing the build. This script may be written + * with either BeanShell or Groovy (since 1.3). If the file extension is omitted (e.g. verify), the + * plugin searches for the file by trying out the well-known extensions .bsh and .groovy. + * If this script exists for a particular project but returns any non-null value different from true or + * throws an exception, the corresponding build is flagged as a failure. + */ + @Parameter( property = "invoker.postBuildHookScript", defaultValue = "postbuild" ) + private String postBuildHookScript; + + /** + * Location of a properties file that defines CLI properties for the test. + */ + @Parameter( property = "invoker.testPropertiesFile", defaultValue = "test.properties" ) + private String testPropertiesFile; + + /** + * Common set of properties to pass in on each project's command line, via -D parameters. + * + * @since 1.1 + */ + @Parameter + private Map properties; + + /** + * Whether to show errors in the build output. + */ + @Parameter( property = "invoker.showErrors", defaultValue = "false" ) + private boolean showErrors; + + /** + * Whether to show debug statements in the build output. + */ + @Parameter( property = "invoker.debug", defaultValue = "false" ) + private boolean debug; + + /** + * Suppress logging to the build.log file. + */ + @Parameter( property = "invoker.noLog", defaultValue = "false" ) + private boolean noLog; + + /** + * By default a {@code build.log} is created in the root of the project. By setting this folder + * files are written to a different folder, respecting the structure of the projectsDirectory. + * + * @since 3.2.0 + */ + @Parameter + private File logDirectory; + + /** + * List of profile identifiers to explicitly trigger in the build. + * + * @since 1.1 + */ + @Parameter + private List profiles; + + /** + * A list of additional properties which will be used to filter tokens in POMs and goal files. + * + * @since 1.3 + */ + @Parameter + private Map filterProperties; + + /** + * The Maven Project Object + * + * @since 1.1 + */ + @Parameter( defaultValue = "${project}", readonly = true, required = true ) + private MavenProject project; + + @Parameter( defaultValue = "${session}", readonly = true, required = true ) + private MavenSession session; + + @Parameter( defaultValue = "${mojoExecution}", readonly = true, required = true ) + private MojoExecution mojoExecution; + + /** + * A comma separated list of projectname patterns to run. Specify this parameter to run individual tests by file + * name, overriding the {@link #setupIncludes}, {@link #pomIncludes} and {@link #pomExcludes} parameters. Each + * pattern you specify here will be used to create an include/exclude pattern formatted like + * ${projectsDirectory}/pattern. To exclude a test, prefix the pattern with a '!'. + * So you can just type -Dinvoker.test=SimpleTest,Comp*Test,!Compare* to run builds in + * ${projectsDirectory}/SimpleTest and ${projectsDirectory}/ComplexTest, but not + * ${projectsDirectory}/CompareTest + * + * @since 1.1 (exclusion since 1.8) + */ + @Parameter( property = "invoker.test" ) + private String invokerTest; + + /** + * Path to an alternate settings.xml to use for Maven invocation with all ITs. Note that the + * <localRepository> element of this settings file is always ignored, i.e. the path given by the + * parameter {@link #localRepositoryPath} is dominant. + * + * @since 1.2 + */ + @Parameter( property = "invoker.settingsFile" ) + private File settingsFile; + + /** + * The MAVEN_OPTS environment variable to use when invoking Maven. This value can be overridden for + * individual integration tests by using {@link #invokerPropertiesFile}. + * + * @since 1.2 + */ + @Parameter( property = "invoker.mavenOpts" ) + private String mavenOpts; + + /** + * The home directory of the Maven installation to use for the forked builds. Defaults to the current Maven + * installation. + * + * @since 1.3 + */ + @Parameter( property = "invoker.mavenHome" ) + private File mavenHome; + + /** + * mavenExecutable can either be a file relative to ${maven.home}/bin/ or an absolute file. + * + * @since 1.8 + * @see Invoker#setMavenExecutable(File) + */ + @Parameter( property = "invoker.mavenExecutable" ) + private String mavenExecutable; + + /** + * The JAVA_HOME environment variable to use for forked Maven invocations. Defaults to the current Java + * home directory. + * + * @since 1.3 + */ + @Parameter( property = "invoker.javaHome" ) + private File javaHome; + + /** + * The file encoding for the pre-/post-build scripts and the list files for goals and profiles. + * + * @since 1.2 + */ + @Parameter( property = "encoding", defaultValue = "${project.build.sourceEncoding}" ) + private String encoding; + + /** + * The current user system settings for use in Maven. + * + * @since 1.2 + */ + @Parameter( defaultValue = "${settings}", readonly = true, required = true ) + private Settings settings; + + /** + * A flag whether the test class path of the project under test should be included in the class path of the + * pre-/post-build scripts. If set to false, the class path of script interpreter consists only of the + * runtime dependencies of the Maven Invoker Plugin. If set the true, + * the project's test class path will be prepended to the interpreter class path. Among others, this feature allows + * the scripts to access utility classes from the test sources of your project. + * + * @since 1.2 + */ + @Parameter( property = "invoker.addTestClassPath", defaultValue = "false" ) + private boolean addTestClassPath; + + /** + * The test class path of the project under test. + */ + @Parameter( defaultValue = "${project.testClasspathElements}", readonly = true ) + private List testClassPath; + + /** + * The name of an optional project-specific file that contains properties used to specify settings for an individual + * Maven invocation. Any property present in the file will override the corresponding setting from the plugin + * configuration. The values of the properties are filtered and may use expressions like + * ${project.version} to reference project properties or values from the parameter + * {@link #filterProperties}.

    + * + *

    + * As of 3.2.0 it is possible to put this folder in any of the ancestor folders, where properties will be inherited. + * This way you can provide a single properties file for a group of projects + *

    + * + * The snippet below describes the supported properties: + *
    +     * # A comma or space separated list of goals/phases to execute, may
    +     * # specify an empty list to execute the default goal of the IT project.
    +     * # Environment variables used by maven plugins can be added here
    +     * invoker.goals = clean install -Dplugin.variable=value
    +     *
    +     * # Or you can give things like this if you need.
    +     * invoker.goals = -T2 clean verify
    +     *
    +     * # Optionally, a list of goals to run during further invocations of Maven
    +     * invoker.goals.2 = ${project.groupId}:${project.artifactId}:${project.version}:run
    +     *
    +     * # A comma or space separated list of profiles to activate
    +     * invoker.profiles = its,jdk15
    +     *
    +     * # The path to an alternative POM or base directory to invoke Maven on, defaults to the
    +     * # project that was originally specified in the plugin configuration
    +     * # Since plugin version 1.4
    +     * invoker.project = sub-module
    +     *
    +     * # The value for the environment variable MAVEN_OPTS
    +     * invoker.mavenOpts = -Dfile.encoding=UTF-16 -Xms32m -Xmx256m
    +     *
    +     * # Possible values are "fail-fast" (default), "fail-at-end" and "fail-never"
    +     * invoker.failureBehavior = fail-never
    +     *
    +     * # The expected result of the build, possible values are "success" (default) and "failure"
    +     * invoker.buildResult = failure
    +     *
    +     * # A boolean value controlling the aggregator mode of Maven, defaults to "false"
    +     * invoker.nonRecursive = true
    +     *
    +     * # A boolean value controlling the network behavior of Maven, defaults to "false"
    +     * # Since plugin version 1.4
    +     * invoker.offline = true
    +     *
    +     * # The path to the properties file from which to load system properties, defaults to the
    +     * # filename given by the plugin parameter testPropertiesFile
    +     * # Since plugin version 1.4
    +     * invoker.systemPropertiesFile = test.properties
    +     *
    +     * # An optional human friendly name for this build job to be included in the build reports.
    +     * # Since plugin version 1.4
    +     * invoker.name = Test Build 01
    +     *
    +     * # An optional description for this build job to be included in the build reports.
    +     * # Since plugin version 1.4
    +     * invoker.description = Checks the support for build reports.
    +     *
    +     * # A comma separated list of JRE versions on which this build job should be run.
    +     * # Since plugin version 1.4
    +     * invoker.java.version = 1.4+, !1.4.1, 1.7-
    +     * 
    +     * # A comma separated list of OS families on which this build job should be run.
    +     * # Since plugin version 1.4
    +     * invoker.os.family = !windows, unix, mac
    +     *
    +     * # A comma separated list of Maven versions on which this build should be run.
    +     * # Since plugin version 1.5
    +     * invoker.maven.version = 2.0.10+, !2.1.0, !2.2.0
    +     * 
    +     * # A mapping for toolchain to ensure it exists
    +     * # Since plugin version 3.2.0
    +     * invoker.toolchain.<type>.<provides> = value
    +     * invoker.toolchain.jdk.version = 11
    +     * 
    +     * # For java.version, maven.version, os.family and toolchain it is possible to define multiple selectors.
    +     * # If one of the indexed selectors matches, the test is executed.
    +     * # With the invoker.x.y equivalents you can specify global matchers.  
    +     * selector.1.java.version = 1.8+
    +     * selector.1.maven.version = 3.2.5+
    +     * selector.1.os.family = !windows
    +     * selector.2.maven.version = 3.0+
    +     * selector.3.java.version = 9+
    +     * 
    +     * # A boolean value controlling the debug logging level of Maven, , defaults to "false"
    +     * # Since plugin version 1.8
    +     * invoker.debug = true
    +     * 
    +     * # Path to an alternate settings.xml to use for Maven invocation with this IT.
    +     * # Since plugin version 3.0.1
    +     * invoker.settingsFile = ../
    +     *
    +     * # An integer value to control run order of projects. sorted in the descending order of the ordinal.
    +     * # In other words, the BuildJobs with the highest numbers will be executed first
    +     * # Since plugin version 3.2.1
    +     * invoker.ordinal = 3
    +     * invoker.ordinal = 1
    +     *
    +     * # The additional value for the environment variable.
    +     * # Since plugin version 3.2.2
    +     * invoker.environmentVariables.<variableName> = variableValue
    +     * invoker.environmentVariables.MY_ENV_NAME = myEnvValue
    +     *
    +     * 
    + * + * @since 1.2 + */ + @Parameter( property = "invoker.invokerPropertiesFile", defaultValue = "invoker.properties" ) + private String invokerPropertiesFile; + + /** + * flag to enable show mvn version used for running its (cli option : -V,--show-version ) + * + * @since 1.4 + */ + @Parameter( property = "invoker.showVersion", defaultValue = "false" ) + private boolean showVersion; + + /** + *

    Number of threads for running tests in parallel. This will be the number of maven forked process in parallel. + * When terminated with "C", the number part is multiplied by the number of processors (cores) available + * to the Java virtual machine. Floating point value are only accepted together with "C".

    + * + *

    Example values: "1.5C", "4"

    + * + * @since 1.6 + */ + @Parameter( property = "invoker.parallelThreads", defaultValue = "1" ) + private String parallelThreads; + + /** + * @since 1.6 + */ + @Parameter( property = "plugin.artifacts", required = true, readonly = true ) + private List pluginArtifacts; + + /** + * If enable and if you have a settings file configured for the execution, it will be merged with your user + * settings. + * + * @since 1.6 + */ + @Parameter( property = "invoker.mergeUserSettings", defaultValue = "false" ) + private boolean mergeUserSettings; + + /** + * Additional environment variables to set on the command line. + * + * @since 1.8 + */ + @Parameter + private Map environmentVariables; + + /** + * Additional variables for use in the hook scripts. + * + * @since 1.9 + */ + @Parameter + private Map scriptVariables; + + /** + * + * @since 3.0.2 + */ + @Parameter( defaultValue = "0", property = "invoker.timeoutInSeconds" ) + private int timeoutInSeconds; + + /** + * Write test result in junit format. + * @since 3.1.2 + */ + @Parameter( defaultValue = "false", property = "invoker.writeJunitReport" ) + private boolean writeJunitReport; + + /** + * The package name use in junit report + * @since 3.1.2 + */ + @Parameter( defaultValue = "maven.invoker.it", property = "invoker.junitPackageName" ) + private String junitPackageName = "maven.invoker.it"; + + /** + * The scripter runner that is responsible to execute hook scripts. + */ + private ScriptRunner scriptRunner; + + /** + * A string used to prefix the file name of the filtered POMs in case the POMs couldn't be filtered in-place (i.e. + * the projects were not cloned to a temporary directory), can be null. This will be set to + * null if the POMs have already been filtered during cloning. + */ + private String filteredPomPrefix = "interpolated-"; + + /** + * The format for elapsed build time. + */ + private final DecimalFormat secFormat = new DecimalFormat( "(0.0 s)", new DecimalFormatSymbols( Locale.ENGLISH ) ); + + /** + * The version of Maven which is used to run the builds + */ + private String actualMavenVersion; + + /** + * Invokes Maven on the configured test projects. + * + * @throws org.apache.maven.plugin.MojoExecutionException If the goal encountered severe errors. + * @throws org.apache.maven.plugin.MojoFailureException If any of the Maven builds failed. + */ + public void execute() + throws MojoExecutionException, MojoFailureException + { + if ( skipInvocation ) + { + getLog().info( "Skipping invocation per configuration." + + " If this is incorrect, ensure the skipInvocation parameter is not set to true." ); + return; + } + + if ( StringUtils.isEmpty( encoding ) ) + { + getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING + + ", i.e. build is platform dependent!" ); + } + + // done it here to prevent issues with concurrent access in case of parallel run + if ( !disableReports ) + { + setupReportsFolder(); + } + + List buildJobs; + if ( pom == null ) + { + try + { + buildJobs = getBuildJobs(); + } + catch ( final IOException e ) + { + throw new MojoExecutionException( "Error retrieving POM list from includes, " + + "excludes, and projects directory. Reason: " + e.getMessage(), e ); + } + } + else + { + try + { + projectsDirectory = pom.getCanonicalFile().getParentFile(); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to discover projectsDirectory from " + + "pom File parameter. Reason: " + e.getMessage(), e ); + } + + buildJobs = Collections.singletonList( new BuildJob( pom.getName(), BuildJob.Type.NORMAL ) ); + } + + if ( buildJobs.isEmpty() ) + { + doFailIfNoProjects(); + + getLog().info( "No projects were selected for execution." ); + return; + } + + handleScriptRunnerWithScriptClassPath(); + + Collection collectedProjects = new LinkedHashSet<>(); + for ( BuildJob buildJob : buildJobs ) + { + collectProjects( projectsDirectory, buildJob.getProject(), collectedProjects, true ); + } + + File projectsDir = projectsDirectory; + + if ( cloneProjectsTo != null ) + { + cloneProjects( collectedProjects ); + projectsDir = cloneProjectsTo; + } + else if ( cloneProjectsTo == null && "maven-plugin".equals( project.getPackaging() ) ) + { + cloneProjectsTo = new File( project.getBuild().getDirectory(), "its" ); + cloneProjects( collectedProjects ); + projectsDir = cloneProjectsTo; + } + else + { + getLog().warn( "Filtering of parent/child POMs is not supported without cloning the projects" ); + } + + // First run setup jobs. + List setupBuildJobs = null; + try + { + setupBuildJobs = getSetupBuildJobsFromFolders(); + } + catch ( IOException e ) + { + getLog().error( "Failure during scanning of folders.", e ); + // TODO: Check shouldn't we fail in case of problems? + } + + if ( !setupBuildJobs.isEmpty() ) + { + // Run setup jobs in single thread + // mode. + // + // Some Idea about ordering? + getLog().info( "Running " + setupBuildJobs.size() + " setup job" + + ( ( setupBuildJobs.size() < 2 ) ? "" : "s" ) + ":" ); + runBuilds( projectsDir, setupBuildJobs, 1 ); + getLog().info( "Setup done." ); + } + + // Afterwards run all other jobs. + List nonSetupBuildJobs = getNonSetupJobs( buildJobs ); + // We will run the non setup jobs with the configured + // parallelThreads number. + runBuilds( projectsDir, nonSetupBuildJobs, getParallelThreadsCount() ); + + writeSummaryFile( nonSetupBuildJobs ); + + processResults( new InvokerSession( nonSetupBuildJobs ) ); + + } + + /** + * This will create the necessary folders for the reports. + * + * @throws MojoExecutionException in case of failure during creation of the reports folder. + */ + private void setupReportsFolder() + throws MojoExecutionException + { + // If it exists from previous run... + if ( reportsDirectory.exists() ) + { + try + { + FileUtils.deleteDirectory( reportsDirectory ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failure while trying to delete " + + reportsDirectory.getAbsolutePath(), e ); + } + } + if ( !reportsDirectory.mkdirs() ) + { + throw new MojoExecutionException( "Failure while creating the " + reportsDirectory.getAbsolutePath() ); + } + } + + private List getNonSetupJobs( List buildJobs ) + { + List result = new LinkedList<>(); + for ( BuildJob buildJob : buildJobs ) + { + if ( !buildJob.getType().equals( BuildJob.Type.SETUP ) ) + { + result.add( buildJob ); + } + } + return result; + } + + private void handleScriptRunnerWithScriptClassPath() + { + final List scriptClassPath; + if ( addTestClassPath ) + { + scriptClassPath = new ArrayList<>( testClassPath ); + for ( Artifact pluginArtifact : pluginArtifacts ) + { + scriptClassPath.remove( pluginArtifact.getFile().getAbsolutePath() ); + } + } + else + { + scriptClassPath = null; + } + scriptRunner = new ScriptRunner( getLog() ); + scriptRunner.setScriptEncoding( encoding ); + scriptRunner.setGlobalVariable( "localRepositoryPath", localRepositoryPath ); + if ( scriptVariables != null ) + { + for ( Entry entry : scriptVariables.entrySet() ) + { + scriptRunner.setGlobalVariable( entry.getKey(), entry.getValue() ); + } + } + scriptRunner.setClassPath( scriptClassPath ); + } + + private void writeSummaryFile( List buildJobs ) + throws MojoExecutionException + { + + File summaryReportFile = new File( reportsDirectory, "invoker-summary.txt" ); + + try ( Writer writer = new BufferedWriter( new FileWriter( summaryReportFile ) ) ) + { + for ( BuildJob buildJob : buildJobs ) + { + if ( !buildJob.getResult().equals( BuildJob.Result.SUCCESS ) ) + { + writer.append( buildJob.getResult() ); + writer.append( " [" ); + writer.append( buildJob.getProject() ); + writer.append( "] " ); + if ( buildJob.getFailureMessage() != null ) + { + writer.append( " " ); + writer.append( buildJob.getFailureMessage() ); + } + writer.append( "\n" ); + } + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to write summary report " + summaryReportFile, e ); + } + } + + protected void doFailIfNoProjects() + throws MojoFailureException + { + // should only be used during run and verify + } + + /** + * Processes the results of invoking the build jobs. + * + * @param invokerSession The session with the build jobs, must not be null. + * @throws MojoFailureException If the mojo had failed as a result of invoking the build jobs. + * @since 1.4 + */ + abstract void processResults( InvokerSession invokerSession ) + throws MojoFailureException; + + /** + * Creates a new reader for the specified file, using the plugin's {@link #encoding} parameter. + * + * @param file The file to create a reader for, must not be null. + * @return The reader for the file, never null. + * @throws java.io.IOException If the specified file was not found or the configured encoding is not supported. + */ + private Reader newReader( File file ) + throws IOException + { + if ( StringUtils.isNotEmpty( encoding ) ) + { + return ReaderFactory.newReader( file, encoding ); + } + else + { + return ReaderFactory.newPlatformReader( file ); + } + } + + /** + * Collects all projects locally reachable from the specified project. The method will as such try to read the POM + * and recursively follow its parent/module elements. + * + * @param projectsDir The base directory of all projects, must not be null. + * @param projectPath The relative path of the current project, can denote either the POM or its base directory, + * must not be null. + * @param projectPaths The set of already collected projects to add new projects to, must not be null. + * This set will hold the relative paths to either a POM file or a project base directory. + * @param included A flag indicating whether the specified project has been explicitly included via the parameter + * {@link #pomIncludes}. Such projects will always be added to the result set even if there is no + * corresponding POM. + * @throws org.apache.maven.plugin.MojoExecutionException If the project tree could not be traversed. + */ + private void collectProjects( File projectsDir, String projectPath, Collection projectPaths, + boolean included ) + throws MojoExecutionException + { + projectPath = projectPath.replace( '\\', '/' ); + File pomFile = new File( projectsDir, projectPath ); + if ( pomFile.isDirectory() ) + { + pomFile = new File( pomFile, "pom.xml" ); + if ( !pomFile.exists() ) + { + if ( included ) + { + projectPaths.add( projectPath ); + } + return; + } + if ( !projectPath.endsWith( "/" ) ) + { + projectPath += '/'; + } + projectPath += "pom.xml"; + } + else if ( !pomFile.isFile() ) + { + return; + } + if ( !projectPaths.add( projectPath ) ) + { + return; + } + getLog().debug( "Collecting parent/child projects of " + projectPath ); + + Model model = PomUtils.loadPom( pomFile ); + + try + { + String projectsRoot = projectsDir.getCanonicalPath(); + String projectDir = pomFile.getParent(); + + String parentPath = "../pom.xml"; + if ( model.getParent() != null && StringUtils.isNotEmpty( model.getParent().getRelativePath() ) ) + { + parentPath = model.getParent().getRelativePath(); + } + String parent = relativizePath( new File( projectDir, parentPath ), projectsRoot ); + if ( parent != null ) + { + collectProjects( projectsDir, parent, projectPaths, false ); + } + + Collection modulePaths = new LinkedHashSet<>(); + + modulePaths.addAll( model.getModules() ); + + for ( Profile profile : model.getProfiles() ) + { + modulePaths.addAll( profile.getModules() ); + } + + for ( String modulePath : modulePaths ) + { + String module = relativizePath( new File( projectDir, modulePath ), projectsRoot ); + if ( module != null ) + { + collectProjects( projectsDir, module, projectPaths, false ); + } + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to analyze POM: " + pomFile, e ); + } + } + + /** + * Copies the specified projects to the directory given by {@link #cloneProjectsTo}. A project may either be denoted + * by a path to a POM file or merely by a path to a base directory. During cloning, the POM files will be filtered. + * + * @param projectPaths The paths to the projects to clone, relative to the projects directory, must not be + * null nor contain null elements. + * @throws org.apache.maven.plugin.MojoExecutionException If the the projects could not be copied/filtered. + */ + private void cloneProjects( Collection projectPaths ) + throws MojoExecutionException + { + if ( !cloneProjectsTo.mkdirs() && cloneClean ) + { + try + { + FileUtils.cleanDirectory( cloneProjectsTo ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Could not clean the cloneProjectsTo directory. Reason: " + + e.getMessage(), e ); + } + } + + // determine project directories to clone + Collection dirs = new LinkedHashSet<>(); + for ( String projectPath : projectPaths ) + { + if ( !new File( projectsDirectory, projectPath ).isDirectory() ) + { + projectPath = getParentPath( projectPath ); + } + dirs.add( projectPath ); + } + + boolean filter; + + // clone project directories + try + { + filter = !cloneProjectsTo.getCanonicalFile().equals( projectsDirectory.getCanonicalFile() ); + + List clonedSubpaths = new ArrayList<>(); + + for ( String subpath : dirs ) + { + // skip this project if its parent directory is also scheduled for cloning + if ( !".".equals( subpath ) && dirs.contains( getParentPath( subpath ) ) ) + { + continue; + } + + // avoid copying subdirs that are already cloned. + if ( !alreadyCloned( subpath, clonedSubpaths ) ) + { + // avoid creating new files that point to dir/. + if ( ".".equals( subpath ) ) + { + String cloneSubdir = relativizePath( cloneProjectsTo, projectsDirectory.getCanonicalPath() ); + + // avoid infinite recursion if the cloneTo path is a subdirectory. + if ( cloneSubdir != null ) + { + File temp = File.createTempFile( "pre-invocation-clone.", "" ); + temp.delete(); + temp.mkdirs(); + + copyDirectoryStructure( projectsDirectory, temp ); + + FileUtils.deleteDirectory( new File( temp, cloneSubdir ) ); + + copyDirectoryStructure( temp, cloneProjectsTo ); + } + else + { + copyDirectoryStructure( projectsDirectory, cloneProjectsTo ); + } + } + else + { + File srcDir = new File( projectsDirectory, subpath ); + File dstDir = new File( cloneProjectsTo, subpath ); + copyDirectoryStructure( srcDir, dstDir ); + } + + clonedSubpaths.add( subpath ); + } + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to clone projects from: " + projectsDirectory + " to: " + + cloneProjectsTo + ". Reason: " + e.getMessage(), e ); + } + + // filter cloned POMs + if ( filter ) + { + for ( String projectPath : projectPaths ) + { + File pomFile = new File( cloneProjectsTo, projectPath ); + if ( pomFile.isFile() ) + { + buildInterpolatedFile( pomFile, pomFile ); + } + + // MINVOKER-186 + // The following is a temporary solution to support Maven 3.3.1 (.mvn/extensions.xml) filtering + // Will be replaced by MINVOKER-117 with general filtering mechanism + File baseDir = pomFile.getParentFile(); + File mvnDir = new File( baseDir, ".mvn" ); + if ( mvnDir.isDirectory() ) + { + File extensionsFile = new File( mvnDir, "extensions.xml" ); + if ( extensionsFile.isFile() ) + { + buildInterpolatedFile( extensionsFile, extensionsFile ); + } + } + // END MINVOKER-186 + } + filteredPomPrefix = null; + } + } + + /** + * Gets the parent path of the specified relative path. + * + * @param path The relative path whose parent should be retrieved, must not be null. + * @return The parent path or "." if the specified path has no parent, never null. + */ + private String getParentPath( String path ) + { + int lastSep = Math.max( path.lastIndexOf( '/' ), path.lastIndexOf( '\\' ) ); + return ( lastSep < 0 ) ? "." : path.substring( 0, lastSep ); + } + + /** + * Copied a directory structure with default exclusions (.svn, CVS, etc) + * + * @param sourceDir The source directory to copy, must not be null. + * @param destDir The target directory to copy to, must not be null. + * @throws java.io.IOException If the directory structure could not be copied. + */ + private void copyDirectoryStructure( File sourceDir, File destDir ) + throws IOException + { + DirectoryScanner scanner = new DirectoryScanner(); + scanner.setBasedir( sourceDir ); + if ( !cloneAllFiles ) + { + scanner.addDefaultExcludes(); + } + scanner.scan(); + + /* + * NOTE: Make sure the destination directory is always there (even if empty) to support POM-less ITs. + */ + destDir.mkdirs(); + // Create all the directories, including any symlinks present in source + FileUtils.mkDirs( sourceDir, scanner.getIncludedDirectories(), destDir ); + + for ( String includedFile : scanner.getIncludedFiles() ) + { + File sourceFile = new File( sourceDir, includedFile ); + File destFile = new File( destDir, includedFile ); + FileUtils.copyFile( sourceFile, destFile ); + + // ensure clone project must be writable for additional changes + destFile.setWritable( true ); + } + } + + /** + * Determines whether the specified sub path has already been cloned, i.e. whether one of its ancestor directories + * was already cloned. + * + * @param subpath The sub path to check, must not be null. + * @param clonedSubpaths The list of already cloned paths, must not be null nor contain + * null elements. + * @return true if the specified path has already been cloned, false otherwise. + */ + static boolean alreadyCloned( String subpath, List clonedSubpaths ) + { + for ( String path : clonedSubpaths ) + { + if ( ".".equals( path ) || subpath.equals( path ) || subpath.startsWith( path + File.separator ) ) + { + return true; + } + } + + return false; + } + + /** + * Runs the specified build jobs. + * + * @param projectsDir The base directory of all projects, must not be null. + * @param buildJobs The build jobs to run must not be null nor contain null elements. + * @throws org.apache.maven.plugin.MojoExecutionException If any build could not be launched. + */ + private void runBuilds( final File projectsDir, List buildJobs, int runWithParallelThreads ) + throws MojoExecutionException + { + if ( !localRepositoryPath.exists() ) + { + localRepositoryPath.mkdirs(); + } + + // ----------------------------------------------- + // interpolate settings file + // ----------------------------------------------- + + File interpolatedSettingsFile = interpolateSettings( settingsFile ); + + final File mergedSettingsFile = mergeSettings( interpolatedSettingsFile ); + + if ( mavenHome != null ) + { + actualMavenVersion = SelectorUtils.getMavenVersion( mavenHome ); + } + else + { + actualMavenVersion = SelectorUtils.getMavenVersion(); + } + scriptRunner.setGlobalVariable( "mavenVersion", actualMavenVersion ); + + final CharSequence actualJreVersion; + // @todo if ( javaVersions ) ... to be picked up from toolchains + if ( javaHome != null ) + { + actualJreVersion = resolveExternalJreVersion(); + } + else + { + actualJreVersion = SelectorUtils.getJreVersion(); + } + + final Path projectsPath = this.projectsDirectory.toPath(); + + Set folderGroupSet = new HashSet<>(); + folderGroupSet.add( Paths.get( "." ) ); + for ( BuildJob buildJob : buildJobs ) + { + Path p = Paths.get( buildJob.getProject() ); + + if ( Files.isRegularFile( projectsPath.resolve( p ) ) ) + { + p = p.getParent(); + } + + if ( p != null ) + { + p = p.getParent(); + } + + while ( p != null && folderGroupSet.add( p ) ) + { + p = p.getParent(); + } + } + + List folderGroup = new ArrayList<>( folderGroupSet ); + Collections.sort( folderGroup ); + + final Map globalInvokerProperties = new HashMap<>(); + + for ( Path path : folderGroup ) + { + Properties ancestorProperties = globalInvokerProperties.get( projectsPath.resolve( path ).getParent() ); + + Path currentInvokerProperties = projectsPath.resolve( path ).resolve( invokerPropertiesFile ); + + Properties currentProperties; + if ( Files.isRegularFile( currentInvokerProperties ) ) + { + if ( ancestorProperties != null ) + { + currentProperties = new Properties( ancestorProperties ); + + } + else + { + currentProperties = new Properties(); + } + } + else + { + currentProperties = ancestorProperties; + } + + if ( Files.isRegularFile( currentInvokerProperties ) ) + { + try ( InputStream in = new FileInputStream( currentInvokerProperties.toFile() ) ) + { + currentProperties.load( in ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to read invoker properties: " + + currentInvokerProperties ); + } + } + + if ( currentProperties != null ) + { + globalInvokerProperties.put( projectsPath.resolve( path ).normalize(), currentProperties ); + } + } + + try + { + if ( runWithParallelThreads > 1 ) + { + getLog().info( "use parallelThreads " + runWithParallelThreads ); + + ExecutorService executorService = Executors.newFixedThreadPool( runWithParallelThreads ); + for ( final BuildJob job : buildJobs ) + { + executorService.execute( new Runnable() + { + public void run() + { + try + { + Path ancestorFolder = getAncestorFolder( projectsPath.resolve( job.getProject() ) ); + + runBuild( projectsDir, job, mergedSettingsFile, javaHome, actualJreVersion, + globalInvokerProperties.get( ancestorFolder ) ); + } + catch ( MojoExecutionException e ) + { + throw new RuntimeException( e.getMessage(), e ); + } + } + } ); + } + + try + { + executorService.shutdown(); + // TODO add a configurable time out + executorService.awaitTermination( Long.MAX_VALUE, TimeUnit.MILLISECONDS ); + } + catch ( InterruptedException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + } + else + { + for ( BuildJob job : buildJobs ) + { + Path ancestorFolder = getAncestorFolder( projectsPath.resolve( job.getProject() ) ); + + runBuild( projectsDir, job, mergedSettingsFile, javaHome, actualJreVersion, + globalInvokerProperties.get( ancestorFolder ) ); + } + } + } + finally + { + if ( interpolatedSettingsFile != null && cloneProjectsTo == null ) + { + interpolatedSettingsFile.delete(); + } + if ( mergedSettingsFile != null && mergedSettingsFile.exists() ) + { + mergedSettingsFile.delete(); + } + } + } + + private Path getAncestorFolder( Path p ) + { + Path ancestor = p; + if ( Files.isRegularFile( ancestor ) ) + { + ancestor = ancestor.getParent(); + } + if ( ancestor != null ) + { + ancestor = ancestor.getParent(); + } + return ancestor; + } + + /** + * Interpolate settings.xml file. + * @param settingsFile a settings file + * + * @return The interpolated settings.xml file. + * @throws MojoExecutionException in case of a problem. + */ + private File interpolateSettings( File settingsFile ) + throws MojoExecutionException + { + File interpolatedSettingsFile = null; + if ( settingsFile != null ) + { + if ( cloneProjectsTo != null ) + { + interpolatedSettingsFile = new File( cloneProjectsTo, "interpolated-" + settingsFile.getName() ); + } + else + { + interpolatedSettingsFile = + new File( settingsFile.getParentFile(), "interpolated-" + settingsFile.getName() ); + } + buildInterpolatedFile( settingsFile, interpolatedSettingsFile ); + } + return interpolatedSettingsFile; + } + + /** + * Merge the settings file + * + * @param interpolatedSettingsFile The interpolated settings file. + * @return The merged settings file. + * @throws MojoExecutionException Fail the build in case the merged settings file can't be created. + */ + private File mergeSettings( File interpolatedSettingsFile ) + throws MojoExecutionException + { + File mergedSettingsFile; + Settings mergedSettings = this.settings; + if ( mergeUserSettings ) + { + if ( interpolatedSettingsFile != null ) + { + // Have to merge the specified settings file (dominant) and the one of the invoking Maven process + try + { + SettingsBuildingRequest request = new DefaultSettingsBuildingRequest(); + request.setGlobalSettingsFile( interpolatedSettingsFile ); + + Settings dominantSettings = settingsBuilder.build( request ).getEffectiveSettings(); + Settings recessiveSettings = cloneSettings(); + SettingsUtils.merge( dominantSettings, recessiveSettings, TrackableBase.USER_LEVEL ); + + mergedSettings = dominantSettings; + getLog().debug( "Merged specified settings file with settings of invoking process" ); + } + catch ( SettingsBuildingException e ) + { + throw new MojoExecutionException( "Could not read specified settings file", e ); + } + } + } + + if ( this.settingsFile != null && !mergeUserSettings ) + { + mergedSettingsFile = interpolatedSettingsFile; + } + else + { + try + { + mergedSettingsFile = writeMergedSettingsFile( mergedSettings ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Could not create temporary file for invoker settings.xml", e ); + } + } + return mergedSettingsFile; + } + + private File writeMergedSettingsFile( Settings mergedSettings ) + throws IOException + { + File mergedSettingsFile; + mergedSettingsFile = File.createTempFile( "invoker-settings", ".xml" ); + + SettingsXpp3Writer settingsWriter = new SettingsXpp3Writer(); + + + try ( FileWriter fileWriter = new FileWriter( mergedSettingsFile ) ) + { + settingsWriter.write( fileWriter, mergedSettings ); + } + + if ( getLog().isDebugEnabled() ) + { + getLog().debug( "Created temporary file for invoker settings.xml: " + + mergedSettingsFile.getAbsolutePath() ); + } + return mergedSettingsFile; + } + + private Settings cloneSettings() + { + Settings recessiveSettings = SettingsUtils.copySettings( this.settings ); + + // MINVOKER-133: reset sourceLevelSet + resetSourceLevelSet( recessiveSettings ); + for ( org.apache.maven.settings.Mirror mirror : recessiveSettings.getMirrors() ) + { + resetSourceLevelSet( mirror ); + } + for ( org.apache.maven.settings.Server server : recessiveSettings.getServers() ) + { + resetSourceLevelSet( server ); + } + for ( org.apache.maven.settings.Proxy proxy : recessiveSettings.getProxies() ) + { + resetSourceLevelSet( proxy ); + } + for ( org.apache.maven.settings.Profile profile : recessiveSettings.getProfiles() ) + { + resetSourceLevelSet( profile ); + } + + return recessiveSettings; + } + + private void resetSourceLevelSet( org.apache.maven.settings.TrackableBase trackable ) + { + try + { + ReflectionUtils.setVariableValueInObject( trackable, "sourceLevelSet", Boolean.FALSE ); + getLog().debug( "sourceLevelSet: " + + ReflectionUtils.getValueIncludingSuperclasses( "sourceLevelSet", trackable ) ); + } + catch ( IllegalAccessException e ) + { + // noop + } + } + + private CharSequence resolveExternalJreVersion() + { + Artifact pluginArtifact = mojoExecution.getMojoDescriptor().getPluginDescriptor().getPluginArtifact(); + pluginArtifact.getFile(); + + Commandline commandLine = new Commandline(); + commandLine.setExecutable( new File( javaHome, "bin/java" ).getAbsolutePath() ); + commandLine.createArg().setValue( "-cp" ); + commandLine.createArg().setFile( pluginArtifact.getFile() ); + commandLine.createArg().setValue( SystemPropertyPrinter.class.getName() ); + commandLine.createArg().setValue( "java.version" ); + + final StringBuilder actualJreVersion = new StringBuilder(); + StreamConsumer consumer = new StreamConsumer() + { + public void consumeLine( String line ) + { + actualJreVersion.append( line ); + } + }; + try + { + CommandLineUtils.executeCommandLine( commandLine, consumer, null ); + } + catch ( CommandLineException e ) + { + getLog().warn( e.getMessage() ); + } + return actualJreVersion; + } + + /** + * Interpolate the pom file. + * + * @param pomFile The pom file. + * @param basedir The base directory. + * @return interpolated pom file location in case we have interpolated the pom file otherwise the original pom file + * will be returned. + * @throws MojoExecutionException + */ + private File interpolatePomFile( File pomFile, File basedir ) + throws MojoExecutionException + { + File interpolatedPomFile = null; + if ( pomFile != null ) + { + if ( StringUtils.isNotEmpty( filteredPomPrefix ) ) + { + interpolatedPomFile = new File( basedir, filteredPomPrefix + pomFile.getName() ); + buildInterpolatedFile( pomFile, interpolatedPomFile ); + } + else + { + interpolatedPomFile = pomFile; + } + } + return interpolatedPomFile; + } + + /** + * Runs the specified project. + * + * @param projectsDir The base directory of all projects, must not be null. + * @param buildJob The build job to run, must not be null. + * @param settingsFile The (already interpolated) user settings file for the build, may be null to use + * the current user settings. + * @param globalInvokerProperties + * @throws org.apache.maven.plugin.MojoExecutionException If the project could not be launched. + */ + private void runBuild( File projectsDir, BuildJob buildJob, File settingsFile, File actualJavaHome, + CharSequence actualJreVersion, Properties globalInvokerProperties ) + throws MojoExecutionException + { + // FIXME: Think about the following code part -- START + File pomFile = new File( projectsDir, buildJob.getProject() ); + File basedir; + if ( pomFile.isDirectory() ) + { + basedir = pomFile; + pomFile = new File( basedir, "pom.xml" ); + if ( !pomFile.exists() ) + { + pomFile = null; + } + else + { + buildJob.setProject( buildJob.getProject() + File.separator + "pom.xml" ); + } + } + else + { + basedir = pomFile.getParentFile(); + } + + File interpolatedPomFile = interpolatePomFile( pomFile, basedir ); + // FIXME: Think about the following code part -- ^^^^^^^ END + + getLog().info( buffer().a( "Building: " ).strong( buildJob.getProject() ).toString() ); + + InvokerProperties invokerProperties = getInvokerProperties( basedir, globalInvokerProperties ); + + // let's set what details we can + buildJob.setName( invokerProperties.getJobName() ); + buildJob.setDescription( invokerProperties.getJobDescription() ); + + try + { + int selection = getSelection( invokerProperties, actualJreVersion ); + if ( selection == 0 ) + { + long milliseconds = System.currentTimeMillis(); + boolean executed; + + FileLogger buildLogger = setupBuildLogFile( basedir ); + if ( buildLogger != null ) + { + buildJob.setBuildlog( buildLogger.getOutputFile().getAbsolutePath() ); + } + + try + { + executed = runBuild( basedir, interpolatedPomFile, settingsFile, actualJavaHome, + invokerProperties, buildLogger ); + } + finally + { + milliseconds = System.currentTimeMillis() - milliseconds; + buildJob.setTime( milliseconds / 1000.0 ); + + if ( buildLogger != null ) + { + buildLogger.close(); + } + } + + if ( executed ) + { + buildJob.setResult( BuildJob.Result.SUCCESS ); + + if ( !suppressSummaries ) + { + getLog().info( pad( buildJob ).success( "SUCCESS" ).a( ' ' ) + + formatTime( buildJob.getTime() ) ); + } + } + else + { + buildJob.setResult( BuildJob.Result.SKIPPED ); + + if ( !suppressSummaries ) + { + getLog().info( pad( buildJob ).warning( "SKIPPED" ).a( ' ' ) + + formatTime( buildJob.getTime() ) ); + } + } + } + else + { + buildJob.setResult( BuildJob.Result.SKIPPED ); + + StringBuilder message = new StringBuilder(); + if ( selection == Selector.SELECTOR_MULTI ) + { + message.append( "non-matching selectors" ); + } + else + { + if ( ( selection & Selector.SELECTOR_MAVENVERSION ) != 0 ) + { + message.append( "Maven version" ); + } + if ( ( selection & Selector.SELECTOR_JREVERSION ) != 0 ) + { + if ( message.length() > 0 ) + { + message.append( ", " ); + } + message.append( "JRE version" ); + } + if ( ( selection & Selector.SELECTOR_OSFAMILY ) != 0 ) + { + if ( message.length() > 0 ) + { + message.append( ", " ); + } + message.append( "OS" ); + } + if ( ( selection & Selector.SELECTOR_TOOLCHAIN ) != 0 ) + { + if ( message.length() > 0 ) + { + message.append( ", " ); + } + message.append( "Toolchain" ); + } + } + + if ( !suppressSummaries ) + { + getLog().info( pad( buildJob ).warning( "SKIPPED" ) + " due to " + message.toString() ); + } + + // Abuse failureMessage, the field in the report which should contain the reason for skipping + // Consider skipCode + I18N + buildJob.setFailureMessage( "Skipped due to " + message.toString() ); + } + } + catch ( RunErrorException e ) + { + buildJob.setResult( BuildJob.Result.ERROR ); + buildJob.setFailureMessage( e.getMessage() ); + + if ( !suppressSummaries ) + { + getLog().info( " " + e.getMessage() ); + getLog().info( pad( buildJob ).failure( "ERROR" ).a( ' ' ) + formatTime( buildJob.getTime() ) ); + } + } + catch ( RunFailureException e ) + { + buildJob.setResult( e.getType() ); + buildJob.setFailureMessage( e.getMessage() ); + + if ( !suppressSummaries ) + { + getLog().info( " " + e.getMessage() ); + getLog().info( pad( buildJob ).failure( "FAILED" ).a( ' ' ) + formatTime( buildJob.getTime() ) ); + } + } + finally + { + deleteInterpolatedPomFile( interpolatedPomFile ); + writeBuildReport( buildJob ); + } + } + + private MessageBuilder pad( BuildJob buildJob ) + { + MessageBuilder buffer = buffer( 128 ); + + buffer.a( " " ); + buffer.a( buildJob.getProject() ); + + int l = 10 + buildJob.getProject().length(); + + if ( l < RESULT_COLUMN ) + { + buffer.a( ' ' ); + l++; + + if ( l < RESULT_COLUMN ) + { + for ( int i = RESULT_COLUMN - l; i > 0; i-- ) + { + buffer.a( '.' ); + } + } + } + + return buffer.a( ' ' ); + } + + /** + * Delete the interpolated pom file if it has been created before. + * + * @param interpolatedPomFile The interpolated pom file. + */ + private void deleteInterpolatedPomFile( File interpolatedPomFile ) + { + if ( interpolatedPomFile != null && StringUtils.isNotEmpty( filteredPomPrefix ) ) + { + interpolatedPomFile.delete(); + } + } + + /** + * Determines whether selector conditions of the specified invoker properties match the current environment. + * + * @param invokerProperties The invoker properties to check, must not be null. + * @return 0 if the job corresponding to the properties should be run, otherwise a bitwise value + * representing the reason why it should be skipped. + */ + private int getSelection( InvokerProperties invokerProperties, CharSequence actualJreVersion ) + { + return new Selector( actualMavenVersion, actualJreVersion.toString(), + getToolchainPrivateManager() ).getSelection( invokerProperties ); + } + + private ToolchainPrivateManager getToolchainPrivateManager() + { + return new ToolchainPrivateManager( toolchainManagerPrivate, session ); + } + + /** + * Writes the XML report for the specified build job unless report generation has been disabled. + * + * @param buildJob The build job whose report should be written, must not be null. + * @throws org.apache.maven.plugin.MojoExecutionException If the report could not be written. + */ + private void writeBuildReport( BuildJob buildJob ) + throws MojoExecutionException + { + if ( disableReports ) + { + return; + } + + String safeFileName = buildJob.getProject().replace( '/', '_' ).replace( '\\', '_' ).replace( ' ', '_' ); + if ( safeFileName.endsWith( "_pom.xml" ) ) + { + safeFileName = safeFileName.substring( 0, safeFileName.length() - "_pom.xml".length() ); + } + + File reportFile = new File( reportsDirectory, "BUILD-" + safeFileName + ".xml" ); + try ( FileOutputStream fos = new FileOutputStream( reportFile ); + Writer osw = new OutputStreamWriter( fos, buildJob.getModelEncoding() ) ) + { + BuildJobXpp3Writer writer = new BuildJobXpp3Writer(); + + writer.write( osw, buildJob ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to write build report " + reportFile, e ); + } + + if ( writeJunitReport ) + { + writeJunitReport( buildJob, safeFileName ); + } + } + + private void writeJunitReport( BuildJob buildJob, String safeFileName ) + throws MojoExecutionException + { + File reportFile = new File( reportsDirectory, "TEST-" + safeFileName + ".xml" ); + Xpp3Dom testsuite = new Xpp3Dom( "testsuite" ); + testsuite.setAttribute( "name", junitPackageName + "." + safeFileName ); + testsuite.setAttribute( "time", Double.toString( buildJob.getTime() ) ); + + // set default value for required attributes + testsuite.setAttribute( "tests", "1" ); + testsuite.setAttribute( "errors", "0" ); + testsuite.setAttribute( "skipped", "0" ); + testsuite.setAttribute( "failures", "0" ); + + Xpp3Dom testcase = new Xpp3Dom( "testcase" ); + testsuite.addChild( testcase ); + switch ( buildJob.getResult() ) + { + case BuildJob.Result.SUCCESS: + break; + case BuildJob.Result.SKIPPED: + testsuite.setAttribute( "skipped", "1" ); + // adding the failure element + Xpp3Dom skipped = new Xpp3Dom( "skipped" ); + testcase.addChild( skipped ); + skipped.setValue( buildJob.getFailureMessage() ); + break; + case BuildJob.Result.ERROR: + testsuite.setAttribute( "errors", "1" ); + break; + default: + testsuite.setAttribute( "failures", "1" ); + // adding the failure element + Xpp3Dom failure = new Xpp3Dom( "failure" ); + testcase.addChild( failure ); + failure.setAttribute( "message", buildJob.getFailureMessage() ); + } + testcase.setAttribute( "classname", junitPackageName + "." + safeFileName ); + testcase.setAttribute( "name", safeFileName ); + testcase.setAttribute( "time", Double.toString( buildJob.getTime() ) ); + Xpp3Dom systemOut = new Xpp3Dom( "system-out" ); + testcase.addChild( systemOut ); + + + File buildLogFile = buildJob.getBuildlog() != null ? new File( buildJob.getBuildlog() ) : null; + + if ( buildLogFile != null && buildLogFile.exists() ) + { + getLog().debug( "fileLogger:" + buildLogFile ); + try + { + systemOut.setValue( FileUtils.fileRead( buildLogFile ) ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to read logfile " + buildLogFile, e ); + } + } + else + { + getLog().debug( safeFileName + "not exists buildLogFile = " + buildLogFile ); + } + + try ( FileOutputStream fos = new FileOutputStream( reportFile ); + Writer osw = new OutputStreamWriter( fos, buildJob.getModelEncoding() ) ) + { + Xpp3DomWriter.write( osw, testsuite ); + } catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to write JUnit build report " + reportFile, e ); + } + } + + /** + * Formats the specified build duration time. + * + * @param seconds The duration of the build. + * @return The formatted time, never null. + */ + private String formatTime( double seconds ) + { + return secFormat.format( seconds ); + } + + /** + * Runs the specified project. + * + * @param basedir The base directory of the project, must not be null. + * @param pomFile The (already interpolated) POM file, may be null for a POM-less Maven invocation. + * @param settingsFile The (already interpolated) user settings file for the build, may be null. Will + * be merged with the settings file of the invoking Maven process. + * @param invokerProperties The properties to use. + * @param logger file logger to write execution build.log + * @return true if the project was launched or false if the selector script indicated that + * the project should be skipped. + * @throws org.apache.maven.plugin.MojoExecutionException If the project could not be launched. + * @throws org.apache.maven.shared.scriptinterpreter.RunFailureException If either a hook script or the build itself + * failed. + */ + private boolean runBuild( File basedir, File pomFile, File settingsFile, File actualJavaHome, + InvokerProperties invokerProperties, FileLogger logger ) + throws MojoExecutionException, RunFailureException + { + if ( getLog().isDebugEnabled() && !invokerProperties.getProperties().isEmpty() ) + { + Properties props = invokerProperties.getProperties(); + getLog().debug( "Using invoker properties:" ); + for ( String key : new TreeSet( props.stringPropertyNames() ) ) + { + String value = props.getProperty( key ); + getLog().debug( " " + key + " = " + value ); + } + } + + List goals = getGoals( basedir ); + + List profiles = getProfiles( basedir ); + + Map context = new LinkedHashMap<>(); + + boolean selectorResult = true; + + try + { + try + { + scriptRunner.run( "selector script", basedir, selectorScript, context, logger, BuildJob.Result.SKIPPED, + false ); + } + catch ( RunErrorException e ) + { + selectorResult = false; + throw e; + } + catch ( RunFailureException e ) + { + selectorResult = false; + return false; + } + + scriptRunner.run( "pre-build script", basedir, preBuildHookScript, context, logger, + BuildJob.Result.FAILURE_PRE_HOOK, false ); + + final InvocationRequest request = new DefaultInvocationRequest(); + + request.setLocalRepositoryDirectory( localRepositoryPath ); + + request.setBatchMode( true ); + + request.setShowErrors( showErrors ); + + request.setDebug( debug ); + + request.setShowVersion( showVersion ); + + setupLoggerForBuildJob( logger, request ); + + if ( mavenHome != null ) + { + invoker.setMavenHome( mavenHome ); + // FIXME: Should we really take care of M2_HOME? + request.addShellEnvironment( "M2_HOME", mavenHome.getAbsolutePath() ); + } + + if ( mavenExecutable != null ) + { + invoker.setMavenExecutable( new File( mavenExecutable ) ); + } + + if ( actualJavaHome != null ) + { + request.setJavaHome( actualJavaHome ); + } + + if ( environmentVariables != null ) + { + for ( Map.Entry variable : environmentVariables.entrySet() ) + { + request.addShellEnvironment( variable.getKey(), variable.getValue() ); + } + } + + for ( int invocationIndex = 1;; invocationIndex++ ) + { + if ( invocationIndex > 1 && !invokerProperties.isInvocationDefined( invocationIndex ) ) + { + break; + } + + request.setBaseDirectory( basedir ); + + request.setPomFile( pomFile ); + + request.setGoals( goals ); + + request.setProfiles( profiles ); + + request.setMavenOpts( mavenOpts ); + + request.setOffline( false ); + + int timeOut = invokerProperties.getTimeoutInSeconds( invocationIndex ); + // not set so we use the one at the mojo level + request.setTimeoutInSeconds( timeOut < 0 ? timeoutInSeconds : timeOut ); + + String customSettingsFile = invokerProperties.getSettingsFile( invocationIndex ); + if ( customSettingsFile != null ) + { + File interpolateSettingsFile = interpolateSettings( new File( customSettingsFile ) ); + File mergeSettingsFile = mergeSettings( interpolateSettingsFile ); + + request.setUserSettingsFile( mergeSettingsFile ); + } + else + { + request.setUserSettingsFile( settingsFile ); + } + + Properties systemProperties = + getSystemProperties( basedir, invokerProperties.getSystemPropertiesFile( invocationIndex ) ); + request.setProperties( systemProperties ); + + invokerProperties.configureInvocation( request, invocationIndex ); + + if ( getLog().isDebugEnabled() ) + { + try + { + getLog().debug( "Using MAVEN_OPTS: " + request.getMavenOpts() ); + getLog().debug( "Executing: " + new MavenCommandLineBuilder().build( request ) ); + } + catch ( CommandLineConfigurationException e ) + { + getLog().debug( "Failed to display command line: " + e.getMessage() ); + } + } + + try + { + InvocationResult result = invoker.execute( request ); + verify( result, invocationIndex, invokerProperties, logger ); + } + catch ( final MavenInvocationException e ) + { + getLog().debug( "Error invoking Maven: " + e.getMessage(), e ); + throw new RunFailureException( "Maven invocation failed. " + e.getMessage(), + BuildJob.Result.FAILURE_BUILD ); + } + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + finally + { + if ( selectorResult ) + { + runPostBuildHook( basedir, context, logger ); + } + } + return true; + } + + int getParallelThreadsCount() + { + if ( parallelThreads.endsWith( "C" ) ) + { + double parallelThreadsMultiple = Double.parseDouble( + parallelThreads.substring( 0, parallelThreads.length() - 1 ) ); + return (int) ( parallelThreadsMultiple * Runtime.getRuntime().availableProcessors() ); + } + else + { + return Integer.parseInt( parallelThreads ); + } + } + + private void runPostBuildHook( File basedir, Map context, FileLogger logger ) + throws MojoExecutionException, RunFailureException + { + try + { + scriptRunner.run( "post-build script", basedir, postBuildHookScript, context, logger, + BuildJob.Result.FAILURE_POST_HOOK, true ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + } + private void setupLoggerForBuildJob( FileLogger logger, final InvocationRequest request ) + { + if ( logger != null ) + { + request.setErrorHandler( logger ); + + request.setOutputHandler( logger ); + } + } + + /** + * Initializes the build logger for the specified project. This will write the logging information into + * {@code build.log}. + * + * @param basedir The base directory of the project, must not be null. + * @return The build logger or null if logging has been disabled. + * @throws org.apache.maven.plugin.MojoExecutionException If the log file could not be created. + */ + private FileLogger setupBuildLogFile( File basedir ) + throws MojoExecutionException + { + FileLogger logger = null; + + if ( !noLog ) + { + Path projectLogDirectory; + if ( logDirectory == null ) + { + projectLogDirectory = basedir.toPath(); + } + else if ( cloneProjectsTo != null ) + { + projectLogDirectory = + logDirectory.toPath().resolve( cloneProjectsTo.toPath().relativize( basedir.toPath() ) ); + } + else + { + projectLogDirectory = + logDirectory.toPath().resolve( projectsDirectory.toPath().relativize( basedir.toPath() ) ); + } + + try + { + if ( streamLogs ) + { + logger = new FileLogger( projectLogDirectory.resolve( "build.log" ).toFile(), getLog() ); + } + else + { + logger = new FileLogger( projectLogDirectory.resolve( "build.log" ).toFile() ); + } + + getLog().debug( "Build log initialized in: " + projectLogDirectory ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error initializing build logfile in: " + projectLogDirectory, e ); + } + } + + return logger; + } + + /** + * Gets the system properties to use for the specified project. + * + * @param basedir The base directory of the project, must not be null. + * @param filename The filename to the properties file to load, may be null to use the default path + * given by {@link #testPropertiesFile}. + * @return The system properties to use, may be empty but never null. + * @throws org.apache.maven.plugin.MojoExecutionException If the properties file exists but could not be read. + */ + private Properties getSystemProperties( final File basedir, final String filename ) + throws MojoExecutionException + { + Properties collectedTestProperties = new Properties(); + + if ( properties != null ) + { + // MINVOKER-118: property can have empty value, which is not accepted by collectedTestProperties + for ( Map.Entry entry : properties.entrySet() ) + { + if ( entry.getValue() != null ) + { + collectedTestProperties.put( entry.getKey(), entry.getValue() ); + } + } + } + + File propertiesFile = null; + if ( filename != null ) + { + propertiesFile = new File( basedir, filename ); + } + else if ( testPropertiesFile != null ) + { + propertiesFile = new File( basedir, testPropertiesFile ); + } + + if ( propertiesFile != null && propertiesFile.isFile() ) + { + + try ( InputStream fin = new FileInputStream( propertiesFile ) ) + { + Properties loadedProperties = new Properties(); + loadedProperties.load( fin ); + collectedTestProperties.putAll( loadedProperties ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error reading system properties from " + propertiesFile ); + } + } + + return collectedTestProperties; + } + + /** + * Verifies the invocation result. + * + * @param result The invocation result to check, must not be null. + * @param invocationIndex The index of the invocation for which to check the exit code, must not be negative. + * @param invokerProperties The invoker properties used to check the exit code, must not be null. + * @param logger The build logger, may be null if logging is disabled. + * @throws org.apache.maven.shared.scriptinterpreter.RunFailureException If the invocation result indicates a build + * failure. + */ + private void verify( InvocationResult result, int invocationIndex, InvokerProperties invokerProperties, + FileLogger logger ) + throws RunFailureException + { + if ( result.getExecutionException() != null ) + { + throw new RunFailureException( "The Maven invocation failed. " + + result.getExecutionException().getMessage(), BuildJob.Result.ERROR ); + } + else if ( !invokerProperties.isExpectedResult( result.getExitCode(), invocationIndex ) ) + { + StringBuilder buffer = new StringBuilder( 256 ); + buffer.append( "The build exited with code " ).append( result.getExitCode() ).append( ". " ); + if ( logger != null ) + { + buffer.append( "See " ); + buffer.append( logger.getOutputFile().getAbsolutePath() ); + buffer.append( " for details." ); + } + else + { + buffer.append( "See console output for details." ); + } + throw new RunFailureException( buffer.toString(), BuildJob.Result.FAILURE_BUILD ); + } + } + + /** + * Gets the goal list for the specified project. + * + * @param basedir The base directory of the project, must not be null. + * @return The list of goals to run when building the project, may be empty but never null. + * @throws org.apache.maven.plugin.MojoExecutionException If the profile file could not be read. + */ + List getGoals( final File basedir ) + throws MojoExecutionException + { + try + { + // FIXME: Currently we have null for goalsFile which has been removed. + // This might mean we can remove getGoals() at all ? Check this. + return getTokens( basedir, null, goals ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "error reading goals", e ); + } + } + + /** + * Gets the profile list for the specified project. + * + * @param basedir The base directory of the project, must not be null. + * @return The list of profiles to activate when building the project, may be empty but never null. + * @throws org.apache.maven.plugin.MojoExecutionException If the profile file could not be read. + */ + List getProfiles( File basedir ) + throws MojoExecutionException + { + try + { + return getTokens( basedir, null, profiles ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "error reading profiles", e ); + } + } + + private List calculateExcludes() + throws IOException + { + List excludes = + ( pomExcludes != null ) ? new ArrayList<>( pomExcludes ) : new ArrayList(); + if ( this.settingsFile != null ) + { + String exclude = relativizePath( this.settingsFile, projectsDirectory.getCanonicalPath() ); + if ( exclude != null ) + { + excludes.add( exclude.replace( '\\', '/' ) ); + getLog().debug( "Automatically excluded " + exclude + " from project scanning" ); + } + } + return excludes; + + } + + /** + * @return The list of setupUp jobs. + * @throws IOException + * @see {@link #setupIncludes} + */ + private List getSetupBuildJobsFromFolders() + throws IOException, MojoExecutionException + { + List excludes = calculateExcludes(); + + List setupPoms = scanProjectsDirectory( setupIncludes, excludes, BuildJob.Type.SETUP ); + if ( getLog().isDebugEnabled() ) + { + getLog().debug( "Setup projects: " + setupPoms ); + } + + return setupPoms; + } + + private static class OrdinalComparator implements Comparator + { + private static final OrdinalComparator INSTANCE = new OrdinalComparator(); + + @Override + public int compare( Object o1, Object o2 ) + { + return Integer.compare( ( ( BuildJob ) o2 ).getOrdinal(), ( ( BuildJob ) o1 ).getOrdinal() ); + } + } + + /** + * Gets the build jobs that should be processed. Note that the order of the returned build jobs is significant. + * + * @return The build jobs to process, may be empty but never null. + * @throws java.io.IOException If the projects directory could not be scanned. + */ + List getBuildJobs() + throws IOException, MojoExecutionException + { + List buildJobs; + + if ( invokerTest == null ) + { + List excludes = calculateExcludes(); + + List setupPoms = scanProjectsDirectory( setupIncludes, excludes, BuildJob.Type.SETUP ); + if ( getLog().isDebugEnabled() ) + { + getLog().debug( "Setup projects: " + Arrays.asList( setupPoms ) ); + } + + List normalPoms = scanProjectsDirectory( pomIncludes, excludes, BuildJob.Type.NORMAL ); + + Map uniquePoms = new LinkedHashMap<>(); + for ( BuildJob setupPom : setupPoms ) + { + uniquePoms.put( setupPom.getProject(), setupPom ); + } + for ( BuildJob normalPom : normalPoms ) + { + if ( !uniquePoms.containsKey( normalPom.getProject() ) ) + { + uniquePoms.put( normalPom.getProject(), normalPom ); + } + } + + buildJobs = new ArrayList<>( uniquePoms.values() ); + } + else + { + String[] testRegexes = StringUtils.split( invokerTest, "," ); + List includes = new ArrayList<>( testRegexes.length ); + List excludes = new ArrayList<>(); + + for ( String regex : testRegexes ) + { + // user just use -Dinvoker.test=MWAR191,MNG111 to use a directory thats the end is not pom.xml + if ( regex.startsWith( "!" ) ) + { + excludes.add( regex.substring( 1 ) ); + } + else + { + includes.add( regex ); + } + } + + // it would be nice if we could figure out what types these are... but perhaps + // not necessary for the -Dinvoker.test=xxx t + buildJobs = scanProjectsDirectory( includes, excludes, BuildJob.Type.DIRECT ); + } + + relativizeProjectPaths( buildJobs ); + + return buildJobs; + } + + /** + * Scans the projects directory for projects to build. Both (POM) files and mere directories will be matched by the + * scanner patterns. If the patterns match a directory which contains a file named "pom.xml", the results will + * include the path to this file rather than the directory path in order to avoid duplicate invocations of the same + * project. + * + * @param includes The include patterns for the scanner, may be null. + * @param excludes The exclude patterns for the scanner, may be null to exclude nothing. + * @param type The type to assign to the resulting build jobs, must not be null. + * @return The build jobs matching the patterns, never null. + * @throws java.io.IOException If the project directory could not be scanned. + */ + private List scanProjectsDirectory( List includes, List excludes, String type ) + throws IOException, MojoExecutionException + { + if ( !projectsDirectory.isDirectory() ) + { + return Collections.emptyList(); + } + + DirectoryScanner scanner = new DirectoryScanner(); + scanner.setBasedir( projectsDirectory.getCanonicalFile() ); + scanner.setFollowSymlinks( false ); + if ( includes != null ) + { + scanner.setIncludes( includes.toArray( new String[includes.size()] ) ); + } + if ( excludes != null ) + { + scanner.setExcludes( excludes.toArray( new String[excludes.size()] ) ); + } + scanner.addDefaultExcludes(); + scanner.scan(); + + Map matches = new LinkedHashMap<>(); + + for ( String includedFile : scanner.getIncludedFiles() ) + { + matches.put( includedFile, new BuildJob( includedFile, type ) ); + } + + for ( String includedDir : scanner.getIncludedDirectories() ) + { + String includedFile = includedDir + File.separatorChar + "pom.xml"; + if ( new File( scanner.getBasedir(), includedFile ).isFile() ) + { + matches.put( includedFile, new BuildJob( includedFile, type ) ); + } + else + { + matches.put( includedDir, new BuildJob( includedDir, type ) ); + } + } + + List projects = new ArrayList<>( matches.size() ); + + // setup ordinal values to have an order here + for ( BuildJob buildJob : matches.values() ) + { + InvokerProperties invokerProperties = + getInvokerProperties( new File( projectsDirectory, buildJob.getProject() ).getParentFile(), + null ); + buildJob.setOrdinal( invokerProperties.getOrdinal() ); + projects.add( buildJob ); + } + Collections.sort( projects, OrdinalComparator.INSTANCE ); + return projects; + } + + /** + * Relativizes the project paths of the specified build jobs against the directory specified by + * {@link #projectsDirectory} (if possible). If a project path does not denote a sub path of the projects directory, + * it is returned as is. + * + * @param buildJobs The build jobs whose project paths should be relativized, must not be null nor + * contain null elements. + * @throws java.io.IOException If any path could not be relativized. + */ + private void relativizeProjectPaths( List buildJobs ) + throws IOException + { + String projectsDirPath = projectsDirectory.getCanonicalPath(); + + for ( BuildJob buildJob : buildJobs ) + { + String projectPath = buildJob.getProject(); + + File file = new File( projectPath ); + + if ( !file.isAbsolute() ) + { + file = new File( projectsDirectory, projectPath ); + } + + String relativizedPath = relativizePath( file, projectsDirPath ); + + if ( relativizedPath == null ) + { + relativizedPath = projectPath; + } + + buildJob.setProject( relativizedPath ); + } + } + + /** + * Relativizes the specified path against the given base directory. Besides relativization, the returned path will + * also be normalized, e.g. directory references like ".." will be removed. + * + * @param path The path to relativize, must not be null. + * @param basedir The (canonical path of the) base directory to relativize against, must not be null. + * @return The relative path in normal form or null if the input path does not denote a sub path of the + * base directory. + * @throws java.io.IOException If the path could not be relativized. + */ + private String relativizePath( File path, String basedir ) + throws IOException + { + String relativizedPath = path.getCanonicalPath(); + + if ( relativizedPath.startsWith( basedir ) ) + { + relativizedPath = relativizedPath.substring( basedir.length() ); + if ( relativizedPath.startsWith( File.separator ) ) + { + relativizedPath = relativizedPath.substring( File.separator.length() ); + } + + return relativizedPath; + } + else + { + return null; + } + } + + /** + * Returns the map-based value source used to interpolate POMs and other stuff. + * + * @param escapeXml {@code true}, to escape any XML special characters in the property values; {@code false}, to not + * escape any property values. + * + * @return The map-based value source for interpolation, never null. + */ +/** + * Returns the map-based value source used to interpolate POMs and other stuff. + * + * @param escapeXml + * {@code true}, to escape any XML special characters in the property values; {@code false}, to not + * escape any property values. + * @return The map-based value source for interpolation, never null. + */ +private java.util.Map getInterpolationValueSource(final boolean escapeXml) { + java.util.Map props = new java.util.HashMap<>(); + { + props.putAll(/* NPEX_NULL_EXP */ + filterProperties); + } + props.put("basedir", this.project.getBasedir().getAbsolutePath()); + props.put("baseurl", org.apache.maven.plugins.invoker.AbstractInvokerMojo.toUrl(this.project.getBasedir().getAbsolutePath())); + if (settings.getLocalRepository() != null) { + props.put("localRepository", settings.getLocalRepository()); + props.put("localRepositoryUrl", org.apache.maven.plugins.invoker.AbstractInvokerMojo.toUrl(settings.getLocalRepository())); + } + return new org.apache.maven.plugins.invoker.CompositeMap(this.project, props, escapeXml); +} + + /** + * Converts the specified filesystem path to a URL. The resulting URL has no trailing slash regardless whether the + * path denotes a file or a directory. + * + * @param filename The filesystem path to convert, must not be null. + * @return The file: URL for the specified path, never null. + */ + private static String toUrl( String filename ) + { + /* + * NOTE: Maven fails to properly handle percent-encoded "file:" URLs (WAGON-111) so don't use File.toURI() here + * as-is but use the decoded path component in the URL. + */ + String url = "file://" + new File( filename ).toURI().getPath(); + if ( url.endsWith( "/" ) ) + { + url = url.substring( 0, url.length() - 1 ); + } + return url; + } + + /** + * Gets goal/profile names for the specified project, either directly from the plugin configuration or from an + * external token file. + * + * @param basedir The base directory of the test project, must not be null. + * @param filename The (simple) name of an optional file in the project base directory from which to read + * goals/profiles, may be null. + * @param defaultTokens The list of tokens to return in case the specified token file does not exist, may be + * null. + * @return The list of goal/profile names, may be empty but never null. + * @throws java.io.IOException If the token file exists but could not be parsed. + */ + private List getTokens( File basedir, String filename, List defaultTokens ) + throws IOException + { + List tokens = ( defaultTokens != null ) ? defaultTokens : new ArrayList(); + + if ( StringUtils.isNotEmpty( filename ) ) + { + File tokenFile = new File( basedir, filename ); + + if ( tokenFile.exists() ) + { + tokens = readTokens( tokenFile ); + } + } + + return tokens; + } + + /** + * Reads the tokens from the specified file. Tokens are separated either by line terminators or commas. During + * parsing, the file contents will be interpolated. + * + * @param tokenFile The file to read the tokens from, must not be null. + * @return The list of tokens, may be empty but never null. + * @throws java.io.IOException If the token file could not be read. + */ + private List readTokens( final File tokenFile ) + throws IOException + { + List result = new ArrayList<>(); + + Map composite = getInterpolationValueSource( false ); + + try ( BufferedReader reader = + new BufferedReader( new InterpolationFilterReader( newReader( tokenFile ), composite ) ) ) + { + for ( String line = reader.readLine(); line != null; line = reader.readLine() ) + { + result.addAll( collectListFromCSV( line ) ); + } + } + + return result; + } + + /** + * Gets a list of comma separated tokens from the specified line. + * + * @param csv The line with comma separated tokens, may be null. + * @return The list of tokens from the line, may be empty but never null. + */ + private List collectListFromCSV( final String csv ) + { + final List result = new ArrayList<>(); + + if ( ( csv != null ) && ( csv.trim().length() > 0 ) ) + { + final StringTokenizer st = new StringTokenizer( csv, "," ); + + while ( st.hasMoreTokens() ) + { + result.add( st.nextToken().trim() ); + } + } + + return result; + } + + /** + * Interpolates the specified POM/settings file to a temporary file. The destination file may be same as the input + * file, i.e. interpolation can be performed in-place. + *

    + * Note:This methods expects the file to be a XML file and applies special XML escaping during interpolation. + *

    + * + * @param originalFile The XML file to interpolate, must not be null. + * @param interpolatedFile The target file to write the interpolated contents of the original file to, must not be + * null. + * + * @throws org.apache.maven.plugin.MojoExecutionException If the target file could not be created. + */ + void buildInterpolatedFile( File originalFile, File interpolatedFile ) + throws MojoExecutionException + { + getLog().debug( "Interpolate " + originalFile.getPath() + " to " + interpolatedFile.getPath() ); + + try + { + String xml; + + Map composite = getInterpolationValueSource( true ); + + // interpolation with token @...@ + try ( Reader reader = + new InterpolationFilterReader( ReaderFactory.newXmlReader( originalFile ), composite, "@", "@" ) ) + { + xml = IOUtil.toString( reader ); + } + + try ( Writer writer = WriterFactory.newXmlWriter( interpolatedFile ) ) + { + interpolatedFile.getParentFile().mkdirs(); + + writer.write( xml ); + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to interpolate file " + originalFile.getPath(), e ); + } + } + + /** + * Gets the (interpolated) invoker properties for an integration test. + * + * @param projectDirectory The base directory of the IT project, must not be null. + * @return The invoker properties, may be empty but never null. + * @throws org.apache.maven.plugin.MojoExecutionException If an I/O error occurred during reading the properties. + */ + private InvokerProperties getInvokerProperties( final File projectDirectory, Properties globalInvokerProperties ) + throws MojoExecutionException + { + Properties props; + if ( globalInvokerProperties != null ) + { + props = new Properties( globalInvokerProperties ); + } + else + { + props = new Properties(); + } + + File propertiesFile = new File( projectDirectory, invokerPropertiesFile ); + if ( propertiesFile.isFile() ) + { + try ( InputStream in = new FileInputStream( propertiesFile ) ) + { + props.load( in ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to read invoker properties: " + propertiesFile, e ); + } + } + + Interpolator interpolator = new RegexBasedInterpolator(); + interpolator.addValueSource( new MapBasedValueSource( getInterpolationValueSource( false ) ) ); + // CHECKSTYLE_OFF: LineLength + for ( String key : props.stringPropertyNames() ) + { + String value = props.getProperty( key ); + try + { + value = interpolator.interpolate( value, "" ); + } + catch ( InterpolationException e ) + { + throw new MojoExecutionException( "Failed to interpolate invoker properties: " + propertiesFile, + e ); + } + props.setProperty( key, value ); + } + return new InvokerProperties( props ); + } + + static class ToolchainPrivateManager + { + private ToolchainManagerPrivate manager; + + private MavenSession session; + + ToolchainPrivateManager( ToolchainManagerPrivate manager, MavenSession session ) + { + this.manager = manager; + this.session = session; + } + + ToolchainPrivate[] getToolchainPrivates( String type ) throws MisconfiguredToolchainException + { + return manager.getToolchainsForType( type, session ); + } + } +} diff --git a/Java/maven-invoker-plugin-AbstractInvokerMojo_2646/metadata.json b/Java/maven-invoker-plugin-AbstractInvokerMojo_2646/metadata.json new file mode 100644 index 000000000..96ce533b5 --- /dev/null +++ b/Java/maven-invoker-plugin-AbstractInvokerMojo_2646/metadata.json @@ -0,0 +1,21 @@ +{ + "language": "java", + "id": "maven-invoker-plugin-AbstractInvokerMojo_2646", + "buggyPath": ".", + "referencePath": null, + "buildCommand": "mvn package -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100 -DskipTests=true -DskipITs=true -Dtest=None -DfailIfNoTests=false", + "testCommand": "mvn test -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100", + "categories": [ + "safety", + "npe" + ], + "npe": { + "filepath": "src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java", + "line": 2654, + "npe_method": "getInterpolationValueSource", + "deref_field": "filterProperties", + "npe_class": "AbstractInvokerMojo", + "repo": "maven-invoker-plugin", + "bug_id": "AbstractInvokerMojo_2646" + } +} diff --git a/Java/maven-invoker-plugin-AbstractInvokerMojo_2646/npe.json b/Java/maven-invoker-plugin-AbstractInvokerMojo_2646/npe.json new file mode 100644 index 000000000..600981c3a --- /dev/null +++ b/Java/maven-invoker-plugin-AbstractInvokerMojo_2646/npe.json @@ -0,0 +1,7 @@ +{ + "filepath": "src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java", + "line": 2654, + "npe_method": "getInterpolationValueSource", + "deref_field": "filterProperties", + "npe_class": "AbstractInvokerMojo" +} \ No newline at end of file diff --git a/Java/maven-invoker-plugin-AbstractInvokerMojo_2652/Dockerfile b/Java/maven-invoker-plugin-AbstractInvokerMojo_2652/Dockerfile new file mode 100644 index 000000000..b3ce32683 --- /dev/null +++ b/Java/maven-invoker-plugin-AbstractInvokerMojo_2652/Dockerfile @@ -0,0 +1,18 @@ +FROM ghcr.io/kupl/starlab-benchmarks/java-base:maven-invoker-plugin + +ENV TZ=Asia/Seoul + +COPY ./metadata.json . +COPY ./npe.json . +COPY ./buggy.java /tmp/buggy.java +RUN export BUGGY_PATH=$(cat metadata.json | jq -r ".npe.filepath") \ + && export BUGGY_LINE=$(cat metadata.json | jq -r ".npe.line") \ + && export BUGGY_MTHD=$(cat metadata.json | jq -r ".npe.npe_method") \ + && mv /tmp/buggy.java $BUGGY_PATH \ + && echo "[{\"filepath\": \"$BUGGY_PATH\", \"line\": $BUGGY_LINE, \"method_name\": \"$BUGGY_MTHD\"}]" | jq . > traces.json + +RUN git init . && git add -A + +RUN $(cat metadata.json | jq -r ".buildCommand") + +RUN $(cat metadata.json | jq -r ".testCommand"); if [ $? -eq 0 ]; then exit 1; fi diff --git a/Java/maven-invoker-plugin-AbstractInvokerMojo_2652/buggy.java b/Java/maven-invoker-plugin-AbstractInvokerMojo_2652/buggy.java new file mode 100644 index 000000000..33cccbdf8 --- /dev/null +++ b/Java/maven-invoker-plugin-AbstractInvokerMojo_2652/buggy.java @@ -0,0 +1,2880 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.Model; +import org.apache.maven.model.Profile; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecution; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.invoker.model.BuildJob; +import org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Writer; +import org.apache.maven.project.MavenProject; +import org.apache.maven.settings.Settings; +import org.apache.maven.settings.SettingsUtils; +import org.apache.maven.settings.TrackableBase; +import org.apache.maven.settings.building.DefaultSettingsBuildingRequest; +import org.apache.maven.settings.building.SettingsBuilder; +import org.apache.maven.settings.building.SettingsBuildingException; +import org.apache.maven.settings.building.SettingsBuildingRequest; +import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer; +import org.apache.maven.shared.invoker.CommandLineConfigurationException; +import org.apache.maven.shared.invoker.DefaultInvocationRequest; +import org.apache.maven.shared.invoker.InvocationRequest; +import org.apache.maven.shared.invoker.InvocationResult; +import org.apache.maven.shared.invoker.Invoker; +import org.apache.maven.shared.invoker.MavenCommandLineBuilder; +import org.apache.maven.shared.invoker.MavenInvocationException; +import org.apache.maven.shared.scriptinterpreter.RunErrorException; +import org.apache.maven.shared.scriptinterpreter.RunFailureException; +import org.apache.maven.shared.scriptinterpreter.ScriptRunner; +import org.apache.maven.shared.utils.logging.MessageBuilder; +import org.apache.maven.toolchain.MisconfiguredToolchainException; +import org.apache.maven.toolchain.ToolchainManagerPrivate; +import org.apache.maven.toolchain.ToolchainPrivate; +import org.codehaus.plexus.interpolation.InterpolationException; +import org.codehaus.plexus.interpolation.Interpolator; +import org.codehaus.plexus.interpolation.MapBasedValueSource; +import org.codehaus.plexus.interpolation.RegexBasedInterpolator; +import org.codehaus.plexus.util.DirectoryScanner; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.IOUtil; +import org.codehaus.plexus.util.InterpolationFilterReader; +import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.ReflectionUtils; +import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.WriterFactory; +import org.codehaus.plexus.util.cli.CommandLineException; +import org.codehaus.plexus.util.cli.CommandLineUtils; +import org.codehaus.plexus.util.cli.Commandline; +import org.codehaus.plexus.util.cli.StreamConsumer; +import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.codehaus.plexus.util.xml.Xpp3DomWriter; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.Writer; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.TreeSet; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +import static org.apache.maven.shared.utils.logging.MessageUtils.buffer; + +/** + * Provides common code for mojos invoking sub builds. + * + * @author Stephen Connolly + * @since 15-Aug-2009 09:09:29 + */ +public abstract class AbstractInvokerMojo + extends AbstractMojo +{ + /** + * The zero-based column index where to print the invoker result. + */ + private static final int RESULT_COLUMN = 60; + + /** + * Flag used to suppress certain invocations. This is useful in tailoring the build using profiles. + * + * @since 1.1 + */ + @Parameter( property = "invoker.skip", defaultValue = "false" ) + private boolean skipInvocation; + + /** + * Flag used to suppress the summary output notifying of successes and failures. If set to true, the + * only indication of the build's success or failure will be the effect it has on the main build (if it fails, the + * main build should fail as well). If {@link #streamLogs} is enabled, the sub-build summary will also provide an + * indication. + */ + @Parameter( defaultValue = "false" ) + protected boolean suppressSummaries; + + /** + * Flag used to determine whether the build logs should be output to the normal mojo log. + */ + @Parameter( property = "invoker.streamLogs", defaultValue = "false" ) + private boolean streamLogs; + + /** + * The local repository for caching artifacts. It is strongly recommended to specify a path to an isolated + * repository like ${project.build.directory}/it-repo. Otherwise, your ordinary local repository will + * be used, potentially soiling it with broken artifacts. + */ + @Parameter( property = "invoker.localRepositoryPath", defaultValue = "${settings.localRepository}" ) + private File localRepositoryPath; + + /** + * Directory to search for integration tests. + */ + @Parameter( property = "invoker.projectsDirectory", defaultValue = "${basedir}/src/it/" ) + private File projectsDirectory; + + /** + * Base directory where all build reports are written to. Every execution of an integration test will produce an XML + * file which contains the information about success or failure of that particular build job. The format of the + * resulting XML file is documented in the given build-job reference. + * + * @since 1.4 + */ + @Parameter( property = "invoker.reportsDirectory", defaultValue = "${project.build.directory}/invoker-reports" ) + private File reportsDirectory; + + /** + * A flag to disable the generation of build reports. + * + * @since 1.4 + */ + @Parameter( property = "invoker.disableReports", defaultValue = "false" ) + private boolean disableReports; + + /** + * Directory to which projects should be cloned prior to execution. If set to {@code null}, each integration test + * will be run in the directory in which the corresponding IT POM was found. In this case, you most likely want to + * configure your SCM to ignore target and build.log in the test's base directory. + * + * @since 1.1 + */ + @Parameter( property = "invoker.cloneProjectsTo" ) + private File cloneProjectsTo; + + // CHECKSTYLE_OFF: LineLength + /** + * Some files are normally excluded when copying the IT projects from the directory specified by the parameter + * projectsDirectory to the directory given by cloneProjectsTo (e.g. .svn, CVS, + * *~, etc: see + * reference for full list). Setting this parameter to true will cause all files to be copied to + * the cloneProjectsTo directory. + * + * @since 1.2 + */ + @Parameter( defaultValue = "false" ) + private boolean cloneAllFiles; + // CHECKSTYLE_ON: LineLength + + /** + * Ensure the {@link #cloneProjectsTo} directory is not polluted with files from earlier invoker runs. + * + * @since 1.6 + */ + @Parameter( defaultValue = "true" ) + private boolean cloneClean; + + /** + * A single POM to build, skipping any scanning parameters and behavior. + */ + @Parameter( property = "invoker.pom" ) + private File pom; + + /** + * Include patterns for searching the integration test directory for projects. This parameter is meant to be set + * from the POM. If this parameter is not set, the plugin will search for all pom.xml files one + * directory below {@link #projectsDirectory} (i.e. */pom.xml).
    + *
    + * Starting with version 1.3, mere directories can also be matched by these patterns. For example, the include + * pattern * will run Maven builds on all immediate sub directories of {@link #projectsDirectory}, + * regardless if they contain a pom.xml. This allows to perform builds that need/should not depend on + * the existence of a POM. + */ + @Parameter + private List pomIncludes = Collections.singletonList( "*/pom.xml" ); + + /** + * Exclude patterns for searching the integration test directory. This parameter is meant to be set from the POM. By + * default, no POM files are excluded. For the convenience of using an include pattern like *, the + * custom settings file specified by the parameter {@link #settingsFile} will always be excluded automatically. + */ + @Parameter + private List pomExcludes = Collections.emptyList(); + + /** + * Include patterns for searching the projects directory for projects that need to be run before the other projects. + * This parameter allows to declare projects that perform setup tasks like installing utility artifacts into the + * local repository. Projects matched by these patterns are implicitly excluded from the scan for ordinary projects. + * Also, the exclusions defined by the parameter {@link #pomExcludes} apply to the setup projects, too. Default + * value is: setup*/pom.xml. + * + * @since 1.3 + */ + @Parameter + private List setupIncludes = Collections.singletonList( "setup*/pom.xml" ); + + /** + * The list of goals to execute on each project. Default value is: package. + */ + @Parameter + private List goals = Collections.singletonList( "package" ); + + /** + */ + @Component + private Invoker invoker; + + @Component + private SettingsBuilder settingsBuilder; + + @Component + private ToolchainManagerPrivate toolchainManagerPrivate; + + /** + * Relative path of a selector script to run prior in order to decide if the build should be executed. This script + * may be written with either BeanShell or Groovy. If the file extension is omitted (e.g. selector), + * the plugin searches for the file by trying out the well-known extensions .bsh and + * .groovy. If this script exists for a particular project but returns any non-null value different + * from true, the corresponding build is flagged as skipped. In this case, none of the pre-build hook + * script, Maven nor the post-build hook script will be invoked. If this script throws an exception, the + * corresponding build is flagged as in error, and none of the pre-build hook script, Maven not the post-build hook + * script will be invoked. + * + * @since 1.5 + */ + @Parameter( property = "invoker.selectorScript", defaultValue = "selector" ) + private String selectorScript; + + /** + * Relative path of a pre-build hook script to run prior to executing the build. This script may be written with + * either BeanShell or Groovy (since 1.3). If the file extension is omitted (e.g. prebuild), the plugin + * searches for the file by trying out the well-known extensions .bsh and .groovy. If this + * script exists for a particular project but returns any non-null value different from true or throws + * an exception, the corresponding build is flagged as a failure. In this case, neither Maven nor the post-build + * hook script will be invoked. + */ + @Parameter( property = "invoker.preBuildHookScript", defaultValue = "prebuild" ) + private String preBuildHookScript; + + /** + * Relative path of a cleanup/verification hook script to run after executing the build. This script may be written + * with either BeanShell or Groovy (since 1.3). If the file extension is omitted (e.g. verify), the + * plugin searches for the file by trying out the well-known extensions .bsh and .groovy. + * If this script exists for a particular project but returns any non-null value different from true or + * throws an exception, the corresponding build is flagged as a failure. + */ + @Parameter( property = "invoker.postBuildHookScript", defaultValue = "postbuild" ) + private String postBuildHookScript; + + /** + * Location of a properties file that defines CLI properties for the test. + */ + @Parameter( property = "invoker.testPropertiesFile", defaultValue = "test.properties" ) + private String testPropertiesFile; + + /** + * Common set of properties to pass in on each project's command line, via -D parameters. + * + * @since 1.1 + */ + @Parameter + private Map properties; + + /** + * Whether to show errors in the build output. + */ + @Parameter( property = "invoker.showErrors", defaultValue = "false" ) + private boolean showErrors; + + /** + * Whether to show debug statements in the build output. + */ + @Parameter( property = "invoker.debug", defaultValue = "false" ) + private boolean debug; + + /** + * Suppress logging to the build.log file. + */ + @Parameter( property = "invoker.noLog", defaultValue = "false" ) + private boolean noLog; + + /** + * By default a {@code build.log} is created in the root of the project. By setting this folder + * files are written to a different folder, respecting the structure of the projectsDirectory. + * + * @since 3.2.0 + */ + @Parameter + private File logDirectory; + + /** + * List of profile identifiers to explicitly trigger in the build. + * + * @since 1.1 + */ + @Parameter + private List profiles; + + /** + * A list of additional properties which will be used to filter tokens in POMs and goal files. + * + * @since 1.3 + */ + @Parameter + private Map filterProperties; + + /** + * The Maven Project Object + * + * @since 1.1 + */ + @Parameter( defaultValue = "${project}", readonly = true, required = true ) + private MavenProject project; + + @Parameter( defaultValue = "${session}", readonly = true, required = true ) + private MavenSession session; + + @Parameter( defaultValue = "${mojoExecution}", readonly = true, required = true ) + private MojoExecution mojoExecution; + + /** + * A comma separated list of projectname patterns to run. Specify this parameter to run individual tests by file + * name, overriding the {@link #setupIncludes}, {@link #pomIncludes} and {@link #pomExcludes} parameters. Each + * pattern you specify here will be used to create an include/exclude pattern formatted like + * ${projectsDirectory}/pattern. To exclude a test, prefix the pattern with a '!'. + * So you can just type -Dinvoker.test=SimpleTest,Comp*Test,!Compare* to run builds in + * ${projectsDirectory}/SimpleTest and ${projectsDirectory}/ComplexTest, but not + * ${projectsDirectory}/CompareTest + * + * @since 1.1 (exclusion since 1.8) + */ + @Parameter( property = "invoker.test" ) + private String invokerTest; + + /** + * Path to an alternate settings.xml to use for Maven invocation with all ITs. Note that the + * <localRepository> element of this settings file is always ignored, i.e. the path given by the + * parameter {@link #localRepositoryPath} is dominant. + * + * @since 1.2 + */ + @Parameter( property = "invoker.settingsFile" ) + private File settingsFile; + + /** + * The MAVEN_OPTS environment variable to use when invoking Maven. This value can be overridden for + * individual integration tests by using {@link #invokerPropertiesFile}. + * + * @since 1.2 + */ + @Parameter( property = "invoker.mavenOpts" ) + private String mavenOpts; + + /** + * The home directory of the Maven installation to use for the forked builds. Defaults to the current Maven + * installation. + * + * @since 1.3 + */ + @Parameter( property = "invoker.mavenHome" ) + private File mavenHome; + + /** + * mavenExecutable can either be a file relative to ${maven.home}/bin/ or an absolute file. + * + * @since 1.8 + * @see Invoker#setMavenExecutable(File) + */ + @Parameter( property = "invoker.mavenExecutable" ) + private String mavenExecutable; + + /** + * The JAVA_HOME environment variable to use for forked Maven invocations. Defaults to the current Java + * home directory. + * + * @since 1.3 + */ + @Parameter( property = "invoker.javaHome" ) + private File javaHome; + + /** + * The file encoding for the pre-/post-build scripts and the list files for goals and profiles. + * + * @since 1.2 + */ + @Parameter( property = "encoding", defaultValue = "${project.build.sourceEncoding}" ) + private String encoding; + + /** + * The current user system settings for use in Maven. + * + * @since 1.2 + */ + @Parameter( defaultValue = "${settings}", readonly = true, required = true ) + private Settings settings; + + /** + * A flag whether the test class path of the project under test should be included in the class path of the + * pre-/post-build scripts. If set to false, the class path of script interpreter consists only of the + * runtime dependencies of the Maven Invoker Plugin. If set the true, + * the project's test class path will be prepended to the interpreter class path. Among others, this feature allows + * the scripts to access utility classes from the test sources of your project. + * + * @since 1.2 + */ + @Parameter( property = "invoker.addTestClassPath", defaultValue = "false" ) + private boolean addTestClassPath; + + /** + * The test class path of the project under test. + */ + @Parameter( defaultValue = "${project.testClasspathElements}", readonly = true ) + private List testClassPath; + + /** + * The name of an optional project-specific file that contains properties used to specify settings for an individual + * Maven invocation. Any property present in the file will override the corresponding setting from the plugin + * configuration. The values of the properties are filtered and may use expressions like + * ${project.version} to reference project properties or values from the parameter + * {@link #filterProperties}.

    + * + *

    + * As of 3.2.0 it is possible to put this folder in any of the ancestor folders, where properties will be inherited. + * This way you can provide a single properties file for a group of projects + *

    + * + * The snippet below describes the supported properties: + *
    +     * # A comma or space separated list of goals/phases to execute, may
    +     * # specify an empty list to execute the default goal of the IT project.
    +     * # Environment variables used by maven plugins can be added here
    +     * invoker.goals = clean install -Dplugin.variable=value
    +     *
    +     * # Or you can give things like this if you need.
    +     * invoker.goals = -T2 clean verify
    +     *
    +     * # Optionally, a list of goals to run during further invocations of Maven
    +     * invoker.goals.2 = ${project.groupId}:${project.artifactId}:${project.version}:run
    +     *
    +     * # A comma or space separated list of profiles to activate
    +     * invoker.profiles = its,jdk15
    +     *
    +     * # The path to an alternative POM or base directory to invoke Maven on, defaults to the
    +     * # project that was originally specified in the plugin configuration
    +     * # Since plugin version 1.4
    +     * invoker.project = sub-module
    +     *
    +     * # The value for the environment variable MAVEN_OPTS
    +     * invoker.mavenOpts = -Dfile.encoding=UTF-16 -Xms32m -Xmx256m
    +     *
    +     * # Possible values are "fail-fast" (default), "fail-at-end" and "fail-never"
    +     * invoker.failureBehavior = fail-never
    +     *
    +     * # The expected result of the build, possible values are "success" (default) and "failure"
    +     * invoker.buildResult = failure
    +     *
    +     * # A boolean value controlling the aggregator mode of Maven, defaults to "false"
    +     * invoker.nonRecursive = true
    +     *
    +     * # A boolean value controlling the network behavior of Maven, defaults to "false"
    +     * # Since plugin version 1.4
    +     * invoker.offline = true
    +     *
    +     * # The path to the properties file from which to load system properties, defaults to the
    +     * # filename given by the plugin parameter testPropertiesFile
    +     * # Since plugin version 1.4
    +     * invoker.systemPropertiesFile = test.properties
    +     *
    +     * # An optional human friendly name for this build job to be included in the build reports.
    +     * # Since plugin version 1.4
    +     * invoker.name = Test Build 01
    +     *
    +     * # An optional description for this build job to be included in the build reports.
    +     * # Since plugin version 1.4
    +     * invoker.description = Checks the support for build reports.
    +     *
    +     * # A comma separated list of JRE versions on which this build job should be run.
    +     * # Since plugin version 1.4
    +     * invoker.java.version = 1.4+, !1.4.1, 1.7-
    +     * 
    +     * # A comma separated list of OS families on which this build job should be run.
    +     * # Since plugin version 1.4
    +     * invoker.os.family = !windows, unix, mac
    +     *
    +     * # A comma separated list of Maven versions on which this build should be run.
    +     * # Since plugin version 1.5
    +     * invoker.maven.version = 2.0.10+, !2.1.0, !2.2.0
    +     * 
    +     * # A mapping for toolchain to ensure it exists
    +     * # Since plugin version 3.2.0
    +     * invoker.toolchain.<type>.<provides> = value
    +     * invoker.toolchain.jdk.version = 11
    +     * 
    +     * # For java.version, maven.version, os.family and toolchain it is possible to define multiple selectors.
    +     * # If one of the indexed selectors matches, the test is executed.
    +     * # With the invoker.x.y equivalents you can specify global matchers.  
    +     * selector.1.java.version = 1.8+
    +     * selector.1.maven.version = 3.2.5+
    +     * selector.1.os.family = !windows
    +     * selector.2.maven.version = 3.0+
    +     * selector.3.java.version = 9+
    +     * 
    +     * # A boolean value controlling the debug logging level of Maven, , defaults to "false"
    +     * # Since plugin version 1.8
    +     * invoker.debug = true
    +     * 
    +     * # Path to an alternate settings.xml to use for Maven invocation with this IT.
    +     * # Since plugin version 3.0.1
    +     * invoker.settingsFile = ../
    +     *
    +     * # An integer value to control run order of projects. sorted in the descending order of the ordinal.
    +     * # In other words, the BuildJobs with the highest numbers will be executed first
    +     * # Since plugin version 3.2.1
    +     * invoker.ordinal = 3
    +     * invoker.ordinal = 1
    +     *
    +     * # The additional value for the environment variable.
    +     * # Since plugin version 3.2.2
    +     * invoker.environmentVariables.<variableName> = variableValue
    +     * invoker.environmentVariables.MY_ENV_NAME = myEnvValue
    +     *
    +     * 
    + * + * @since 1.2 + */ + @Parameter( property = "invoker.invokerPropertiesFile", defaultValue = "invoker.properties" ) + private String invokerPropertiesFile; + + /** + * flag to enable show mvn version used for running its (cli option : -V,--show-version ) + * + * @since 1.4 + */ + @Parameter( property = "invoker.showVersion", defaultValue = "false" ) + private boolean showVersion; + + /** + *

    Number of threads for running tests in parallel. This will be the number of maven forked process in parallel. + * When terminated with "C", the number part is multiplied by the number of processors (cores) available + * to the Java virtual machine. Floating point value are only accepted together with "C".

    + * + *

    Example values: "1.5C", "4"

    + * + * @since 1.6 + */ + @Parameter( property = "invoker.parallelThreads", defaultValue = "1" ) + private String parallelThreads; + + /** + * @since 1.6 + */ + @Parameter( property = "plugin.artifacts", required = true, readonly = true ) + private List pluginArtifacts; + + /** + * If enable and if you have a settings file configured for the execution, it will be merged with your user + * settings. + * + * @since 1.6 + */ + @Parameter( property = "invoker.mergeUserSettings", defaultValue = "false" ) + private boolean mergeUserSettings; + + /** + * Additional environment variables to set on the command line. + * + * @since 1.8 + */ + @Parameter + private Map environmentVariables; + + /** + * Additional variables for use in the hook scripts. + * + * @since 1.9 + */ + @Parameter + private Map scriptVariables; + + /** + * + * @since 3.0.2 + */ + @Parameter( defaultValue = "0", property = "invoker.timeoutInSeconds" ) + private int timeoutInSeconds; + + /** + * Write test result in junit format. + * @since 3.1.2 + */ + @Parameter( defaultValue = "false", property = "invoker.writeJunitReport" ) + private boolean writeJunitReport; + + /** + * The package name use in junit report + * @since 3.1.2 + */ + @Parameter( defaultValue = "maven.invoker.it", property = "invoker.junitPackageName" ) + private String junitPackageName = "maven.invoker.it"; + + /** + * The scripter runner that is responsible to execute hook scripts. + */ + private ScriptRunner scriptRunner; + + /** + * A string used to prefix the file name of the filtered POMs in case the POMs couldn't be filtered in-place (i.e. + * the projects were not cloned to a temporary directory), can be null. This will be set to + * null if the POMs have already been filtered during cloning. + */ + private String filteredPomPrefix = "interpolated-"; + + /** + * The format for elapsed build time. + */ + private final DecimalFormat secFormat = new DecimalFormat( "(0.0 s)", new DecimalFormatSymbols( Locale.ENGLISH ) ); + + /** + * The version of Maven which is used to run the builds + */ + private String actualMavenVersion; + + /** + * Invokes Maven on the configured test projects. + * + * @throws org.apache.maven.plugin.MojoExecutionException If the goal encountered severe errors. + * @throws org.apache.maven.plugin.MojoFailureException If any of the Maven builds failed. + */ + public void execute() + throws MojoExecutionException, MojoFailureException + { + if ( skipInvocation ) + { + getLog().info( "Skipping invocation per configuration." + + " If this is incorrect, ensure the skipInvocation parameter is not set to true." ); + return; + } + + if ( StringUtils.isEmpty( encoding ) ) + { + getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING + + ", i.e. build is platform dependent!" ); + } + + // done it here to prevent issues with concurrent access in case of parallel run + if ( !disableReports ) + { + setupReportsFolder(); + } + + List buildJobs; + if ( pom == null ) + { + try + { + buildJobs = getBuildJobs(); + } + catch ( final IOException e ) + { + throw new MojoExecutionException( "Error retrieving POM list from includes, " + + "excludes, and projects directory. Reason: " + e.getMessage(), e ); + } + } + else + { + try + { + projectsDirectory = pom.getCanonicalFile().getParentFile(); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to discover projectsDirectory from " + + "pom File parameter. Reason: " + e.getMessage(), e ); + } + + buildJobs = Collections.singletonList( new BuildJob( pom.getName(), BuildJob.Type.NORMAL ) ); + } + + if ( buildJobs.isEmpty() ) + { + doFailIfNoProjects(); + + getLog().info( "No projects were selected for execution." ); + return; + } + + handleScriptRunnerWithScriptClassPath(); + + Collection collectedProjects = new LinkedHashSet<>(); + for ( BuildJob buildJob : buildJobs ) + { + collectProjects( projectsDirectory, buildJob.getProject(), collectedProjects, true ); + } + + File projectsDir = projectsDirectory; + + if ( cloneProjectsTo != null ) + { + cloneProjects( collectedProjects ); + projectsDir = cloneProjectsTo; + } + else if ( cloneProjectsTo == null && "maven-plugin".equals( project.getPackaging() ) ) + { + cloneProjectsTo = new File( project.getBuild().getDirectory(), "its" ); + cloneProjects( collectedProjects ); + projectsDir = cloneProjectsTo; + } + else + { + getLog().warn( "Filtering of parent/child POMs is not supported without cloning the projects" ); + } + + // First run setup jobs. + List setupBuildJobs = null; + try + { + setupBuildJobs = getSetupBuildJobsFromFolders(); + } + catch ( IOException e ) + { + getLog().error( "Failure during scanning of folders.", e ); + // TODO: Check shouldn't we fail in case of problems? + } + + if ( !setupBuildJobs.isEmpty() ) + { + // Run setup jobs in single thread + // mode. + // + // Some Idea about ordering? + getLog().info( "Running " + setupBuildJobs.size() + " setup job" + + ( ( setupBuildJobs.size() < 2 ) ? "" : "s" ) + ":" ); + runBuilds( projectsDir, setupBuildJobs, 1 ); + getLog().info( "Setup done." ); + } + + // Afterwards run all other jobs. + List nonSetupBuildJobs = getNonSetupJobs( buildJobs ); + // We will run the non setup jobs with the configured + // parallelThreads number. + runBuilds( projectsDir, nonSetupBuildJobs, getParallelThreadsCount() ); + + writeSummaryFile( nonSetupBuildJobs ); + + processResults( new InvokerSession( nonSetupBuildJobs ) ); + + } + + /** + * This will create the necessary folders for the reports. + * + * @throws MojoExecutionException in case of failure during creation of the reports folder. + */ + private void setupReportsFolder() + throws MojoExecutionException + { + // If it exists from previous run... + if ( reportsDirectory.exists() ) + { + try + { + FileUtils.deleteDirectory( reportsDirectory ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failure while trying to delete " + + reportsDirectory.getAbsolutePath(), e ); + } + } + if ( !reportsDirectory.mkdirs() ) + { + throw new MojoExecutionException( "Failure while creating the " + reportsDirectory.getAbsolutePath() ); + } + } + + private List getNonSetupJobs( List buildJobs ) + { + List result = new LinkedList<>(); + for ( BuildJob buildJob : buildJobs ) + { + if ( !buildJob.getType().equals( BuildJob.Type.SETUP ) ) + { + result.add( buildJob ); + } + } + return result; + } + + private void handleScriptRunnerWithScriptClassPath() + { + final List scriptClassPath; + if ( addTestClassPath ) + { + scriptClassPath = new ArrayList<>( testClassPath ); + for ( Artifact pluginArtifact : pluginArtifacts ) + { + scriptClassPath.remove( pluginArtifact.getFile().getAbsolutePath() ); + } + } + else + { + scriptClassPath = null; + } + scriptRunner = new ScriptRunner( getLog() ); + scriptRunner.setScriptEncoding( encoding ); + scriptRunner.setGlobalVariable( "localRepositoryPath", localRepositoryPath ); + if ( scriptVariables != null ) + { + for ( Entry entry : scriptVariables.entrySet() ) + { + scriptRunner.setGlobalVariable( entry.getKey(), entry.getValue() ); + } + } + scriptRunner.setClassPath( scriptClassPath ); + } + + private void writeSummaryFile( List buildJobs ) + throws MojoExecutionException + { + + File summaryReportFile = new File( reportsDirectory, "invoker-summary.txt" ); + + try ( Writer writer = new BufferedWriter( new FileWriter( summaryReportFile ) ) ) + { + for ( BuildJob buildJob : buildJobs ) + { + if ( !buildJob.getResult().equals( BuildJob.Result.SUCCESS ) ) + { + writer.append( buildJob.getResult() ); + writer.append( " [" ); + writer.append( buildJob.getProject() ); + writer.append( "] " ); + if ( buildJob.getFailureMessage() != null ) + { + writer.append( " " ); + writer.append( buildJob.getFailureMessage() ); + } + writer.append( "\n" ); + } + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to write summary report " + summaryReportFile, e ); + } + } + + protected void doFailIfNoProjects() + throws MojoFailureException + { + // should only be used during run and verify + } + + /** + * Processes the results of invoking the build jobs. + * + * @param invokerSession The session with the build jobs, must not be null. + * @throws MojoFailureException If the mojo had failed as a result of invoking the build jobs. + * @since 1.4 + */ + abstract void processResults( InvokerSession invokerSession ) + throws MojoFailureException; + + /** + * Creates a new reader for the specified file, using the plugin's {@link #encoding} parameter. + * + * @param file The file to create a reader for, must not be null. + * @return The reader for the file, never null. + * @throws java.io.IOException If the specified file was not found or the configured encoding is not supported. + */ + private Reader newReader( File file ) + throws IOException + { + if ( StringUtils.isNotEmpty( encoding ) ) + { + return ReaderFactory.newReader( file, encoding ); + } + else + { + return ReaderFactory.newPlatformReader( file ); + } + } + + /** + * Collects all projects locally reachable from the specified project. The method will as such try to read the POM + * and recursively follow its parent/module elements. + * + * @param projectsDir The base directory of all projects, must not be null. + * @param projectPath The relative path of the current project, can denote either the POM or its base directory, + * must not be null. + * @param projectPaths The set of already collected projects to add new projects to, must not be null. + * This set will hold the relative paths to either a POM file or a project base directory. + * @param included A flag indicating whether the specified project has been explicitly included via the parameter + * {@link #pomIncludes}. Such projects will always be added to the result set even if there is no + * corresponding POM. + * @throws org.apache.maven.plugin.MojoExecutionException If the project tree could not be traversed. + */ + private void collectProjects( File projectsDir, String projectPath, Collection projectPaths, + boolean included ) + throws MojoExecutionException + { + projectPath = projectPath.replace( '\\', '/' ); + File pomFile = new File( projectsDir, projectPath ); + if ( pomFile.isDirectory() ) + { + pomFile = new File( pomFile, "pom.xml" ); + if ( !pomFile.exists() ) + { + if ( included ) + { + projectPaths.add( projectPath ); + } + return; + } + if ( !projectPath.endsWith( "/" ) ) + { + projectPath += '/'; + } + projectPath += "pom.xml"; + } + else if ( !pomFile.isFile() ) + { + return; + } + if ( !projectPaths.add( projectPath ) ) + { + return; + } + getLog().debug( "Collecting parent/child projects of " + projectPath ); + + Model model = PomUtils.loadPom( pomFile ); + + try + { + String projectsRoot = projectsDir.getCanonicalPath(); + String projectDir = pomFile.getParent(); + + String parentPath = "../pom.xml"; + if ( model.getParent() != null && StringUtils.isNotEmpty( model.getParent().getRelativePath() ) ) + { + parentPath = model.getParent().getRelativePath(); + } + String parent = relativizePath( new File( projectDir, parentPath ), projectsRoot ); + if ( parent != null ) + { + collectProjects( projectsDir, parent, projectPaths, false ); + } + + Collection modulePaths = new LinkedHashSet<>(); + + modulePaths.addAll( model.getModules() ); + + for ( Profile profile : model.getProfiles() ) + { + modulePaths.addAll( profile.getModules() ); + } + + for ( String modulePath : modulePaths ) + { + String module = relativizePath( new File( projectDir, modulePath ), projectsRoot ); + if ( module != null ) + { + collectProjects( projectsDir, module, projectPaths, false ); + } + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to analyze POM: " + pomFile, e ); + } + } + + /** + * Copies the specified projects to the directory given by {@link #cloneProjectsTo}. A project may either be denoted + * by a path to a POM file or merely by a path to a base directory. During cloning, the POM files will be filtered. + * + * @param projectPaths The paths to the projects to clone, relative to the projects directory, must not be + * null nor contain null elements. + * @throws org.apache.maven.plugin.MojoExecutionException If the the projects could not be copied/filtered. + */ + private void cloneProjects( Collection projectPaths ) + throws MojoExecutionException + { + if ( !cloneProjectsTo.mkdirs() && cloneClean ) + { + try + { + FileUtils.cleanDirectory( cloneProjectsTo ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Could not clean the cloneProjectsTo directory. Reason: " + + e.getMessage(), e ); + } + } + + // determine project directories to clone + Collection dirs = new LinkedHashSet<>(); + for ( String projectPath : projectPaths ) + { + if ( !new File( projectsDirectory, projectPath ).isDirectory() ) + { + projectPath = getParentPath( projectPath ); + } + dirs.add( projectPath ); + } + + boolean filter; + + // clone project directories + try + { + filter = !cloneProjectsTo.getCanonicalFile().equals( projectsDirectory.getCanonicalFile() ); + + List clonedSubpaths = new ArrayList<>(); + + for ( String subpath : dirs ) + { + // skip this project if its parent directory is also scheduled for cloning + if ( !".".equals( subpath ) && dirs.contains( getParentPath( subpath ) ) ) + { + continue; + } + + // avoid copying subdirs that are already cloned. + if ( !alreadyCloned( subpath, clonedSubpaths ) ) + { + // avoid creating new files that point to dir/. + if ( ".".equals( subpath ) ) + { + String cloneSubdir = relativizePath( cloneProjectsTo, projectsDirectory.getCanonicalPath() ); + + // avoid infinite recursion if the cloneTo path is a subdirectory. + if ( cloneSubdir != null ) + { + File temp = File.createTempFile( "pre-invocation-clone.", "" ); + temp.delete(); + temp.mkdirs(); + + copyDirectoryStructure( projectsDirectory, temp ); + + FileUtils.deleteDirectory( new File( temp, cloneSubdir ) ); + + copyDirectoryStructure( temp, cloneProjectsTo ); + } + else + { + copyDirectoryStructure( projectsDirectory, cloneProjectsTo ); + } + } + else + { + File srcDir = new File( projectsDirectory, subpath ); + File dstDir = new File( cloneProjectsTo, subpath ); + copyDirectoryStructure( srcDir, dstDir ); + } + + clonedSubpaths.add( subpath ); + } + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to clone projects from: " + projectsDirectory + " to: " + + cloneProjectsTo + ". Reason: " + e.getMessage(), e ); + } + + // filter cloned POMs + if ( filter ) + { + for ( String projectPath : projectPaths ) + { + File pomFile = new File( cloneProjectsTo, projectPath ); + if ( pomFile.isFile() ) + { + buildInterpolatedFile( pomFile, pomFile ); + } + + // MINVOKER-186 + // The following is a temporary solution to support Maven 3.3.1 (.mvn/extensions.xml) filtering + // Will be replaced by MINVOKER-117 with general filtering mechanism + File baseDir = pomFile.getParentFile(); + File mvnDir = new File( baseDir, ".mvn" ); + if ( mvnDir.isDirectory() ) + { + File extensionsFile = new File( mvnDir, "extensions.xml" ); + if ( extensionsFile.isFile() ) + { + buildInterpolatedFile( extensionsFile, extensionsFile ); + } + } + // END MINVOKER-186 + } + filteredPomPrefix = null; + } + } + + /** + * Gets the parent path of the specified relative path. + * + * @param path The relative path whose parent should be retrieved, must not be null. + * @return The parent path or "." if the specified path has no parent, never null. + */ + private String getParentPath( String path ) + { + int lastSep = Math.max( path.lastIndexOf( '/' ), path.lastIndexOf( '\\' ) ); + return ( lastSep < 0 ) ? "." : path.substring( 0, lastSep ); + } + + /** + * Copied a directory structure with default exclusions (.svn, CVS, etc) + * + * @param sourceDir The source directory to copy, must not be null. + * @param destDir The target directory to copy to, must not be null. + * @throws java.io.IOException If the directory structure could not be copied. + */ + private void copyDirectoryStructure( File sourceDir, File destDir ) + throws IOException + { + DirectoryScanner scanner = new DirectoryScanner(); + scanner.setBasedir( sourceDir ); + if ( !cloneAllFiles ) + { + scanner.addDefaultExcludes(); + } + scanner.scan(); + + /* + * NOTE: Make sure the destination directory is always there (even if empty) to support POM-less ITs. + */ + destDir.mkdirs(); + // Create all the directories, including any symlinks present in source + FileUtils.mkDirs( sourceDir, scanner.getIncludedDirectories(), destDir ); + + for ( String includedFile : scanner.getIncludedFiles() ) + { + File sourceFile = new File( sourceDir, includedFile ); + File destFile = new File( destDir, includedFile ); + FileUtils.copyFile( sourceFile, destFile ); + + // ensure clone project must be writable for additional changes + destFile.setWritable( true ); + } + } + + /** + * Determines whether the specified sub path has already been cloned, i.e. whether one of its ancestor directories + * was already cloned. + * + * @param subpath The sub path to check, must not be null. + * @param clonedSubpaths The list of already cloned paths, must not be null nor contain + * null elements. + * @return true if the specified path has already been cloned, false otherwise. + */ + static boolean alreadyCloned( String subpath, List clonedSubpaths ) + { + for ( String path : clonedSubpaths ) + { + if ( ".".equals( path ) || subpath.equals( path ) || subpath.startsWith( path + File.separator ) ) + { + return true; + } + } + + return false; + } + + /** + * Runs the specified build jobs. + * + * @param projectsDir The base directory of all projects, must not be null. + * @param buildJobs The build jobs to run must not be null nor contain null elements. + * @throws org.apache.maven.plugin.MojoExecutionException If any build could not be launched. + */ + private void runBuilds( final File projectsDir, List buildJobs, int runWithParallelThreads ) + throws MojoExecutionException + { + if ( !localRepositoryPath.exists() ) + { + localRepositoryPath.mkdirs(); + } + + // ----------------------------------------------- + // interpolate settings file + // ----------------------------------------------- + + File interpolatedSettingsFile = interpolateSettings( settingsFile ); + + final File mergedSettingsFile = mergeSettings( interpolatedSettingsFile ); + + if ( mavenHome != null ) + { + actualMavenVersion = SelectorUtils.getMavenVersion( mavenHome ); + } + else + { + actualMavenVersion = SelectorUtils.getMavenVersion(); + } + scriptRunner.setGlobalVariable( "mavenVersion", actualMavenVersion ); + + final CharSequence actualJreVersion; + // @todo if ( javaVersions ) ... to be picked up from toolchains + if ( javaHome != null ) + { + actualJreVersion = resolveExternalJreVersion(); + } + else + { + actualJreVersion = SelectorUtils.getJreVersion(); + } + + final Path projectsPath = this.projectsDirectory.toPath(); + + Set folderGroupSet = new HashSet<>(); + folderGroupSet.add( Paths.get( "." ) ); + for ( BuildJob buildJob : buildJobs ) + { + Path p = Paths.get( buildJob.getProject() ); + + if ( Files.isRegularFile( projectsPath.resolve( p ) ) ) + { + p = p.getParent(); + } + + if ( p != null ) + { + p = p.getParent(); + } + + while ( p != null && folderGroupSet.add( p ) ) + { + p = p.getParent(); + } + } + + List folderGroup = new ArrayList<>( folderGroupSet ); + Collections.sort( folderGroup ); + + final Map globalInvokerProperties = new HashMap<>(); + + for ( Path path : folderGroup ) + { + Properties ancestorProperties = globalInvokerProperties.get( projectsPath.resolve( path ).getParent() ); + + Path currentInvokerProperties = projectsPath.resolve( path ).resolve( invokerPropertiesFile ); + + Properties currentProperties; + if ( Files.isRegularFile( currentInvokerProperties ) ) + { + if ( ancestorProperties != null ) + { + currentProperties = new Properties( ancestorProperties ); + + } + else + { + currentProperties = new Properties(); + } + } + else + { + currentProperties = ancestorProperties; + } + + if ( Files.isRegularFile( currentInvokerProperties ) ) + { + try ( InputStream in = new FileInputStream( currentInvokerProperties.toFile() ) ) + { + currentProperties.load( in ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to read invoker properties: " + + currentInvokerProperties ); + } + } + + if ( currentProperties != null ) + { + globalInvokerProperties.put( projectsPath.resolve( path ).normalize(), currentProperties ); + } + } + + try + { + if ( runWithParallelThreads > 1 ) + { + getLog().info( "use parallelThreads " + runWithParallelThreads ); + + ExecutorService executorService = Executors.newFixedThreadPool( runWithParallelThreads ); + for ( final BuildJob job : buildJobs ) + { + executorService.execute( new Runnable() + { + public void run() + { + try + { + Path ancestorFolder = getAncestorFolder( projectsPath.resolve( job.getProject() ) ); + + runBuild( projectsDir, job, mergedSettingsFile, javaHome, actualJreVersion, + globalInvokerProperties.get( ancestorFolder ) ); + } + catch ( MojoExecutionException e ) + { + throw new RuntimeException( e.getMessage(), e ); + } + } + } ); + } + + try + { + executorService.shutdown(); + // TODO add a configurable time out + executorService.awaitTermination( Long.MAX_VALUE, TimeUnit.MILLISECONDS ); + } + catch ( InterruptedException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + } + else + { + for ( BuildJob job : buildJobs ) + { + Path ancestorFolder = getAncestorFolder( projectsPath.resolve( job.getProject() ) ); + + runBuild( projectsDir, job, mergedSettingsFile, javaHome, actualJreVersion, + globalInvokerProperties.get( ancestorFolder ) ); + } + } + } + finally + { + if ( interpolatedSettingsFile != null && cloneProjectsTo == null ) + { + interpolatedSettingsFile.delete(); + } + if ( mergedSettingsFile != null && mergedSettingsFile.exists() ) + { + mergedSettingsFile.delete(); + } + } + } + + private Path getAncestorFolder( Path p ) + { + Path ancestor = p; + if ( Files.isRegularFile( ancestor ) ) + { + ancestor = ancestor.getParent(); + } + if ( ancestor != null ) + { + ancestor = ancestor.getParent(); + } + return ancestor; + } + + /** + * Interpolate settings.xml file. + * @param settingsFile a settings file + * + * @return The interpolated settings.xml file. + * @throws MojoExecutionException in case of a problem. + */ + private File interpolateSettings( File settingsFile ) + throws MojoExecutionException + { + File interpolatedSettingsFile = null; + if ( settingsFile != null ) + { + if ( cloneProjectsTo != null ) + { + interpolatedSettingsFile = new File( cloneProjectsTo, "interpolated-" + settingsFile.getName() ); + } + else + { + interpolatedSettingsFile = + new File( settingsFile.getParentFile(), "interpolated-" + settingsFile.getName() ); + } + buildInterpolatedFile( settingsFile, interpolatedSettingsFile ); + } + return interpolatedSettingsFile; + } + + /** + * Merge the settings file + * + * @param interpolatedSettingsFile The interpolated settings file. + * @return The merged settings file. + * @throws MojoExecutionException Fail the build in case the merged settings file can't be created. + */ + private File mergeSettings( File interpolatedSettingsFile ) + throws MojoExecutionException + { + File mergedSettingsFile; + Settings mergedSettings = this.settings; + if ( mergeUserSettings ) + { + if ( interpolatedSettingsFile != null ) + { + // Have to merge the specified settings file (dominant) and the one of the invoking Maven process + try + { + SettingsBuildingRequest request = new DefaultSettingsBuildingRequest(); + request.setGlobalSettingsFile( interpolatedSettingsFile ); + + Settings dominantSettings = settingsBuilder.build( request ).getEffectiveSettings(); + Settings recessiveSettings = cloneSettings(); + SettingsUtils.merge( dominantSettings, recessiveSettings, TrackableBase.USER_LEVEL ); + + mergedSettings = dominantSettings; + getLog().debug( "Merged specified settings file with settings of invoking process" ); + } + catch ( SettingsBuildingException e ) + { + throw new MojoExecutionException( "Could not read specified settings file", e ); + } + } + } + + if ( this.settingsFile != null && !mergeUserSettings ) + { + mergedSettingsFile = interpolatedSettingsFile; + } + else + { + try + { + mergedSettingsFile = writeMergedSettingsFile( mergedSettings ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Could not create temporary file for invoker settings.xml", e ); + } + } + return mergedSettingsFile; + } + + private File writeMergedSettingsFile( Settings mergedSettings ) + throws IOException + { + File mergedSettingsFile; + mergedSettingsFile = File.createTempFile( "invoker-settings", ".xml" ); + + SettingsXpp3Writer settingsWriter = new SettingsXpp3Writer(); + + + try ( FileWriter fileWriter = new FileWriter( mergedSettingsFile ) ) + { + settingsWriter.write( fileWriter, mergedSettings ); + } + + if ( getLog().isDebugEnabled() ) + { + getLog().debug( "Created temporary file for invoker settings.xml: " + + mergedSettingsFile.getAbsolutePath() ); + } + return mergedSettingsFile; + } + + private Settings cloneSettings() + { + Settings recessiveSettings = SettingsUtils.copySettings( this.settings ); + + // MINVOKER-133: reset sourceLevelSet + resetSourceLevelSet( recessiveSettings ); + for ( org.apache.maven.settings.Mirror mirror : recessiveSettings.getMirrors() ) + { + resetSourceLevelSet( mirror ); + } + for ( org.apache.maven.settings.Server server : recessiveSettings.getServers() ) + { + resetSourceLevelSet( server ); + } + for ( org.apache.maven.settings.Proxy proxy : recessiveSettings.getProxies() ) + { + resetSourceLevelSet( proxy ); + } + for ( org.apache.maven.settings.Profile profile : recessiveSettings.getProfiles() ) + { + resetSourceLevelSet( profile ); + } + + return recessiveSettings; + } + + private void resetSourceLevelSet( org.apache.maven.settings.TrackableBase trackable ) + { + try + { + ReflectionUtils.setVariableValueInObject( trackable, "sourceLevelSet", Boolean.FALSE ); + getLog().debug( "sourceLevelSet: " + + ReflectionUtils.getValueIncludingSuperclasses( "sourceLevelSet", trackable ) ); + } + catch ( IllegalAccessException e ) + { + // noop + } + } + + private CharSequence resolveExternalJreVersion() + { + Artifact pluginArtifact = mojoExecution.getMojoDescriptor().getPluginDescriptor().getPluginArtifact(); + pluginArtifact.getFile(); + + Commandline commandLine = new Commandline(); + commandLine.setExecutable( new File( javaHome, "bin/java" ).getAbsolutePath() ); + commandLine.createArg().setValue( "-cp" ); + commandLine.createArg().setFile( pluginArtifact.getFile() ); + commandLine.createArg().setValue( SystemPropertyPrinter.class.getName() ); + commandLine.createArg().setValue( "java.version" ); + + final StringBuilder actualJreVersion = new StringBuilder(); + StreamConsumer consumer = new StreamConsumer() + { + public void consumeLine( String line ) + { + actualJreVersion.append( line ); + } + }; + try + { + CommandLineUtils.executeCommandLine( commandLine, consumer, null ); + } + catch ( CommandLineException e ) + { + getLog().warn( e.getMessage() ); + } + return actualJreVersion; + } + + /** + * Interpolate the pom file. + * + * @param pomFile The pom file. + * @param basedir The base directory. + * @return interpolated pom file location in case we have interpolated the pom file otherwise the original pom file + * will be returned. + * @throws MojoExecutionException + */ + private File interpolatePomFile( File pomFile, File basedir ) + throws MojoExecutionException + { + File interpolatedPomFile = null; + if ( pomFile != null ) + { + if ( StringUtils.isNotEmpty( filteredPomPrefix ) ) + { + interpolatedPomFile = new File( basedir, filteredPomPrefix + pomFile.getName() ); + buildInterpolatedFile( pomFile, interpolatedPomFile ); + } + else + { + interpolatedPomFile = pomFile; + } + } + return interpolatedPomFile; + } + + /** + * Runs the specified project. + * + * @param projectsDir The base directory of all projects, must not be null. + * @param buildJob The build job to run, must not be null. + * @param settingsFile The (already interpolated) user settings file for the build, may be null to use + * the current user settings. + * @param globalInvokerProperties + * @throws org.apache.maven.plugin.MojoExecutionException If the project could not be launched. + */ + private void runBuild( File projectsDir, BuildJob buildJob, File settingsFile, File actualJavaHome, + CharSequence actualJreVersion, Properties globalInvokerProperties ) + throws MojoExecutionException + { + // FIXME: Think about the following code part -- START + File pomFile = new File( projectsDir, buildJob.getProject() ); + File basedir; + if ( pomFile.isDirectory() ) + { + basedir = pomFile; + pomFile = new File( basedir, "pom.xml" ); + if ( !pomFile.exists() ) + { + pomFile = null; + } + else + { + buildJob.setProject( buildJob.getProject() + File.separator + "pom.xml" ); + } + } + else + { + basedir = pomFile.getParentFile(); + } + + File interpolatedPomFile = interpolatePomFile( pomFile, basedir ); + // FIXME: Think about the following code part -- ^^^^^^^ END + + getLog().info( buffer().a( "Building: " ).strong( buildJob.getProject() ).toString() ); + + InvokerProperties invokerProperties = getInvokerProperties( basedir, globalInvokerProperties ); + + // let's set what details we can + buildJob.setName( invokerProperties.getJobName() ); + buildJob.setDescription( invokerProperties.getJobDescription() ); + + try + { + int selection = getSelection( invokerProperties, actualJreVersion ); + if ( selection == 0 ) + { + long milliseconds = System.currentTimeMillis(); + boolean executed; + + FileLogger buildLogger = setupBuildLogFile( basedir ); + if ( buildLogger != null ) + { + buildJob.setBuildlog( buildLogger.getOutputFile().getAbsolutePath() ); + } + + try + { + executed = runBuild( basedir, interpolatedPomFile, settingsFile, actualJavaHome, + invokerProperties, buildLogger ); + } + finally + { + milliseconds = System.currentTimeMillis() - milliseconds; + buildJob.setTime( milliseconds / 1000.0 ); + + if ( buildLogger != null ) + { + buildLogger.close(); + } + } + + if ( executed ) + { + buildJob.setResult( BuildJob.Result.SUCCESS ); + + if ( !suppressSummaries ) + { + getLog().info( pad( buildJob ).success( "SUCCESS" ).a( ' ' ) + + formatTime( buildJob.getTime() ) ); + } + } + else + { + buildJob.setResult( BuildJob.Result.SKIPPED ); + + if ( !suppressSummaries ) + { + getLog().info( pad( buildJob ).warning( "SKIPPED" ).a( ' ' ) + + formatTime( buildJob.getTime() ) ); + } + } + } + else + { + buildJob.setResult( BuildJob.Result.SKIPPED ); + + StringBuilder message = new StringBuilder(); + if ( selection == Selector.SELECTOR_MULTI ) + { + message.append( "non-matching selectors" ); + } + else + { + if ( ( selection & Selector.SELECTOR_MAVENVERSION ) != 0 ) + { + message.append( "Maven version" ); + } + if ( ( selection & Selector.SELECTOR_JREVERSION ) != 0 ) + { + if ( message.length() > 0 ) + { + message.append( ", " ); + } + message.append( "JRE version" ); + } + if ( ( selection & Selector.SELECTOR_OSFAMILY ) != 0 ) + { + if ( message.length() > 0 ) + { + message.append( ", " ); + } + message.append( "OS" ); + } + if ( ( selection & Selector.SELECTOR_TOOLCHAIN ) != 0 ) + { + if ( message.length() > 0 ) + { + message.append( ", " ); + } + message.append( "Toolchain" ); + } + } + + if ( !suppressSummaries ) + { + getLog().info( pad( buildJob ).warning( "SKIPPED" ) + " due to " + message.toString() ); + } + + // Abuse failureMessage, the field in the report which should contain the reason for skipping + // Consider skipCode + I18N + buildJob.setFailureMessage( "Skipped due to " + message.toString() ); + } + } + catch ( RunErrorException e ) + { + buildJob.setResult( BuildJob.Result.ERROR ); + buildJob.setFailureMessage( e.getMessage() ); + + if ( !suppressSummaries ) + { + getLog().info( " " + e.getMessage() ); + getLog().info( pad( buildJob ).failure( "ERROR" ).a( ' ' ) + formatTime( buildJob.getTime() ) ); + } + } + catch ( RunFailureException e ) + { + buildJob.setResult( e.getType() ); + buildJob.setFailureMessage( e.getMessage() ); + + if ( !suppressSummaries ) + { + getLog().info( " " + e.getMessage() ); + getLog().info( pad( buildJob ).failure( "FAILED" ).a( ' ' ) + formatTime( buildJob.getTime() ) ); + } + } + finally + { + deleteInterpolatedPomFile( interpolatedPomFile ); + writeBuildReport( buildJob ); + } + } + + private MessageBuilder pad( BuildJob buildJob ) + { + MessageBuilder buffer = buffer( 128 ); + + buffer.a( " " ); + buffer.a( buildJob.getProject() ); + + int l = 10 + buildJob.getProject().length(); + + if ( l < RESULT_COLUMN ) + { + buffer.a( ' ' ); + l++; + + if ( l < RESULT_COLUMN ) + { + for ( int i = RESULT_COLUMN - l; i > 0; i-- ) + { + buffer.a( '.' ); + } + } + } + + return buffer.a( ' ' ); + } + + /** + * Delete the interpolated pom file if it has been created before. + * + * @param interpolatedPomFile The interpolated pom file. + */ + private void deleteInterpolatedPomFile( File interpolatedPomFile ) + { + if ( interpolatedPomFile != null && StringUtils.isNotEmpty( filteredPomPrefix ) ) + { + interpolatedPomFile.delete(); + } + } + + /** + * Determines whether selector conditions of the specified invoker properties match the current environment. + * + * @param invokerProperties The invoker properties to check, must not be null. + * @return 0 if the job corresponding to the properties should be run, otherwise a bitwise value + * representing the reason why it should be skipped. + */ + private int getSelection( InvokerProperties invokerProperties, CharSequence actualJreVersion ) + { + return new Selector( actualMavenVersion, actualJreVersion.toString(), + getToolchainPrivateManager() ).getSelection( invokerProperties ); + } + + private ToolchainPrivateManager getToolchainPrivateManager() + { + return new ToolchainPrivateManager( toolchainManagerPrivate, session ); + } + + /** + * Writes the XML report for the specified build job unless report generation has been disabled. + * + * @param buildJob The build job whose report should be written, must not be null. + * @throws org.apache.maven.plugin.MojoExecutionException If the report could not be written. + */ + private void writeBuildReport( BuildJob buildJob ) + throws MojoExecutionException + { + if ( disableReports ) + { + return; + } + + String safeFileName = buildJob.getProject().replace( '/', '_' ).replace( '\\', '_' ).replace( ' ', '_' ); + if ( safeFileName.endsWith( "_pom.xml" ) ) + { + safeFileName = safeFileName.substring( 0, safeFileName.length() - "_pom.xml".length() ); + } + + File reportFile = new File( reportsDirectory, "BUILD-" + safeFileName + ".xml" ); + try ( FileOutputStream fos = new FileOutputStream( reportFile ); + Writer osw = new OutputStreamWriter( fos, buildJob.getModelEncoding() ) ) + { + BuildJobXpp3Writer writer = new BuildJobXpp3Writer(); + + writer.write( osw, buildJob ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to write build report " + reportFile, e ); + } + + if ( writeJunitReport ) + { + writeJunitReport( buildJob, safeFileName ); + } + } + + private void writeJunitReport( BuildJob buildJob, String safeFileName ) + throws MojoExecutionException + { + File reportFile = new File( reportsDirectory, "TEST-" + safeFileName + ".xml" ); + Xpp3Dom testsuite = new Xpp3Dom( "testsuite" ); + testsuite.setAttribute( "name", junitPackageName + "." + safeFileName ); + testsuite.setAttribute( "time", Double.toString( buildJob.getTime() ) ); + + // set default value for required attributes + testsuite.setAttribute( "tests", "1" ); + testsuite.setAttribute( "errors", "0" ); + testsuite.setAttribute( "skipped", "0" ); + testsuite.setAttribute( "failures", "0" ); + + Xpp3Dom testcase = new Xpp3Dom( "testcase" ); + testsuite.addChild( testcase ); + switch ( buildJob.getResult() ) + { + case BuildJob.Result.SUCCESS: + break; + case BuildJob.Result.SKIPPED: + testsuite.setAttribute( "skipped", "1" ); + // adding the failure element + Xpp3Dom skipped = new Xpp3Dom( "skipped" ); + testcase.addChild( skipped ); + skipped.setValue( buildJob.getFailureMessage() ); + break; + case BuildJob.Result.ERROR: + testsuite.setAttribute( "errors", "1" ); + break; + default: + testsuite.setAttribute( "failures", "1" ); + // adding the failure element + Xpp3Dom failure = new Xpp3Dom( "failure" ); + testcase.addChild( failure ); + failure.setAttribute( "message", buildJob.getFailureMessage() ); + } + testcase.setAttribute( "classname", junitPackageName + "." + safeFileName ); + testcase.setAttribute( "name", safeFileName ); + testcase.setAttribute( "time", Double.toString( buildJob.getTime() ) ); + Xpp3Dom systemOut = new Xpp3Dom( "system-out" ); + testcase.addChild( systemOut ); + + + File buildLogFile = buildJob.getBuildlog() != null ? new File( buildJob.getBuildlog() ) : null; + + if ( buildLogFile != null && buildLogFile.exists() ) + { + getLog().debug( "fileLogger:" + buildLogFile ); + try + { + systemOut.setValue( FileUtils.fileRead( buildLogFile ) ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to read logfile " + buildLogFile, e ); + } + } + else + { + getLog().debug( safeFileName + "not exists buildLogFile = " + buildLogFile ); + } + + try ( FileOutputStream fos = new FileOutputStream( reportFile ); + Writer osw = new OutputStreamWriter( fos, buildJob.getModelEncoding() ) ) + { + Xpp3DomWriter.write( osw, testsuite ); + } catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to write JUnit build report " + reportFile, e ); + } + } + + /** + * Formats the specified build duration time. + * + * @param seconds The duration of the build. + * @return The formatted time, never null. + */ + private String formatTime( double seconds ) + { + return secFormat.format( seconds ); + } + + /** + * Runs the specified project. + * + * @param basedir The base directory of the project, must not be null. + * @param pomFile The (already interpolated) POM file, may be null for a POM-less Maven invocation. + * @param settingsFile The (already interpolated) user settings file for the build, may be null. Will + * be merged with the settings file of the invoking Maven process. + * @param invokerProperties The properties to use. + * @param logger file logger to write execution build.log + * @return true if the project was launched or false if the selector script indicated that + * the project should be skipped. + * @throws org.apache.maven.plugin.MojoExecutionException If the project could not be launched. + * @throws org.apache.maven.shared.scriptinterpreter.RunFailureException If either a hook script or the build itself + * failed. + */ + private boolean runBuild( File basedir, File pomFile, File settingsFile, File actualJavaHome, + InvokerProperties invokerProperties, FileLogger logger ) + throws MojoExecutionException, RunFailureException + { + if ( getLog().isDebugEnabled() && !invokerProperties.getProperties().isEmpty() ) + { + Properties props = invokerProperties.getProperties(); + getLog().debug( "Using invoker properties:" ); + for ( String key : new TreeSet( props.stringPropertyNames() ) ) + { + String value = props.getProperty( key ); + getLog().debug( " " + key + " = " + value ); + } + } + + List goals = getGoals( basedir ); + + List profiles = getProfiles( basedir ); + + Map context = new LinkedHashMap<>(); + + boolean selectorResult = true; + + try + { + try + { + scriptRunner.run( "selector script", basedir, selectorScript, context, logger, BuildJob.Result.SKIPPED, + false ); + } + catch ( RunErrorException e ) + { + selectorResult = false; + throw e; + } + catch ( RunFailureException e ) + { + selectorResult = false; + return false; + } + + scriptRunner.run( "pre-build script", basedir, preBuildHookScript, context, logger, + BuildJob.Result.FAILURE_PRE_HOOK, false ); + + final InvocationRequest request = new DefaultInvocationRequest(); + + request.setLocalRepositoryDirectory( localRepositoryPath ); + + request.setBatchMode( true ); + + request.setShowErrors( showErrors ); + + request.setDebug( debug ); + + request.setShowVersion( showVersion ); + + setupLoggerForBuildJob( logger, request ); + + if ( mavenHome != null ) + { + invoker.setMavenHome( mavenHome ); + // FIXME: Should we really take care of M2_HOME? + request.addShellEnvironment( "M2_HOME", mavenHome.getAbsolutePath() ); + } + + if ( mavenExecutable != null ) + { + invoker.setMavenExecutable( new File( mavenExecutable ) ); + } + + if ( actualJavaHome != null ) + { + request.setJavaHome( actualJavaHome ); + } + + if ( environmentVariables != null ) + { + for ( Map.Entry variable : environmentVariables.entrySet() ) + { + request.addShellEnvironment( variable.getKey(), variable.getValue() ); + } + } + + for ( int invocationIndex = 1;; invocationIndex++ ) + { + if ( invocationIndex > 1 && !invokerProperties.isInvocationDefined( invocationIndex ) ) + { + break; + } + + request.setBaseDirectory( basedir ); + + request.setPomFile( pomFile ); + + request.setGoals( goals ); + + request.setProfiles( profiles ); + + request.setMavenOpts( mavenOpts ); + + request.setOffline( false ); + + int timeOut = invokerProperties.getTimeoutInSeconds( invocationIndex ); + // not set so we use the one at the mojo level + request.setTimeoutInSeconds( timeOut < 0 ? timeoutInSeconds : timeOut ); + + String customSettingsFile = invokerProperties.getSettingsFile( invocationIndex ); + if ( customSettingsFile != null ) + { + File interpolateSettingsFile = interpolateSettings( new File( customSettingsFile ) ); + File mergeSettingsFile = mergeSettings( interpolateSettingsFile ); + + request.setUserSettingsFile( mergeSettingsFile ); + } + else + { + request.setUserSettingsFile( settingsFile ); + } + + Properties systemProperties = + getSystemProperties( basedir, invokerProperties.getSystemPropertiesFile( invocationIndex ) ); + request.setProperties( systemProperties ); + + invokerProperties.configureInvocation( request, invocationIndex ); + + if ( getLog().isDebugEnabled() ) + { + try + { + getLog().debug( "Using MAVEN_OPTS: " + request.getMavenOpts() ); + getLog().debug( "Executing: " + new MavenCommandLineBuilder().build( request ) ); + } + catch ( CommandLineConfigurationException e ) + { + getLog().debug( "Failed to display command line: " + e.getMessage() ); + } + } + + try + { + InvocationResult result = invoker.execute( request ); + verify( result, invocationIndex, invokerProperties, logger ); + } + catch ( final MavenInvocationException e ) + { + getLog().debug( "Error invoking Maven: " + e.getMessage(), e ); + throw new RunFailureException( "Maven invocation failed. " + e.getMessage(), + BuildJob.Result.FAILURE_BUILD ); + } + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + finally + { + if ( selectorResult ) + { + runPostBuildHook( basedir, context, logger ); + } + } + return true; + } + + int getParallelThreadsCount() + { + if ( parallelThreads.endsWith( "C" ) ) + { + double parallelThreadsMultiple = Double.parseDouble( + parallelThreads.substring( 0, parallelThreads.length() - 1 ) ); + return (int) ( parallelThreadsMultiple * Runtime.getRuntime().availableProcessors() ); + } + else + { + return Integer.parseInt( parallelThreads ); + } + } + + private void runPostBuildHook( File basedir, Map context, FileLogger logger ) + throws MojoExecutionException, RunFailureException + { + try + { + scriptRunner.run( "post-build script", basedir, postBuildHookScript, context, logger, + BuildJob.Result.FAILURE_POST_HOOK, true ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + } + private void setupLoggerForBuildJob( FileLogger logger, final InvocationRequest request ) + { + if ( logger != null ) + { + request.setErrorHandler( logger ); + + request.setOutputHandler( logger ); + } + } + + /** + * Initializes the build logger for the specified project. This will write the logging information into + * {@code build.log}. + * + * @param basedir The base directory of the project, must not be null. + * @return The build logger or null if logging has been disabled. + * @throws org.apache.maven.plugin.MojoExecutionException If the log file could not be created. + */ + private FileLogger setupBuildLogFile( File basedir ) + throws MojoExecutionException + { + FileLogger logger = null; + + if ( !noLog ) + { + Path projectLogDirectory; + if ( logDirectory == null ) + { + projectLogDirectory = basedir.toPath(); + } + else if ( cloneProjectsTo != null ) + { + projectLogDirectory = + logDirectory.toPath().resolve( cloneProjectsTo.toPath().relativize( basedir.toPath() ) ); + } + else + { + projectLogDirectory = + logDirectory.toPath().resolve( projectsDirectory.toPath().relativize( basedir.toPath() ) ); + } + + try + { + if ( streamLogs ) + { + logger = new FileLogger( projectLogDirectory.resolve( "build.log" ).toFile(), getLog() ); + } + else + { + logger = new FileLogger( projectLogDirectory.resolve( "build.log" ).toFile() ); + } + + getLog().debug( "Build log initialized in: " + projectLogDirectory ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error initializing build logfile in: " + projectLogDirectory, e ); + } + } + + return logger; + } + + /** + * Gets the system properties to use for the specified project. + * + * @param basedir The base directory of the project, must not be null. + * @param filename The filename to the properties file to load, may be null to use the default path + * given by {@link #testPropertiesFile}. + * @return The system properties to use, may be empty but never null. + * @throws org.apache.maven.plugin.MojoExecutionException If the properties file exists but could not be read. + */ + private Properties getSystemProperties( final File basedir, final String filename ) + throws MojoExecutionException + { + Properties collectedTestProperties = new Properties(); + + if ( properties != null ) + { + // MINVOKER-118: property can have empty value, which is not accepted by collectedTestProperties + for ( Map.Entry entry : properties.entrySet() ) + { + if ( entry.getValue() != null ) + { + collectedTestProperties.put( entry.getKey(), entry.getValue() ); + } + } + } + + File propertiesFile = null; + if ( filename != null ) + { + propertiesFile = new File( basedir, filename ); + } + else if ( testPropertiesFile != null ) + { + propertiesFile = new File( basedir, testPropertiesFile ); + } + + if ( propertiesFile != null && propertiesFile.isFile() ) + { + + try ( InputStream fin = new FileInputStream( propertiesFile ) ) + { + Properties loadedProperties = new Properties(); + loadedProperties.load( fin ); + collectedTestProperties.putAll( loadedProperties ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error reading system properties from " + propertiesFile ); + } + } + + return collectedTestProperties; + } + + /** + * Verifies the invocation result. + * + * @param result The invocation result to check, must not be null. + * @param invocationIndex The index of the invocation for which to check the exit code, must not be negative. + * @param invokerProperties The invoker properties used to check the exit code, must not be null. + * @param logger The build logger, may be null if logging is disabled. + * @throws org.apache.maven.shared.scriptinterpreter.RunFailureException If the invocation result indicates a build + * failure. + */ + private void verify( InvocationResult result, int invocationIndex, InvokerProperties invokerProperties, + FileLogger logger ) + throws RunFailureException + { + if ( result.getExecutionException() != null ) + { + throw new RunFailureException( "The Maven invocation failed. " + + result.getExecutionException().getMessage(), BuildJob.Result.ERROR ); + } + else if ( !invokerProperties.isExpectedResult( result.getExitCode(), invocationIndex ) ) + { + StringBuilder buffer = new StringBuilder( 256 ); + buffer.append( "The build exited with code " ).append( result.getExitCode() ).append( ". " ); + if ( logger != null ) + { + buffer.append( "See " ); + buffer.append( logger.getOutputFile().getAbsolutePath() ); + buffer.append( " for details." ); + } + else + { + buffer.append( "See console output for details." ); + } + throw new RunFailureException( buffer.toString(), BuildJob.Result.FAILURE_BUILD ); + } + } + + /** + * Gets the goal list for the specified project. + * + * @param basedir The base directory of the project, must not be null. + * @return The list of goals to run when building the project, may be empty but never null. + * @throws org.apache.maven.plugin.MojoExecutionException If the profile file could not be read. + */ + List getGoals( final File basedir ) + throws MojoExecutionException + { + try + { + // FIXME: Currently we have null for goalsFile which has been removed. + // This might mean we can remove getGoals() at all ? Check this. + return getTokens( basedir, null, goals ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "error reading goals", e ); + } + } + + /** + * Gets the profile list for the specified project. + * + * @param basedir The base directory of the project, must not be null. + * @return The list of profiles to activate when building the project, may be empty but never null. + * @throws org.apache.maven.plugin.MojoExecutionException If the profile file could not be read. + */ + List getProfiles( File basedir ) + throws MojoExecutionException + { + try + { + return getTokens( basedir, null, profiles ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "error reading profiles", e ); + } + } + + private List calculateExcludes() + throws IOException + { + List excludes = + ( pomExcludes != null ) ? new ArrayList<>( pomExcludes ) : new ArrayList(); + if ( this.settingsFile != null ) + { + String exclude = relativizePath( this.settingsFile, projectsDirectory.getCanonicalPath() ); + if ( exclude != null ) + { + excludes.add( exclude.replace( '\\', '/' ) ); + getLog().debug( "Automatically excluded " + exclude + " from project scanning" ); + } + } + return excludes; + + } + + /** + * @return The list of setupUp jobs. + * @throws IOException + * @see {@link #setupIncludes} + */ + private List getSetupBuildJobsFromFolders() + throws IOException, MojoExecutionException + { + List excludes = calculateExcludes(); + + List setupPoms = scanProjectsDirectory( setupIncludes, excludes, BuildJob.Type.SETUP ); + if ( getLog().isDebugEnabled() ) + { + getLog().debug( "Setup projects: " + setupPoms ); + } + + return setupPoms; + } + + private static class OrdinalComparator implements Comparator + { + private static final OrdinalComparator INSTANCE = new OrdinalComparator(); + + @Override + public int compare( Object o1, Object o2 ) + { + return Integer.compare( ( ( BuildJob ) o2 ).getOrdinal(), ( ( BuildJob ) o1 ).getOrdinal() ); + } + } + + /** + * Gets the build jobs that should be processed. Note that the order of the returned build jobs is significant. + * + * @return The build jobs to process, may be empty but never null. + * @throws java.io.IOException If the projects directory could not be scanned. + */ + List getBuildJobs() + throws IOException, MojoExecutionException + { + List buildJobs; + + if ( invokerTest == null ) + { + List excludes = calculateExcludes(); + + List setupPoms = scanProjectsDirectory( setupIncludes, excludes, BuildJob.Type.SETUP ); + if ( getLog().isDebugEnabled() ) + { + getLog().debug( "Setup projects: " + Arrays.asList( setupPoms ) ); + } + + List normalPoms = scanProjectsDirectory( pomIncludes, excludes, BuildJob.Type.NORMAL ); + + Map uniquePoms = new LinkedHashMap<>(); + for ( BuildJob setupPom : setupPoms ) + { + uniquePoms.put( setupPom.getProject(), setupPom ); + } + for ( BuildJob normalPom : normalPoms ) + { + if ( !uniquePoms.containsKey( normalPom.getProject() ) ) + { + uniquePoms.put( normalPom.getProject(), normalPom ); + } + } + + buildJobs = new ArrayList<>( uniquePoms.values() ); + } + else + { + String[] testRegexes = StringUtils.split( invokerTest, "," ); + List includes = new ArrayList<>( testRegexes.length ); + List excludes = new ArrayList<>(); + + for ( String regex : testRegexes ) + { + // user just use -Dinvoker.test=MWAR191,MNG111 to use a directory thats the end is not pom.xml + if ( regex.startsWith( "!" ) ) + { + excludes.add( regex.substring( 1 ) ); + } + else + { + includes.add( regex ); + } + } + + // it would be nice if we could figure out what types these are... but perhaps + // not necessary for the -Dinvoker.test=xxx t + buildJobs = scanProjectsDirectory( includes, excludes, BuildJob.Type.DIRECT ); + } + + relativizeProjectPaths( buildJobs ); + + return buildJobs; + } + + /** + * Scans the projects directory for projects to build. Both (POM) files and mere directories will be matched by the + * scanner patterns. If the patterns match a directory which contains a file named "pom.xml", the results will + * include the path to this file rather than the directory path in order to avoid duplicate invocations of the same + * project. + * + * @param includes The include patterns for the scanner, may be null. + * @param excludes The exclude patterns for the scanner, may be null to exclude nothing. + * @param type The type to assign to the resulting build jobs, must not be null. + * @return The build jobs matching the patterns, never null. + * @throws java.io.IOException If the project directory could not be scanned. + */ + private List scanProjectsDirectory( List includes, List excludes, String type ) + throws IOException, MojoExecutionException + { + if ( !projectsDirectory.isDirectory() ) + { + return Collections.emptyList(); + } + + DirectoryScanner scanner = new DirectoryScanner(); + scanner.setBasedir( projectsDirectory.getCanonicalFile() ); + scanner.setFollowSymlinks( false ); + if ( includes != null ) + { + scanner.setIncludes( includes.toArray( new String[includes.size()] ) ); + } + if ( excludes != null ) + { + scanner.setExcludes( excludes.toArray( new String[excludes.size()] ) ); + } + scanner.addDefaultExcludes(); + scanner.scan(); + + Map matches = new LinkedHashMap<>(); + + for ( String includedFile : scanner.getIncludedFiles() ) + { + matches.put( includedFile, new BuildJob( includedFile, type ) ); + } + + for ( String includedDir : scanner.getIncludedDirectories() ) + { + String includedFile = includedDir + File.separatorChar + "pom.xml"; + if ( new File( scanner.getBasedir(), includedFile ).isFile() ) + { + matches.put( includedFile, new BuildJob( includedFile, type ) ); + } + else + { + matches.put( includedDir, new BuildJob( includedDir, type ) ); + } + } + + List projects = new ArrayList<>( matches.size() ); + + // setup ordinal values to have an order here + for ( BuildJob buildJob : matches.values() ) + { + InvokerProperties invokerProperties = + getInvokerProperties( new File( projectsDirectory, buildJob.getProject() ).getParentFile(), + null ); + buildJob.setOrdinal( invokerProperties.getOrdinal() ); + projects.add( buildJob ); + } + Collections.sort( projects, OrdinalComparator.INSTANCE ); + return projects; + } + + /** + * Relativizes the project paths of the specified build jobs against the directory specified by + * {@link #projectsDirectory} (if possible). If a project path does not denote a sub path of the projects directory, + * it is returned as is. + * + * @param buildJobs The build jobs whose project paths should be relativized, must not be null nor + * contain null elements. + * @throws java.io.IOException If any path could not be relativized. + */ + private void relativizeProjectPaths( List buildJobs ) + throws IOException + { + String projectsDirPath = projectsDirectory.getCanonicalPath(); + + for ( BuildJob buildJob : buildJobs ) + { + String projectPath = buildJob.getProject(); + + File file = new File( projectPath ); + + if ( !file.isAbsolute() ) + { + file = new File( projectsDirectory, projectPath ); + } + + String relativizedPath = relativizePath( file, projectsDirPath ); + + if ( relativizedPath == null ) + { + relativizedPath = projectPath; + } + + buildJob.setProject( relativizedPath ); + } + } + + /** + * Relativizes the specified path against the given base directory. Besides relativization, the returned path will + * also be normalized, e.g. directory references like ".." will be removed. + * + * @param path The path to relativize, must not be null. + * @param basedir The (canonical path of the) base directory to relativize against, must not be null. + * @return The relative path in normal form or null if the input path does not denote a sub path of the + * base directory. + * @throws java.io.IOException If the path could not be relativized. + */ + private String relativizePath( File path, String basedir ) + throws IOException + { + String relativizedPath = path.getCanonicalPath(); + + if ( relativizedPath.startsWith( basedir ) ) + { + relativizedPath = relativizedPath.substring( basedir.length() ); + if ( relativizedPath.startsWith( File.separator ) ) + { + relativizedPath = relativizedPath.substring( File.separator.length() ); + } + + return relativizedPath; + } + else + { + return null; + } + } + + /** + * Returns the map-based value source used to interpolate POMs and other stuff. + * + * @param escapeXml {@code true}, to escape any XML special characters in the property values; {@code false}, to not + * escape any property values. + * + * @return The map-based value source for interpolation, never null. + */ +/** + * Returns the map-based value source used to interpolate POMs and other stuff. + * + * @param escapeXml + * {@code true}, to escape any XML special characters in the property values; {@code false}, to not + * escape any property values. + * @return The map-based value source for interpolation, never null. + */ +private java.util.Map getInterpolationValueSource(final boolean escapeXml) { + java.util.Map props = new java.util.HashMap<>(); + if (filterProperties != null) { + props.putAll(filterProperties); + } + props.put("basedir", this.project.getBasedir().getAbsolutePath()); + props.put("baseurl", org.apache.maven.plugins.invoker.AbstractInvokerMojo.toUrl(this.project.getBasedir().getAbsolutePath())); + { + props.put("localRepository", /* NPEX_NULL_EXP */ + settings.getLocalRepository()); + props.put("localRepositoryUrl", org.apache.maven.plugins.invoker.AbstractInvokerMojo.toUrl(settings.getLocalRepository())); + } + return new org.apache.maven.plugins.invoker.CompositeMap(this.project, props, escapeXml); +} + + /** + * Converts the specified filesystem path to a URL. The resulting URL has no trailing slash regardless whether the + * path denotes a file or a directory. + * + * @param filename The filesystem path to convert, must not be null. + * @return The file: URL for the specified path, never null. + */ + private static String toUrl( String filename ) + { + /* + * NOTE: Maven fails to properly handle percent-encoded "file:" URLs (WAGON-111) so don't use File.toURI() here + * as-is but use the decoded path component in the URL. + */ + String url = "file://" + new File( filename ).toURI().getPath(); + if ( url.endsWith( "/" ) ) + { + url = url.substring( 0, url.length() - 1 ); + } + return url; + } + + /** + * Gets goal/profile names for the specified project, either directly from the plugin configuration or from an + * external token file. + * + * @param basedir The base directory of the test project, must not be null. + * @param filename The (simple) name of an optional file in the project base directory from which to read + * goals/profiles, may be null. + * @param defaultTokens The list of tokens to return in case the specified token file does not exist, may be + * null. + * @return The list of goal/profile names, may be empty but never null. + * @throws java.io.IOException If the token file exists but could not be parsed. + */ + private List getTokens( File basedir, String filename, List defaultTokens ) + throws IOException + { + List tokens = ( defaultTokens != null ) ? defaultTokens : new ArrayList(); + + if ( StringUtils.isNotEmpty( filename ) ) + { + File tokenFile = new File( basedir, filename ); + + if ( tokenFile.exists() ) + { + tokens = readTokens( tokenFile ); + } + } + + return tokens; + } + + /** + * Reads the tokens from the specified file. Tokens are separated either by line terminators or commas. During + * parsing, the file contents will be interpolated. + * + * @param tokenFile The file to read the tokens from, must not be null. + * @return The list of tokens, may be empty but never null. + * @throws java.io.IOException If the token file could not be read. + */ + private List readTokens( final File tokenFile ) + throws IOException + { + List result = new ArrayList<>(); + + Map composite = getInterpolationValueSource( false ); + + try ( BufferedReader reader = + new BufferedReader( new InterpolationFilterReader( newReader( tokenFile ), composite ) ) ) + { + for ( String line = reader.readLine(); line != null; line = reader.readLine() ) + { + result.addAll( collectListFromCSV( line ) ); + } + } + + return result; + } + + /** + * Gets a list of comma separated tokens from the specified line. + * + * @param csv The line with comma separated tokens, may be null. + * @return The list of tokens from the line, may be empty but never null. + */ + private List collectListFromCSV( final String csv ) + { + final List result = new ArrayList<>(); + + if ( ( csv != null ) && ( csv.trim().length() > 0 ) ) + { + final StringTokenizer st = new StringTokenizer( csv, "," ); + + while ( st.hasMoreTokens() ) + { + result.add( st.nextToken().trim() ); + } + } + + return result; + } + + /** + * Interpolates the specified POM/settings file to a temporary file. The destination file may be same as the input + * file, i.e. interpolation can be performed in-place. + *

    + * Note:This methods expects the file to be a XML file and applies special XML escaping during interpolation. + *

    + * + * @param originalFile The XML file to interpolate, must not be null. + * @param interpolatedFile The target file to write the interpolated contents of the original file to, must not be + * null. + * + * @throws org.apache.maven.plugin.MojoExecutionException If the target file could not be created. + */ + void buildInterpolatedFile( File originalFile, File interpolatedFile ) + throws MojoExecutionException + { + getLog().debug( "Interpolate " + originalFile.getPath() + " to " + interpolatedFile.getPath() ); + + try + { + String xml; + + Map composite = getInterpolationValueSource( true ); + + // interpolation with token @...@ + try ( Reader reader = + new InterpolationFilterReader( ReaderFactory.newXmlReader( originalFile ), composite, "@", "@" ) ) + { + xml = IOUtil.toString( reader ); + } + + try ( Writer writer = WriterFactory.newXmlWriter( interpolatedFile ) ) + { + interpolatedFile.getParentFile().mkdirs(); + + writer.write( xml ); + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to interpolate file " + originalFile.getPath(), e ); + } + } + + /** + * Gets the (interpolated) invoker properties for an integration test. + * + * @param projectDirectory The base directory of the IT project, must not be null. + * @return The invoker properties, may be empty but never null. + * @throws org.apache.maven.plugin.MojoExecutionException If an I/O error occurred during reading the properties. + */ + private InvokerProperties getInvokerProperties( final File projectDirectory, Properties globalInvokerProperties ) + throws MojoExecutionException + { + Properties props; + if ( globalInvokerProperties != null ) + { + props = new Properties( globalInvokerProperties ); + } + else + { + props = new Properties(); + } + + File propertiesFile = new File( projectDirectory, invokerPropertiesFile ); + if ( propertiesFile.isFile() ) + { + try ( InputStream in = new FileInputStream( propertiesFile ) ) + { + props.load( in ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Failed to read invoker properties: " + propertiesFile, e ); + } + } + + Interpolator interpolator = new RegexBasedInterpolator(); + interpolator.addValueSource( new MapBasedValueSource( getInterpolationValueSource( false ) ) ); + // CHECKSTYLE_OFF: LineLength + for ( String key : props.stringPropertyNames() ) + { + String value = props.getProperty( key ); + try + { + value = interpolator.interpolate( value, "" ); + } + catch ( InterpolationException e ) + { + throw new MojoExecutionException( "Failed to interpolate invoker properties: " + propertiesFile, + e ); + } + props.setProperty( key, value ); + } + return new InvokerProperties( props ); + } + + static class ToolchainPrivateManager + { + private ToolchainManagerPrivate manager; + + private MavenSession session; + + ToolchainPrivateManager( ToolchainManagerPrivate manager, MavenSession session ) + { + this.manager = manager; + this.session = session; + } + + ToolchainPrivate[] getToolchainPrivates( String type ) throws MisconfiguredToolchainException + { + return manager.getToolchainsForType( type, session ); + } + } +} diff --git a/Java/maven-invoker-plugin-AbstractInvokerMojo_2652/metadata.json b/Java/maven-invoker-plugin-AbstractInvokerMojo_2652/metadata.json new file mode 100644 index 000000000..92ffe34f7 --- /dev/null +++ b/Java/maven-invoker-plugin-AbstractInvokerMojo_2652/metadata.json @@ -0,0 +1,21 @@ +{ + "language": "java", + "id": "maven-invoker-plugin-AbstractInvokerMojo_2652", + "buggyPath": ".", + "referencePath": null, + "buildCommand": "mvn package -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100 -DskipTests=true -DskipITs=true -Dtest=None -DfailIfNoTests=false", + "testCommand": "mvn test -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100", + "categories": [ + "safety", + "npe" + ], + "npe": { + "filepath": "src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java", + "line": 2659, + "npe_method": "getInterpolationValueSource", + "deref_field": "getLocalRepository", + "npe_class": "AbstractInvokerMojo", + "repo": "maven-invoker-plugin", + "bug_id": "AbstractInvokerMojo_2652" + } +} diff --git a/Java/maven-invoker-plugin-AbstractInvokerMojo_2652/npe.json b/Java/maven-invoker-plugin-AbstractInvokerMojo_2652/npe.json new file mode 100644 index 000000000..e60b5f659 --- /dev/null +++ b/Java/maven-invoker-plugin-AbstractInvokerMojo_2652/npe.json @@ -0,0 +1,7 @@ +{ + "filepath": "src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java", + "line": 2659, + "npe_method": "getInterpolationValueSource", + "deref_field": "getLocalRepository", + "npe_class": "AbstractInvokerMojo" +} \ No newline at end of file diff --git a/Java/maven-invoker-plugin-SelectorUtils_50/Dockerfile b/Java/maven-invoker-plugin-SelectorUtils_50/Dockerfile new file mode 100644 index 000000000..b3ce32683 --- /dev/null +++ b/Java/maven-invoker-plugin-SelectorUtils_50/Dockerfile @@ -0,0 +1,18 @@ +FROM ghcr.io/kupl/starlab-benchmarks/java-base:maven-invoker-plugin + +ENV TZ=Asia/Seoul + +COPY ./metadata.json . +COPY ./npe.json . +COPY ./buggy.java /tmp/buggy.java +RUN export BUGGY_PATH=$(cat metadata.json | jq -r ".npe.filepath") \ + && export BUGGY_LINE=$(cat metadata.json | jq -r ".npe.line") \ + && export BUGGY_MTHD=$(cat metadata.json | jq -r ".npe.npe_method") \ + && mv /tmp/buggy.java $BUGGY_PATH \ + && echo "[{\"filepath\": \"$BUGGY_PATH\", \"line\": $BUGGY_LINE, \"method_name\": \"$BUGGY_MTHD\"}]" | jq . > traces.json + +RUN git init . && git add -A + +RUN $(cat metadata.json | jq -r ".buildCommand") + +RUN $(cat metadata.json | jq -r ".testCommand"); if [ $? -eq 0 ]; then exit 1; fi diff --git a/Java/maven-invoker-plugin-SelectorUtils_50/buggy.java b/Java/maven-invoker-plugin-SelectorUtils_50/buggy.java new file mode 100644 index 000000000..8d6f39fbe --- /dev/null +++ b/Java/maven-invoker-plugin-SelectorUtils_50/buggy.java @@ -0,0 +1,321 @@ +package org.apache.maven.plugins.invoker; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.FilenameFilter; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; + +import org.apache.maven.plugins.invoker.AbstractInvokerMojo.ToolchainPrivateManager; +import org.apache.maven.project.MavenProject; +import org.apache.maven.toolchain.MisconfiguredToolchainException; +import org.apache.maven.toolchain.ToolchainPrivate; +import org.codehaus.plexus.util.Os; +import org.codehaus.plexus.util.StringUtils; + +/** + * Provides utility methods for selecting build jobs based on environmental conditions. + * + * @author Benjamin Bentmann + */ +class SelectorUtils +{ + +static void parseList(java.lang.String list, java.util.Collection includes, java.util.Collection excludes) { + java.lang.String[] tokens = org.codehaus.plexus.util.StringUtils.split(/* NPEX_NULL_EXP */ + list, ","); + for (java.lang.String token1 : tokens) { + java.lang.String token = token1.trim(); + if (token.startsWith("!")) { + excludes.add(token.substring(1)); + } else { + includes.add(token); + } + } +} + + static boolean isOsFamily( String osSpec ) + { + List includes = new ArrayList<>(); + List excludes = new ArrayList<>(); + parseList( osSpec, includes, excludes ); + + return isOsFamily( includes, true ) && !isOsFamily( excludes, false ); + } + + static boolean isOsFamily( List families, boolean defaultMatch ) + { + if ( families != null && !families.isEmpty() ) + { + for ( String family : families ) + { + if ( Os.isFamily( family ) ) + { + return true; + } + } + + return false; + } + else + { + return defaultMatch; + } + } + + /** + * Retrieves the current Maven version. + * + * @return The current Maven version. + */ + static String getMavenVersion() + { + try + { + // This relies on the fact that MavenProject is the in core classloader + // and that the core classloader is for the maven-core artifact + // and that should have a pom.properties file + // if this ever changes, we will have to revisit this code. + Properties properties = new Properties(); + // CHECKSTYLE_OFF: LineLength + properties.load( MavenProject.class.getClassLoader().getResourceAsStream( "META-INF/maven/org.apache.maven/maven-core/pom.properties" ) ); + // CHECKSTYLE_ON: LineLength + return StringUtils.trim( properties.getProperty( "version" ) ); + } + catch ( Exception e ) + { + return null; + } + } + + static String getMavenVersion( File mavenHome ) + { + File mavenLib = new File( mavenHome, "lib" ); + File[] jarFiles = mavenLib.listFiles( new FilenameFilter() + { + public boolean accept( File dir, String name ) + { + return name.endsWith( ".jar" ); + } + } ); + + for ( File file : jarFiles ) + { + try + { + @SuppressWarnings( "deprecation" ) + URL url = + new URL( "jar:" + file.toURL().toExternalForm() + + "!/META-INF/maven/org.apache.maven/maven-core/pom.properties" ); + + Properties properties = new Properties(); + properties.load( url.openStream() ); + String version = StringUtils.trim( properties.getProperty( "version" ) ); + if ( version != null ) + { + return version; + } + } + catch ( MalformedURLException e ) + { + // ignore + } + catch ( IOException e ) + { + // ignore + } + } + return null; + } + + static boolean isMavenVersion( String mavenSpec ) + { + return isMavenVersion( mavenSpec, getMavenVersion() ); + } + + static boolean isMavenVersion( String mavenSpec, String actualVersion ) + { + List includes = new ArrayList<>(); + List excludes = new ArrayList<>(); + parseList( mavenSpec, includes, excludes ); + + List mavenVersionList = parseVersion( actualVersion ); + + return isJreVersion( mavenVersionList, includes, true ) && !isJreVersion( mavenVersionList, excludes, false ); + } + + static String getJreVersion() + { + return System.getProperty( "java.version", "" ); + } + + static String getJreVersion( File javaHome ) + { + // @todo detect actual version + return null; + } + + static boolean isJreVersion( String jreSpec ) + { + return isJreVersion( jreSpec, getJreVersion() ); + } + + static boolean isJreVersion( String jreSpec, String actualJreVersion ) + { + List includes = new ArrayList(); + List excludes = new ArrayList(); + parseList( jreSpec, includes, excludes ); + + List jreVersion = parseVersion( actualJreVersion ); + + return isJreVersion( jreVersion, includes, true ) && !isJreVersion( jreVersion, excludes, false ); + } + + static boolean isJreVersion( List jreVersion, List versionPatterns, boolean defaultMatch ) + { + if ( versionPatterns != null && !versionPatterns.isEmpty() ) + { + for ( String versionPattern : versionPatterns ) + { + if ( isJreVersion( jreVersion, versionPattern ) ) + { + return true; + } + } + + return false; + } + else + { + return defaultMatch; + } + } + + static boolean isJreVersion( List jreVersion, String versionPattern ) + { + List checkVersion = parseVersion( versionPattern ); + + if ( versionPattern.endsWith( "+" ) ) + { + // 1.5+ <=> [1.5,) + return compareVersions( jreVersion, checkVersion ) >= 0; + } + else if ( versionPattern.endsWith( "-" ) ) + { + // 1.5- <=> (,1.5) + return compareVersions( jreVersion, checkVersion ) < 0; + } + else + { + // 1.5 <=> [1.5,1.6) + return checkVersion.size() <= jreVersion.size() + && checkVersion.equals( jreVersion.subList( 0, checkVersion.size() ) ); + } + } + + static List parseVersion( String version ) + { + version = version.replaceAll( "[^0-9]", "." ); + + String[] tokens = StringUtils.split( version, "." ); + + List numbers = new ArrayList(); + + for ( String token : tokens ) + { + numbers.add( Integer.valueOf( token ) ); + } + + return numbers; + } + + static int compareVersions( List version1, List version2 ) + { + for ( Iterator it1 = version1.iterator(), it2 = version2.iterator();; ) + { + if ( !it1.hasNext() ) + { + return it2.hasNext() ? -1 : 0; + } + if ( !it2.hasNext() ) + { + return it1.hasNext() ? 1 : 0; + } + + Integer num1 = it1.next(); + Integer num2 = it2.next(); + + int rel = num1.compareTo( num2 ); + if ( rel != 0 ) + { + return rel; + } + } + } + + /** + * @param toolchainPrivateManager + * @param invokerToolchains + * @return {@code true} if all invokerToolchains are available, otherwise {@code false} + */ + static boolean isToolchain( ToolchainPrivateManager toolchainPrivateManager, + Collection invokerToolchains ) + { + for ( InvokerToolchain invokerToolchain : invokerToolchains ) + { + boolean found = false; + try + { + for ( ToolchainPrivate tc : toolchainPrivateManager.getToolchainPrivates( invokerToolchain.getType() ) ) + { + if ( !invokerToolchain.getType().equals( tc.getType() ) ) + { + // useful because of MNG-5716 + continue; + } + + if ( tc.matchesRequirements( invokerToolchain.getProvides() ) ) + { + found = true; + continue; + } + } + } + catch ( MisconfiguredToolchainException e ) + { + return false; + } + + if ( !found ) + { + return false; + } + } + + return true; + } +} diff --git a/Java/maven-invoker-plugin-SelectorUtils_50/metadata.json b/Java/maven-invoker-plugin-SelectorUtils_50/metadata.json new file mode 100644 index 000000000..a7f93bca3 --- /dev/null +++ b/Java/maven-invoker-plugin-SelectorUtils_50/metadata.json @@ -0,0 +1,21 @@ +{ + "language": "java", + "id": "maven-invoker-plugin-SelectorUtils_50", + "buggyPath": ".", + "referencePath": null, + "buildCommand": "mvn package -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100 -DskipTests=true -DskipITs=true -Dtest=None -DfailIfNoTests=false", + "testCommand": "mvn test -V -B -Denforcer.skip=true -Dcheckstyle.skip=true -Dcobertura.skip=true -Drat.skip=true -Dlicense.skip=true -Dfindbugs.skip=true -Dgpg.skip=true -Dskip.npm=true -Dskip.gulp=true -Dskip.bower=true -Drat.numUnapprovedLicenses=100", + "categories": [ + "safety", + "npe" + ], + "npe": { + "filepath": "src/main/java/org/apache/maven/plugins/invoker/SelectorUtils.java", + "line": 50, + "npe_method": "parseList", + "deref_field": "list", + "npe_class": "SelectorUtils", + "repo": "maven-invoker-plugin", + "bug_id": "SelectorUtils_50" + } +} diff --git a/Java/maven-invoker-plugin-SelectorUtils_50/npe.json b/Java/maven-invoker-plugin-SelectorUtils_50/npe.json new file mode 100644 index 000000000..40bcb94e1 --- /dev/null +++ b/Java/maven-invoker-plugin-SelectorUtils_50/npe.json @@ -0,0 +1,7 @@ +{ + "filepath": "src/main/java/org/apache/maven/plugins/invoker/SelectorUtils.java", + "line": 50, + "npe_method": "parseList", + "deref_field": "list", + "npe_class": "SelectorUtils" +} \ No newline at end of file