Skip to content

mvnup: Add HTTP-to-HTTPS repository URL upgrade strategy#12454

Draft
gnodet wants to merge 1 commit into
apache:masterfrom
gnodet:add-http-to-https-repository-url-upgrade-to-mvnup
Draft

mvnup: Add HTTP-to-HTTPS repository URL upgrade strategy#12454
gnodet wants to merge 1 commit into
apache:masterfrom
gnodet:add-http-to-https-repository-url-upgrade-to-mvnup

Conversation

@gnodet

@gnodet gnodet commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a new RepositoryHttpsUpgradeStrategy that automatically converts http:// repository URLs to https:// in POM files
  • Since Maven 3.8.1+, HTTP repositories are blocked by the maven-default-http-blocker mirror, so any http:// repository URL causes build failures
  • Well-known repositories (Apache snapshots/releases, Maven Central variants like repo1.maven.org, central.maven.org) are mapped to their canonical HTTPS equivalents
  • All other http:// URLs get a generic scheme upgrade to https://

Sections handled

  • <repositories>/<repository> URLs
  • <pluginRepositories>/<pluginRepository> URLs
  • <distributionManagement>/<repository> and <snapshotRepository> URLs
  • Profile-scoped repositories in all of the above sections

Test plan

  • Well-known Apache repository URL normalization (snapshots, releases) — 2 tests
  • Maven Central variant normalization (repo1, central, repo.maven.apache.org) — 3 tests
  • Trailing slash preservation for well-known URLs — 1 test
  • Unknown URL returns null from mapping — 1 test
  • Generic http→https conversion — 2 tests
  • URLs already using https (no change) — 1 test
  • POM with no repositories (no change) — 1 test
  • Plugin repository URL upgrade — 1 test
  • distributionManagement repository and snapshotRepository — 3 tests
  • Profile-scoped repositories and pluginRepositories — 2 tests
  • Multiple repositories in a single POM — 2 tests
  • Repositories across all sections simultaneously — 1 test
  • Edge cases (no URL element, no id element, central.maven.org normalization) — 3 tests
  • Applicability tests (--model, --all, default, --model=false) — 4 tests
  • All 495 existing tests pass

🤖 Generated with Claude Code

…o mvnup

Since Maven 3.8.1+, HTTP repositories are blocked by the
maven-default-http-blocker mirror. This adds a RepositoryHttpsUpgradeStrategy
that automatically converts http:// repository URLs to https:// in POM files.

Well-known repositories (Apache snapshots/releases, Maven Central variants)
are mapped to their canonical HTTPS equivalents. All other http:// URLs get
a generic scheme upgrade.

Handles repositories, pluginRepositories, distributionManagement (both
repository and snapshotRepository), and profile-scoped repositories.

Includes 27 tests covering well-known URL normalization, generic http->https
conversion, all POM sections, profile-scoped repos, and edge cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant