Skip to content

[nexus3] JReleaser removes trailing slash from URL, leading to 400 error #1967

@ThomasVitale

Description

@ThomasVitale

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem (link to git repository is ideal)
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. Set up a project with JReleaser using the nexus3 deployer and configure the URL like https://mynexus.example.com/repositories/my-repo/ (notice the trailing slash).
  2. Run jreleaser config.
  3. In the result, you can see the URL has been changed to https://mynexus.example.com/repositories/my-repo (no final trailing slash).
  4. Run jreleaser full-release. The task will fail with the following error:
Unexpected error when deploying `com.example.mylibrary:mylibrary-bom`: Error when deploying artifact `com.example.mylibrary:mylibrary-bom`
Got 400 reason: Repository path must have another '/' after initial '/', 

Config I'm using:

deploy:
  maven:
    nexus2:
      systematic:
        active: SNAPSHOT
        sign: false
        applyMavenCentralRules: true
        url: https://mynexus.example.com/repositories/my-repo/
        snapshotUrl: https://mynexus.example.com/repositories/my-repo/
        snapshotSupported: true
        connectTimeout: 60
        readTimeout: 120
        stagingRepositories:
          - build/staging-deploy
    nexus3:
      systematic:
        active: RELEASE
        sign: false
        applyMavenCentralRules: true
        url: https://mynexus.example.com/repositories/my-repo/
        connectTimeout: 60
        readTimeout: 120
        stagingRepositories:
          - build/staging-deploy

I can see the nexus2 deployer doesn't remove the trailing slash from the url property based on what is shown from jreleaser config. However, it keeps it for the snapshotUrl.

Expected Behaviour

I would expect the release task to complete successfully.

Actual Behaviour

The error is the same that happens when trying from a browser to access the repository on the Nexus3 instance. When visiting https://mynexus.example.com/repositories/my-repo, it fails with the same error as the one got from JReleaser. When visiting https://mynexus.example.com/repositories/my-repo/ (notice the trailing slash), it succeeds.

From trace.log (notice the URL is missing the trailing slash):

[INFO]      [nexus3]  - com/example/mylibrary/mylibrary-bom/0.0.1/mylibrary-bom-0.0.1.pom
[INFO]      [nexus3]  - com/example/mylibrary/mylibrary-bom/0.0.1/mylibrary-bom-0.0.1.module
[DEBUG]     [nexus3]  - deploying com.example.mylibrary:mylibrary-bom
[DEBUG]     [nexus3] url: https://mynexus.example.com/repositories/my-repo
[DEBUG]     [nexus3] opening connection
[DEBUG]     [nexus3] configuring connection
[DEBUG]     [nexus3] Accept: [*/*]
[DEBUG]     [nexus3] User-Agent: [JReleaser/1.19.0]
[DEBUG]     [nexus3] Content-Type: [multipart/form-data; boundary=9a7bb399-2090-4acb-97ca-9ab49a03d519]
[DEBUG]     [nexus3] sending data
[DEBUG]     [nexus3] handling response
server replied with 400: Repository path must have another '/' after initial '/'
[ERROR]     [nexus3]  x com.example.mylibrary:mylibrary-bom
jreleaser.shadow.org.jreleaser.sdk.nexus3.Nexus3Exception: Error when deploying artifact com.example.mylibrary:mylibrary-bom
Got 400 reason: Repository path must have another '/' after initial '/', 

Environment Information

  • Operating System: Windows
  • JReleaser Version: 1.19.0
  • JDK Version: 21

Additional Context

I can see that the trailing slash is removed due to past issues with the nexus2 deployer. I wonder if nexus3 has a different requirement. See #1716 and #1724.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomersreleasedIssue has been released

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions