Dependencies not passed on classpath when configuring BuildCacheServiceFactory

I have written a plugin to let the build cache load/store stuff form/to s3 bucket. For it, I have used the aws sdk “software.amazon.awssdk:s3:2.15.20”. The plugin works fine when applied to a project in settings.gradle.kts

plugins {
id(“s3-build-cache”) version (“1.0.0”)
}

buildCache {
val isContinuousIntegrationServer = System.getenv().containsKey(“CI”)
local {
isEnabled = false
}
remote {
region = AwsS3BuildCache.Region.EU_CENTRAL_1
bucket = “myBucket”
prefix = “build_cache”
isPush = isContinuousIntegrationServer
isEnabled = isContinuousIntegrationServer
useWebIdentityToken = isContinuousIntegrationServer
}
}

The above sdk uses Class.forName in order to check if additional authentication methods need to be loaded. The one I need is located in a different library, namely “software.amazon.awssdk:sts:2.15.20”, therefore I’ve added this one as a dependency in the plugin project.
When the plugin is applied to the project now, it seems that this dependency is not applied in the target project configuration phase, where the build cache configuration is loaded and applied as I get a ClassNotFoundException.
Even when applying the dependency explicitly in settings.gradle.kts as follows

buildscript {
dependencies {
classpath(“software.amazon.awssdk:sts:2.15.20”)
}
}

doesn’t solve the issue.