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 000000000..d42c4af94 Binary files /dev/null and b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/generate-release-poms/basic-pom-with-encoding/pom.xml differ 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 000000000..340d1a598 Binary files /dev/null and b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-encoding/expected-pom.xml differ 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 000000000..c2d9c6eda Binary files /dev/null and b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom-with-encoding/pom.xml differ 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 000000000..dac6a6daf Binary files /dev/null and b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-encoding/expected-pom.xml differ 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 000000000..a694775be Binary files /dev/null and b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom-with-encoding/pom.xml differ 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 000000000..44b2f6d7c Binary files /dev/null and b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-encoding/expected-pom.xml differ 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 000000000..c2d9c6eda Binary files /dev/null and b/Java-base/maven-release/src/maven-release-manager/src/test/resources/projects/rewrite-for-release/basic-pom-with-encoding/pom.xml differ 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