square / square-java-sdk

Java client library for the Square API
https://developer.squareup.com
Other
61 stars 33 forks source link

Apimatic dependency needs jakarta namespace upgrade #100

Open zeppelinux opened 1 year ago

zeppelinux commented 1 year ago

Describe the bug There are a problem using Square SDK in a project that uses jakarta namespace, it fails trying to load javax.json.JsonException class

Expected behavior It doesn't fail

To Reproduce Steps to reproduce the bug:

  1. Check out this project https://github.com/zeppelinux/square-okhttp-problem
  2. mvn clean compile quarkus:dev
  3. Navigate to http://localhost:8080/hello

Square SDK version 28.0.0.20230419

Additional context I already created an issue for Apimatic https://github.com/apimatic/core-lib-java/issues/66 this one is for updating Square SDK when apimatic:core is updated.

zeppelinux commented 1 year ago

I forked the io.apimatic:core and ported (tests are running from IDE but failing on some class jacoco class version) it to io.apimatic:jakarta-core:0.4.2 here https://github.com/zeppelinux/core-lib-java/tree/feature/port-to-jakarta

If anybody is in the same situation and io.apimatic:core repository is still not ported by Apimatic - install it locally, by checking out my project: mvn clean compile package install -DskipTests=true

and refer to it in your pom.xml by:

     <dependencyManagement>
         <dependency>
                <groupId>com.squareup</groupId>
                <artifactId>square</artifactId>
                <exclusions>
                    <exclusion>
                        <groupId>com.squareup.okhttp3</groupId>
                        <artifactId>okhttp</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>io.apimatic</groupId>
                        <artifactId>core</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
...
<dependencies>
      <dependency>
            <groupId>com.squareup</groupId>
            <artifactId>square</artifactId>
            <version>28.0.0.20230419</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>5.0.0-alpha.11</version>
        </dependency>
        <dependency>
            <groupId>io.apimatic</groupId>
            <artifactId>jakarta.core</artifactId>
            <version>0.4.2</version>
        </dependency>
...
zenmasterjobo commented 1 year ago

Hey @zeppelinux

Thanks for this write up and opening the issue. I'll bring this issue up with our SDK generator team and come back to here when I have updates. In the meantime I appreciate you posting a work around for fellow community members to use!

Cheers!