Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Oct 8, 2025

Summary

This PR fixes the distributionManagement.site.url to point to the actual HTTP URL where the site is hosted (https://codehaus-plexus.github.io/plexus-pom/) instead of the Git SCM URL (scm:git:https://github.com/codehaus-plexus/plexus-pom.git).

Problem

The maven-site-plugin's site:stage goal uses distributionManagement.site.url to calculate the folder structure for staging sites (particularly important for multimodule projects). When this URL was set to a Git SCM URL, it couldn't properly map to a relative path structure, causing issues for projects inheriting from plexus-pom.

For example, in a child project like plexus-sec-dispatcher, the SCM URL would be inherited as the site URL, which site:stage couldn't properly process.

Solution

Changed distributionManagement.site.url from ${project.scm.developerConnection} to ${project.url}:

<distributionManagement>
  <site>
    <id>github:gh-pages</id>
    <url>${project.url}</url>  <!-- was: ${project.scm.developerConnection} -->
  </site>
</distributionManagement>

This change is safe because:

  1. Site publishing is unaffected: The maven-scm-publish-plugin explicitly overrides this with its pubScmUrl parameter (set to ${project.scm.developerConnection}), so site publishing to GitHub Pages continues to work correctly.

  2. Semantically correct: The distributionManagement.site.url should point to where the site is hosted (the HTTP URL), not where it's published from (the SCM URL).

  3. Consistent with Maven documentation: The Maven documentation indicates this element should contain the URL where the site can be accessed.

Testing

  • ✅ Build verification: mvn clean verify passes
  • ✅ Site generation: mvn site works correctly
  • ✅ Site staging: mvn site:stage now properly uses the HTTP URL
  • ✅ Distribution management report now displays the correct HTTP URL

Fixes #XXX (replace with issue number)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.apache.org
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.11/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.11/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.11 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.11/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/plexus-pom/plexus-pom org.codehaus.plexus.classworlds.launcher.Launcher site (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>DistributionMgmt->Site->URL incorrectly set for site:stage</issue_title>
<issue_description>The distributionMgmt site URL in

<url>${project.scm.developerConnection}</url>
is pointing to a Git URL, e.g. scm:git:[email protected]:codehaus-plexus/plexus-sec-dispatcher.git (from https://github.com/codehaus-plexus/plexus-sec-dispatcher/blob/35804938db2feec87fabe24d75509cd0d8dc3c47/pom.xml#L20). However this value is evaluated for site:stage (https://maven.apache.org/plugins/maven-site-plugin/stage-mojo.html) to calculate the folder structure being created below target/staging (for multimodule sites).

By default the same value is also used by maven-scm-publish-plugin in https://maven.apache.org/plugins/maven-scm-publish-plugin/publish-scm-mojo.html#pubScmUrl. However this is already overwritten in

<pubScmUrl>${project.scm.developerConnection}</pubScmUrl>
. Therefore the distributionManagement.site.url should rather point to the HTTP URL of where the site is hosted!

</issue_description>

Comments on the Issue (you are @copilot in this section)

@kwin @michael-o IMHO this is a bug in the maven-site-plugin, WDYT? @michael-o > [@michael-o](https://github.com/michael-o) IMHO this is a bug in the maven-site-plugin, WDYT?

Honestly, no.idea from the top.of.my head.</comment_new>
<comment_new>@kwin
I created https://issues.apache.org/jira/browse/MSITE-1032 for this.</comment_new>
<comment_new>@slawekjaranowski
very strange ... last time when I released parent I don't have a problem
It is a bug only for multimodule site?</comment_new>
<comment_new>@kwin
The other way around, only affects single module repos. There site:stage does not work correctly </comment_new>
<comment_new>@slawekjaranowski
if you set:

  <distributionManagement>
    <site>
      <id>github:gh-pages</id>
      <url>${project.scm.url}</url>
    </site>
  </distributionManagement>

in plexus-sec-dispatcher stage will be ok ... magic 😄 </comment_new>
<comment_new>@slawekjaranowski
I would like to release a plexus-pom, and next plexus-languages - with JDK 24 support

Tested locally and looks ok.

Do you have any objections?</comment_new>
<comment_new>@kwin

if you set:

  <distributionManagement>
    <site>
      <id>github:gh-pages</id>
      <url>${project.scm.url}</url>
    </site>
  </distributionManagement>

in plexus-sec-dispatcher stage will be ok ... magic 😄

This will break maven-scm-publish-plugin leveraging that element as well. Also I consider this a workaround to say the least..</comment_new>
<comment_new>@kwin
No objections to a release though. Not sure yet how to fix this issue (if at all in the parent)</comment_new>

Fixes #333

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title [WIP] Fix incorrect site URL in DistributionMgmt configuration Fix distributionManagement.site.url to use HTTP URL instead of SCM URL Oct 8, 2025
Copilot finished work on behalf of slachiewicz October 8, 2025 10:06
@Copilot Copilot AI requested a review from slachiewicz October 8, 2025 10:06
@slachiewicz slachiewicz marked this pull request as ready for review October 8, 2025 16:09
<site>
<id>github:gh-pages</id>
<url>${project.scm.developerConnection}</url>
<url>${project.url}</url>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be tricky, and can have impact to all child project with site generation
We need try to rebuild site in child projects

@kwin
Copy link
Contributor

kwin commented Oct 9, 2025

This is dangerously, let us rather fix the root cause: apache/maven-site-plugin#227

@slachiewicz slachiewicz closed this Oct 9, 2025
@slachiewicz slachiewicz deleted the copilot/fix-site-url-in-distributionmgmt branch October 13, 2025 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DistributionMgmt->Site->URL incorrectly set for site:stage

4 participants