Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polylith CLI error caused by lib versions with qualifiers #514

Open
bortexz opened this issue Oct 31, 2024 · 0 comments
Open

Polylith CLI error caused by lib versions with qualifiers #514

bortexz opened this issue Oct 31, 2024 · 0 comments

Comments

@bortexz
Copy link

bortexz commented Oct 31, 2024

Describe the bug
When executing some polylith CLI commands (like poly info or create component), it throws the following error:

#error {
 :cause class java.lang.Long cannot be cast to class java.lang.String (java.lang.Long and java.lang.String are in module java.base of loader 'bootstrap')
 :via
 [{:type java.lang.ClassCastException
   :message class java.lang.Long cannot be cast to class java.lang.String (java.lang.Long and java.lang.String are in module java.base of loader 'bootstrap')
   :at [java.lang.String compareTo String.java 140]}]
 :trace
 [[java.lang.String compareTo String.java 140]
  [clojure.lang.Util compare Util.java 153]
  [clojure.lang.APersistentVector compareTo APersistentVector.java 442]
  [clojure.lang.Util compare Util.java 153]
  [polylith.clj.core.maven.core$sort_libs invokeStatic core.clj 18]
  [polylith.clj.core.maven.core$latest_lib invokeStatic core.clj 25]
  [polylith.clj.core.maven.interface$latest_lib invokeStatic interface.clj 4]
  [polylith.clj.core.lib.resolve_libs$latest invokeStatic resolve_libs.clj 7]
  [polylith.clj.core.lib.resolve_libs$latest invoke resolve_libs.clj 4]
  [clojure.lang.PersistentVector reduce PersistentVector.java 343]
  [clojure.core$reduce invokeStatic core.clj 6885]
  [polylith.clj.core.lib.resolve_libs$resolve_libs invokeStatic resolve_libs.clj 11]
  [polylith.clj.core.lib.interface$resolve_libs invokeStatic interface.clj 28]
  [polylith.clj.core.workspace_clj.projects_from_disk$src_lib_deps_from_bricks invokeStatic projects_from_disk.clj 71]
  [polylith.clj.core.workspace_clj.projects_from_disk$read_project invokeStatic projects_from_disk.clj 146]
  [polylith.clj.core.workspace_clj.projects_from_disk$read_projects$fn__24627 invoke projects_from_disk.clj 191]
  [clojure.core$keep$fn__8645$fn__8646 invoke core.clj 7393]
  [clojure.core$filter$fn__5958$fn__5959 invoke core.clj 2823]
  [clojure.lang.PersistentVector reduce PersistentVector.java 343]
  [clojure.core$transduce invokeStatic core.clj 6946]
  [clojure.core$into invokeStatic core.clj 6962]
  [polylith.clj.core.workspace_clj.projects_from_disk$read_projects invokeStatic projects_from_disk.clj 188]
  [polylith.clj.core.workspace_clj.core$toolsdeps_ws_from_disk invokeStatic core.clj 100]
  [polylith.clj.core.workspace_clj.core$workspace_from_disk invokeStatic core.clj 197]
  [polylith.clj.core.workspace_clj.interface$workspace_from_disk invokeStatic interface.clj 4]
  [polylith.clj.core.command.core$read_workspace invokeStatic core.clj 42]
  [polylith.clj.core.command.core$workspace_reader_fn$fn__28427 invoke core.clj 50]
  [polylith.clj.core.command.core$execute invokeStatic core.clj 91]
  [polylith.clj.core.command.interface$execute_command invokeStatic interface.clj 4]
  [polylith.clj.core.poly_cli.core$_main invokeStatic core.clj 31]
  [polylith.clj.core.poly_cli.core$_main doInvoke core.clj 7]
  [clojure.lang.RestFn applyTo RestFn.java 137]
  [polylith.clj.core.poly_cli.core main nil -1]]}

To Reproduce

The error seems caused by the presence of the same library with different versions, one of the versions containing some qualifier. The failing project contains the following dependencies in different components:

  • com.cognitect.aws/api {:mvn/version "0.8.692"}
  • com.cognitect.aws/api {:mvn/version "0.8.710-beta01"}

Moving all the components to one of the versions fixes the problem, but still looks like a bug on polylith. I have created the following repo with reproduction of the bug. Running poly info or clojure -M:poly info should fail with the above error.

https://github.com/bortexz/polylith-dep-compare-bug

Expected behavior
poly commands should support different lib versions with qualifiers

Operating System (please complete the following information):

  • OS: MacOS
  • Version: 14.6.1

Versions

  • Java: openjdk 17.0.12 2024-07-16 LTS
  • Poly: 0.2.19, 0.2.20, 0.2.21
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

No branches or pull requests

1 participant