commercetools / commercetools-sync-java

Java library for importing and syncing (taking care of changes) data into one or more commercetools projects from external data files or from another commercetools project.
https://commercetools.github.io/commercetools-sync-java
Apache License 2.0
32 stars 37 forks source link

10.0.0-beta.x versions throw ClassNotFoundException / NoClassDefFound (in Maven) #1111

Closed Mercious closed 9 months ago

Mercious commented 10 months ago

In a fresh maven project, when using the any of the 10.0.0-beta versions, instancing any of the *Sync-classes results in: NoClassDefFound com/commercetools/api/client/SimplePagedQueryResourceRequest

To Reproduce Empty spring-boot web project with additional commercetools sync dependency:

<dependency>
    <groupId>com.commercetools</groupId>
    <artifactId>commercetools-sync-java</artifactId>
    <version>10.0.0-beta.5</version>
</dependency>

Now any instancing of the sync classes throws an exception:

@SpringBootTest
class ATestApplicationTests {

    @Test
    void contextLoads() {
        new TypeSync(TypeSyncOptionsBuilder.of(null).build()); // even with real options backed by valid ProjectApiRoot
    }

}

Throws:

java.lang.NoClassDefFoundError: com/commercetools/api/client/SimplePagedQueryResourceRequest at com.commercetools.sync.types.TypeSync.\<init>(TypeSync.java:41)

It seems like these beta-versions bring a really old version of commercetools-sdk-java-api, it includes com.commercetools.sdk:commercetools-sdk-java-api:jar:10.1.0:compile com.commercetools.sdk:commercetools-sdk-compat-v1:jar:17.1.0:compile

Not sure if that in itself is wrong, but when explicitly adding a current version of commercetools-sdk-java-api to the pom.xml, the exception stops occurring:

<dependency>
    <groupId>com.commercetools.sdk</groupId>
    <artifactId>commercetools-sdk-java-api</artifactId>
    <version>17.1.0</version>
</dependency>

9.2.3 doesn't seem to have this issue, it also seems to have a newer version of commercetools-sdk-java-api that also matches the compat version - 13.0.0

lojzatran commented 10 months ago

Hi @Mercious

Thank you for reporting the issue. We created a PR that should clean up all these conflicting dependencies: https://github.com/commercetools/commercetools-sync-java/pull/1110. You could expect a fix release this week or early next week.

lojzatran commented 9 months ago

Hi @Mercious,

We released a new version and now the conflicting dependencies are cleaned up. Hereby I'm closing this issue. If the problem persists, feel free to reopen the issue.