dvankley / firefly-plaid-connector-2

Connector to pull Plaid financial data into the Firefly finance tool
GNU General Public License v3.0
94 stars 14 forks source link

Move dependencies with common version numbers to Gradle Version Catalog #97

Closed nprzy closed 1 month ago

nprzy commented 2 months ago

Gradle Version Catalog is a relatively new Gradle feature that makes it easier to manage Gradle versions across projects. That functionality honestly isn't that interesting for a project like this, but what is interesting is that Dependabot supports Gradle Version Catalogs. This moves the common version configurations out of gradle.properties into the Gradle Version Catalog.

For the other dependencies that don't share a common version number with each other, I opted to leave them as-is in build.gradle.kts for simplicity.

This PR also upgrades a few of the dependencies that had been getting neglected by Dependabot due to its lack of support for upgrading gradle.properties. And it also removes a few dependencies that I noticed weren't being used.

https://github.blog/changelog/2023-03-13-dependabot-version-updates-keeps-gradle-version-catalogs-up-to-date/

https://medium.com/@vh.dev/dependabot-in-action-d9b56b2be86c

dvankley commented 2 months ago

Whoops, looks like I created a conflict here by merging dependabot updates first.

nprzy commented 2 months ago

Rebased

dvankley commented 1 month ago

@nprzy I was able to build fine with this new configuration, but when running I got:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v3.3.1)

2024-07-17T08:21:17.939-04:00  INFO 75722 --- [           main] .d.f.FireflyPlaidConnector2ApplicationKt : Starting FireflyPlaidConnector2ApplicationKt using Java 17 with PID 75722 (/user-path/dev/firefly-plaid-connector-2/build/classes/kotlin/main started by dvk in /user-path/dev/firefly-plaid-connector-2)
2024-07-17T08:21:17.940-04:00 DEBUG 75722 --- [           main] .d.f.FireflyPlaidConnector2ApplicationKt : Running with Spring Boot v3.3.1, Spring v6.1.10
2024-07-17T08:21:17.941-04:00  INFO 75722 --- [           main] .d.f.FireflyPlaidConnector2ApplicationKt : The following 1 profile is active: "dev-mysql"
2024-07-17T08:21:18.657-04:00  INFO 75722 --- [           main] .d.f.FireflyPlaidConnector2ApplicationKt : Started FireflyPlaidConnector2ApplicationKt in 0.882 seconds (process running for 1.104)
2024-07-17T08:21:18.683-04:00 ERROR 75722 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    net.djvk.fireflyPlaidConnector2.api.firefly.infrastructure.ApiClient$clientConfig$2$1$1.invoke(ApiClient.kt:30)

The following method did not exist:

    'void io.ktor.serialization.jackson.JacksonConverterKt.jackson$default(io.ktor.serialization.Configuration, io.ktor.http.ContentType, boolean, kotlin.jvm.functions.Function1, int, java.lang.Object)'

The calling method's class, net.djvk.fireflyPlaidConnector2.api.firefly.infrastructure.ApiClient$clientConfig$2$1$1, was loaded from the following location:

    file:/user-path/dev/firefly-plaid-connector-2/build/classes/kotlin/main/net/djvk/fireflyPlaidConnector2/api/firefly/infrastructure/ApiClient$clientConfig$2$1$1.class

The called method's class, io.ktor.serialization.jackson.JacksonConverterKt, is available from the following locations:

    jar:file:/user-path/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-serialization-jackson-jvm/2.1.1/8ddd22da77a6ec4907e93d6f012242f026ba72ea/ktor-serialization-jackson-jvm-2.1.1.jar!/io/ktor/serialization/jackson/JacksonConverterKt.class

The called method's class hierarchy was loaded from the following locations:

    io.ktor.serialization.jackson.JacksonConverterKt: file:/user-path/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-serialization-jackson-jvm/2.1.1/8ddd22da77a6ec4907e93d6f012242f026ba72ea/ktor-serialization-jackson-jvm-2.1.1.jar

Action:

Correct the classpath of your application so that it contains compatible versions of the classes net.djvk.fireflyPlaidConnector2.api.firefly.infrastructure.ApiClient$clientConfig$2$1$1 and io.ktor.serialization.jackson.JacksonConverterKt

Process finished with exit code 1
nprzy commented 1 month ago

tl;dr: I think something may be wrong with your cache.

I wasn't able to reproduce. Digging into the error message, it's telling us that this method from the ktor-serialization-jackson package does not exist. This PR updates this package from v2.1.1 to v2.3.12.

We can see from this link to the v2.3.12 of this file that it indeed does exist. However, we can also see in your error message that it's not getting that class from the v2.3.12 jar, it's coming from the v2.1.1 jar. That method does not exist in 2.1.1. Something similar is there, but with a slightly different signature, which we see exists but has been deprecated by v2.3.12.

The Kotlin compiler seems to be seeing the v2.3.12 jar and compiling the Firefly API client to use the new v2.3.12 method signature, but for some reason your classpath still appears to have the v2.1.1 jar on it. I suspect if you kill your Gradle/Kotlin daemon processes and/or clear your build cache it should probably fix things.

dvankley commented 1 month ago

Thanks for looking into that; didn't have time to dig in much this morning. I wiped my gradle cache as you suggested and that seems to have fixed it.

dvankley commented 1 month ago

Other than that, looks good to go.