Skip to content

[MSITE-1033] AbstractDeployMojo.getTopLevelProject(Project) returns wrong project for SCM URLs #6

@slachiewicz

Description

@slachiewicz

Affected version

.

Bug description

The method getTopLevelProject(project) (

maven-site-plugin/src/main/java/org/apache/maven/plugins/site/deploy/AbstractDeployMojo.java

Line 508 in 5a0e56d

protected MavenProject getTopLevelProject(MavenProject project) throws MojoExecutionException {
) returns the wrong project when all projects in the hierarchy have a "DistributionManagement->Site->URL" leveraging the SCM URL format: https://maven.apache.org/scm/scm-url-format.html (e.g. scm:git:git@github.com:codehaus-plexus/plexus-sec-dispatcher.git/). The method internally relies on https://github.com/apache/maven-doxia-sitetools/blob/9af3a745919525481e96bb4f0c18d62cf41446b4/doxia-site-model/src/main/java/org/apache/maven/doxia/site/inheritance/URIPathDescriptor.java#L191 which returns
true if ... shares the same scheme, host and port with the given URI.

For example https://github.com/codehaus-plexus/plexus-sec-dispatcher/blob/master/pom.xml inherits from https://github.com/codehaus-plexus/plexus-pom/blob/master/pom.xml but for sure both projects don't share a common site. However the latter is returned as top project as

scm:git:https://github.com/codehaus-plexus/plexus-pom.git/ and scm:git:git@github.com:codehaus-plexus/plexus-sec-dispatcher.git/ are incorrectly assumed to be the same because this URI is being parsed as

host = null
scheme = "scm"
port = -1
(this is an opaque URI according to https://docs.oracle.com/javase/8/docs/api/java/net/URI.html#isOpaque--)

Issue Links:

MSITE-600 site plugin 3.0 does not permit a child to fully override parent site deployment URL

MSITE-1032 AbstractDeployMojo.getDeployModuleDirectory() does not work for Git SCM URLs

Remote Links:

apache#227

Any idea here? For Git I would say different SCM URL always means nothing is shared. For SVN this used to be different (as SVN is hierarchical while Git is not).

Probably for SCM URLs extracting the provider specific part via https://github.com/apache/maven-scm/blob/master/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmUrlUtils.java and then treat that part as URI would make sense. In addition the path need be considered as well. If two paths are siblings, then they don't share a site.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions