-
Notifications
You must be signed in to change notification settings - Fork 19
Description
SDK version - 19.0.0
I'm trying to use the new split-packages approach to reduce the size of my final artifact. My application only needs to fetch the categories, so I have added the following dependencies and code to my project:
build.gradle.kts
val commercetoolsVersion = "19.0.0"
dependencies {
implementation("com.commercetools.sdk:commercetools-http-client:$commercetoolsVersion")
implementation("com.commercetools.sdk:commercetools-sdk-java-api-models_category:$commercetoolsVersion")
implementation("com.commercetools.sdk:commercetools-sdk-java-api-predicates:$commercetoolsVersion")
}
code:
val apiRoot = ApiRootBuilder.of()
.defaultClient(
ClientCredentials.of()
.withClientId(System.getenv("CTP_CLIENT_ID"))
.withClientSecret(System.getenv("CTP_CLIENT_SECRET"))
.build(),
ServiceRegion.valueOf("GCP_EUROPE_WEST1")
)
.build(System.getenv("CTP_PROJECT_KEY"))
val response = apiRoot.categories()
.get()
.addLimit(500)
.execute()
.get()
.body
After executing the following code, I can see the next error:
java.lang.NoClassDefFoundError: com/commercetools/api/models/customer/CustomerReference
I thought: "Okay, let's add customer models - com.commercetools.sdk:commercetools-sdk-java-api-models_customer". After this, I see the following error:
java.lang.NoClassDefFoundError: com/commercetools/api/models/order/OrderReferenceBuilder
My thoughts: "Hmm, let's try adding order models - com.commercetools.sdk:commercetools-sdk-java-api-models_order". The next error:
java.lang.NoClassDefFoundError: com/commercetools/api/models/business_unit/BusinessUnitReferenceBuilder
It seems to go on forever. What's interesting is that it fails with a different NoClassDefFoundError error every time you run this code.
Could you please help me understand where the issue could be? Am I doing something wrong, or is this something with the SDK? It looks like com.commercetools.api.models.common.Reference could be the culprit as it has a lot of builders for various types.
I have also created a minimal reproducible example - https://github.com/ZanochkynYehor/CT-split-packages-test. Hope this helps