Skip to content

Maven - attempt anonymous artifact download #1859

@nmck257

Description

@nmck257

Consider a Maven settings.xml which uses property resolution for credentials:

  <servers>
    <server>
       <id>my-organization-repository</id>
       <username>${MAVEN_USERNAME}</username>
       <password>${MAVEN_PASSWORD}</password>
    </server>
  <servers>

And, suppose those properties are not resolved at runtime (eg the environment does not have those variables set, perhaps because most requests to that repository do not actually require authentication).

When rewrite-maven attempts to download artifacts using this config, it will use the placeholders directly as credentials, and inevitably receive a 401 (bad credentials) response. (Note that if the properties are set, then rewrite-maven works as expected, and if those properties are explicitly set to blank values, then rewrite-maven proceeds with anonymous requests to the repository)

However, with the same config, Apache Maven succeeds at downloading artifacts. Ostensibly, Apache Maven either attempts anonymous requests (either before or after attempting authenticated requests), or has some logic to discard credentials which are formatted like placeholder properties. It would be nice if rewrite-maven had a similar behavior.

This scenario might be a bit niche, but, solving it would increase the likelihood of rewrite-maven "just working" across diverse environments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions