apache / apache/maven-release

[MRELEASE-927] Releasing flat multi-module projects using git

Open
#1,105 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
128
Forks
145
Avg merge
7h 7m
Merged PRs (30d)
3

Description

**[Antoine](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=elryk)** opened **[MRELEASE-927](https://issues.apache.org/jira/browse/MRELEASE-927?redirect=false)** and commented

As suggest by [Robert Scholte](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=rfscholte), I've cloned the MRELEA[SE-767](https://issues.apache.org/jira/browse/SE-767) which has not been resoved in the 2.5 version.

When releasing a project as follows wit Git :

./parent/pom.xml
./module-a/pom.xml
./module-b/pom.xml

From the parent directory, with an scm config in the parent pom.xml (only) as follows:

```

scm:git:ssh://github.com/repox.git
scm:git:ssh://github.com/repox.git
master
https://github.com/view/repox.git

```

In org/apache/maven/shared/release/util/ReleaseUtils.java:182 it does this indiscriminately:

url = realignScmUrl( parentLevels, url );

This will trim the repo url from 'ssh://github.com/repox.git' -> 'ssh://github.com', which will cause a failure when pushing the tag.

This type of realignment is not appropriate when using a git scm type.

Error message while releasing:

> [INFO] Tagging release with the label repox-2.2.0...
> [INFO] Executing: /bin/sh -c cd /data/jenkins/slaves/slave-xxxx/workspace/repox-ci && git tag -F /tmp/maven-scm-861690979.commit repox-2.2.0
> [INFO] Working directory: /data/jenkins/slaves/slave-xxxx/workspace/repox-ci
> [INFO] Executing: /bin/sh -c cd /data/jenkins/slaves/slave-xxx/workspace/repox-ci && git push sh://github.com/repox refs/tags/repox-2.2.0
> ...
> Waiting for Jenkins to finish collecting data
> mavenExecutionResult exceptions not empty
> message : Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.1:prepare (default-cli) on project repox: Unable to tag SCM
> Provider message:
> The git-push command failed.
> Command output:
> fatal: remote error: Remote URL invalid
> A repository could not be determined from the remote URL. Please confirm the
> clone URL in Stash and try again. URL suffix: '/repox'
> fatal: Could not read from remote repository.
>
> Please make sure you have the correct access rights
> and the repository exists.

---

**Affects:** 2.5.1

**Issue Links:**
- [MRELEASE-767](https://issues.apache.org/jira/browse/MRELEASE-767) releasing flat multi-module projects using git
(_**"is a clone of"**_)
- [MRELEASE-939](https://issues.apache.org/jira/browse/MRELEASE-939) release:perform uses incorrect ReleaseDescriptor.scmRelativePathProjectDirectory in nested multi-module project

- [MRELEASE-771](https://issues.apache.org/jira/browse/MRELEASE-771) release:prepare tries to push tag with invalid Git URL

2 votes, 5 watchers

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in org/apache/maven/shared/release/util/ReleaseUtils.java at line 182 and trace how the SCM URL is realigned for flat multi-module projects. Reproduce the Git release scenario described in the issue and verify that the repository URL remains valid when pushing the release tag.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, java
Domain
build-system, release
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.