From 75d4e38542fce180bb5e6c96344be17b09dc145b Mon Sep 17 00:00:00 2001 From: Stephen Hopper Date: Mon, 17 Nov 2025 12:40:09 -0600 Subject: [PATCH 1/5] update coursier default version --- .../pants/jvm/resolve/coursier_fetch_integration_test.py | 5 +++-- src/python/pants/jvm/resolve/coursier_setup.py | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py b/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py index c84a03fb164..2838ac3666e 100644 --- a/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py +++ b/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py @@ -714,9 +714,10 @@ def test_missing_entry_for_transitive_dependency(rule_runner: RuleRunner) -> Non missing = coords_of_dependencies - coords_of_entries # We expect all the dependencies to have an entry, but right now it's not true - # for ("junit", "junit") and ("org.apache.curator", "apache-curator"). + # for ("org.apache.curator", "apache-curator"). + # Note: As of Coursier v2.1.24, the ("junit", "junit") issue appears to be fixed. # TODO Remove the workaround once the bug is fixed. - assert missing == {("junit", "junit"), ("org.apache.curator", "apache-curator")} + assert missing == {("org.apache.curator", "apache-curator")} @maybe_skip_jdk_test diff --git a/src/python/pants/jvm/resolve/coursier_setup.py b/src/python/pants/jvm/resolve/coursier_setup.py index 5e291f4fac6..c9dba5c3ab6 100644 --- a/src/python/pants/jvm/resolve/coursier_setup.py +++ b/src/python/pants/jvm/resolve/coursier_setup.py @@ -112,8 +112,12 @@ class CoursierSubsystem(TemplatedExternalTool): name = "coursier" help = "A dependency resolver for the Maven ecosystem. (https://get-coursier.io/)" - default_version = "v2.1.6" + default_version = "v2.1.24" default_known_versions = [ + "v2.1.24|macos_arm64 |8f47594eb62dea25af913c8932d1f1d86a3a9c8e1262925b63852635390a3f43|21541383|https://github.com/VirtusLab/coursier-m1/releases/download/v2.1.24/cs-aarch64-apple-darwin.gz", + "v2.1.24|linux_arm64 |96b4c7580d253b6999a40e94413ca6c4a9bd2339ecce4754ac31a26d1a12fcbf|21534519|https://github.com/VirtusLab/coursier-m1/releases/download/v2.1.24/cs-aarch64-pc-linux.gz", + "v2.1.24|linux_x86_64|d2c0572a17fb6146ea65349b59dd216b38beff60ae22bce6e549867c6ed2eda6|23366878", + "v2.1.24|macos_x86_64|33913cd6b61658035d9e6fe971e919cb0ef1f659aa7bff7deeded963a2d36385|22442034", "v2.1.6|macos_arm64 |746b3e346fa2c0107fdbc8a627890d495cb09dee4f8dcc87146bdb45941088cf|20829782|https://github.com/VirtusLab/coursier-m1/releases/download/v2.1.6/cs-aarch64-apple-darwin.gz", "v2.1.6|linux_arm64 |33330ca433781c9db9458e15d2d32e5d795de3437771647e26835e8b1391af82|20899290|https://github.com/VirtusLab/coursier-m1/releases/download/v2.1.6/cs-aarch64-pc-linux.gz", "v2.1.6|linux_x86_64|af7234f8802107f5e1130307ef8a5cc90262d392f16ddff7dce27a4ed0ddd292|20681688", From 30eee30a4d38ec535ea36a284b2604b779874fda Mon Sep 17 00:00:00 2001 From: Stephen Hopper Date: Fri, 21 Nov 2025 07:49:35 -0600 Subject: [PATCH 2/5] update fix --- src/python/pants/jvm/resolve/coursier_fetch.py | 12 +++++------- .../jvm/resolve/coursier_fetch_integration_test.py | 7 ++----- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/python/pants/jvm/resolve/coursier_fetch.py b/src/python/pants/jvm/resolve/coursier_fetch.py index b30f769bd43..de6efd0faaa 100644 --- a/src/python/pants/jvm/resolve/coursier_fetch.py +++ b/src/python/pants/jvm/resolve/coursier_fetch.py @@ -247,14 +247,12 @@ def dependencies( return ( entry, tuple( - dependency_entry + entries.get((d.group, d.artifact, d.classifier)) for d in entry.dependencies - # The dependency might not be present in the entries due to coursier bug: - # https://github.com/coursier/coursier/issues/2884 - # As a workaround, if this happens, we want to skip the dependency. - # TODO Drop the check once the bug is fixed. - if (dependency_entry := entries.get((d.group, d.artifact, d.classifier))) - is not None + # Coursier will pass "pom" coords through to us. These coords don't have + # a coords entry, but all of their relevant dependencies have already been taken into account + # and will appear in the dependencies list + if d.classifier != "pom" ), ) diff --git a/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py b/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py index 2838ac3666e..68204e3a0e1 100644 --- a/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py +++ b/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py @@ -687,7 +687,7 @@ def test_transitive_group_only_excludes(rule_runner: RuleRunner) -> None: @maybe_skip_jdk_test -def test_missing_entry_for_transitive_dependency(rule_runner: RuleRunner) -> None: +def test_missing_entry_for_transitive_pom_dependency(rule_runner: RuleRunner) -> None: requirement = ArtifactRequirement( coordinate=Coordinate( group="org.apache.hive", @@ -713,10 +713,7 @@ def test_missing_entry_for_transitive_dependency(rule_runner: RuleRunner) -> Non } missing = coords_of_dependencies - coords_of_entries - # We expect all the dependencies to have an entry, but right now it's not true - # for ("org.apache.curator", "apache-curator"). - # Note: As of Coursier v2.1.24, the ("junit", "junit") issue appears to be fixed. - # TODO Remove the workaround once the bug is fixed. + # We expect all the dependencies to have an entry except for entries with a classifier of type "pom" assert missing == {("org.apache.curator", "apache-curator")} From 2e1a2fde1e59304b23e1b58b58fd32d0fe527f91 Mon Sep 17 00:00:00 2001 From: Stephen Hopper Date: Tue, 25 Nov 2025 16:21:23 -0600 Subject: [PATCH 3/5] update release notes --- docs/notes/2.31.x.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/notes/2.31.x.md b/docs/notes/2.31.x.md index 1d41833b5de..4b84c52f3a2 100644 --- a/docs/notes/2.31.x.md +++ b/docs/notes/2.31.x.md @@ -33,6 +33,8 @@ Folling the annoucement in in the [2.30.x](https://github.com/pantsbuild/pants/b Java first party dependency inference logic [now](https://github.com/pantsbuild/pants/pull/22889) correctly identifies unqualified, same-package inner class references. +Updated to use Coursier v2.1.24 by default to pick up a bug fix allowing us to [simplify our code a bit](https://github.com/pantsbuild/pants/pull/22906). + #### Python A variety of Pex options to support building [native executables From 5cfee237d22f2dde04c1539baa5b197e82ff319b Mon Sep 17 00:00:00 2001 From: Stephen Hopper Date: Tue, 25 Nov 2025 17:01:49 -0600 Subject: [PATCH 4/5] fix type check --- src/python/pants/jvm/resolve/coursier_fetch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python/pants/jvm/resolve/coursier_fetch.py b/src/python/pants/jvm/resolve/coursier_fetch.py index de6efd0faaa..0d90c1b7ebf 100644 --- a/src/python/pants/jvm/resolve/coursier_fetch.py +++ b/src/python/pants/jvm/resolve/coursier_fetch.py @@ -247,12 +247,13 @@ def dependencies( return ( entry, tuple( - entries.get((d.group, d.artifact, d.classifier)) + dep_entry for d in entry.dependencies # Coursier will pass "pom" coords through to us. These coords don't have # a coords entry, but all of their relevant dependencies have already been taken into account # and will appear in the dependencies list if d.classifier != "pom" + and (dep_entry := entries.get((d.group, d.artifact, d.classifier))) is not None ), ) From fc20b8814d4785c8b91b51c6ab191d189f0b7ff3 Mon Sep 17 00:00:00 2001 From: Stephen Hopper Date: Wed, 26 Nov 2025 06:57:47 -0600 Subject: [PATCH 5/5] change lookup type --- src/python/pants/jvm/resolve/coursier_fetch.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/python/pants/jvm/resolve/coursier_fetch.py b/src/python/pants/jvm/resolve/coursier_fetch.py index 0d90c1b7ebf..78b65d32e9f 100644 --- a/src/python/pants/jvm/resolve/coursier_fetch.py +++ b/src/python/pants/jvm/resolve/coursier_fetch.py @@ -247,13 +247,12 @@ def dependencies( return ( entry, tuple( - dep_entry + entries[(d.group, d.artifact, d.classifier)] for d in entry.dependencies # Coursier will pass "pom" coords through to us. These coords don't have # a coords entry, but all of their relevant dependencies have already been taken into account # and will appear in the dependencies list if d.classifier != "pom" - and (dep_entry := entries.get((d.group, d.artifact, d.classifier))) is not None ), )