https://pantsbuild.org/ logo
#general
Title
# general
g

gifted-cricket-25440

01/18/2023, 3:25 PM
Hello! Have a question. I have different dependency versions and two lockfiles for it jvm-default and sdk-V2 and during the check I get bunch of errors like:
Copy code
services/integration/src/main/scala/com/integration/repository/MxRepo.scala:14: error: not found: object mongo4cats
import mongo4cats.client.MongoClient
Dependency BUILD:
Copy code
GROUP_ID = "io.github.kirill5k"
VERSION = "0.6.4"

jvm_artifact(
    name="core",
    group=GROUP_ID,
    artifact="mongo4cats-core_2.13",
    version=VERSION,
    resolve="sdk-V2",
    packages=[
        "mongo4cats.**",
        "mongo4cats.client.**",
        "mongo4cats.database.**",
        "mongo4cats.operations.**",
    ],
)
toml for this service:
Copy code
[groups.integration]
addresses = ["services/integration::"]
resolve = "jvm:sdk-V2"
display_name = "integration"
pants.toml, where I read this config:
Copy code
[experimental-bsp]
groups_config_files = ["build.d/bsp/services.toml"]
I tried to show dependencies manually in the package BUILD file and the result is:
Copy code
NoCompatibleResolve: The selected targets did not have a resolve in common:

jvm-default:
here all the dependencies resolved for jvm-default and paths to integration microservice, that should be resolved by sdk-V2

sdk-V2:
  * 3rdparty/jvm/mongo4cats:core

Targets which will be merged onto the same classpath must share a resolve (from the [resolve]
Do you have any suggestions about it? Thanks in advance!
w

witty-crayon-22786

01/18/2023, 5:27 PM
is
services/integration/src/main/scala/com/integration/repository/MxRepo.scala
in the
sdk-v2
resolve?
g

gifted-cricket-25440

01/18/2023, 5:58 PM
@witty-crayon-22786, Should be, as for this group is configured resolve sdk-V2, but according to error it is not😅
w

witty-crayon-22786

01/18/2023, 5:59 PM
as for this group is configured resolve sdk-V2
when you say “this is group is”, what do you mean? how is it configured?
g

gifted-cricket-25440

01/18/2023, 6:00 PM
toml for this service:
Copy code
[groups.integration]
addresses = ["services/integration::"]
resolve = "jvm:sdk-V2"
display_name = "integration"
pants.toml, where I read this config:
Copy code
[experimental-bsp]
groups_config_files = ["build.d/bsp/services.toml"]
I may miss something, but isn't it should set resolves for this service?
w

witty-crayon-22786

01/18/2023, 6:01 PM
ah. so, the BSP config only declares how to actually load the project: your BUILD files are what declares resolves for individual targets
g

gifted-cricket-25440

01/18/2023, 6:01 PM
Oh, so every BUILD under this microservice should include resolve="sdk-V2"?
you can either add it to each target in the directory, or you can use
__defaults__
in a parent directory to set it for all child directories
g

gifted-cricket-25440

01/18/2023, 6:03 PM
Thank you!
7 Views