coursier / coursier/coursier

Coursier does not resolve properties in `artifactId` for Maven

Closed
#3,340 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
2.1k
Forks
334
Avg merge
1d 14h
Merged PRs (30d)
77

Description

Hello!

We are using coursier via Bazel rules_jvm_external, and are stumbling across an issue where coursier isn't fetching a file corresponding to a particular (internal) artifact we depend on. It turns out it is due to a weird structure of the `artifactId` in the pom.

The pom is structured as follows:

```xml

4.0.0

com.organisation
root-pom
76
../pom.xml


example-protocol

com.organisation
protocols-${protocol_name}-${project.version}

```

And we are referencing the dependency as `com.organisation:protocols-example-protocol-76:76` (i.e., we run `coursier fetch com.organisation:protocols-example-protocol-76:76`)

In the verbose mode we see the logs:

```
Downloading https://maven-repository/repository/public/com/organisation/protocols-example-protocol-76/76/protocols-${protocol_name}-${project.version}-76.jar
Failed to download https://maven-repository/repository/public/com/organisation/protocols-example-protocol-76/76/protocols-${protocol_name}-${project.version}-76.jar
```

Which shows that it does not substitute the properties correctly in the artifact id when fetching.

We are using coursier version 2.1.8, but I can also reproduce this on the latest main branch at time of writing. Interestingly, I had a random coursier install available with version 2.0.16, and it was working correctly.

I saw a similar issue https://github.com/coursier/coursier/issues/1063 and fix https://github.com/coursier/coursier/pull/1213

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with the provided Maven POM and `coursier fetch com.organisation:protocols-example-protocol-76:76`, then compare the behavior with coursier 2.0.16 and the latest main branch. Trace Maven POM property handling for `artifactId`; done means the resolved artifact path uses `protocols-example-protocol-76` rather than the literal placeholders.

Written by the indexing model from the issue text.

Assessment

Tech stack
xml
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.