is there a way to exclude transitive dependency in...
# scripting
v
is there a way to exclude transitive dependency in kotlin main.kts script file, something like below
@file:DependsOn("org.slf4j:slf4j-simple:1.7.30", exclude = "org.slf4j:slf4j-api")
i
Exclusions are not supported (yet). But it is possible to use a dependency non-transitively https://github.com/JetBrains/kotlin/blob/1.4.0/libraries/tools/kotlin-main-kts-test/testData/hello-kotlinx-serialization.main.kts#L3
v
thank you, is it possible to use a classifier ? for using a dependency which requires a classifier?
Copy code
<dependency>
  <groupId>com.spotify</groupId>
  <artifactId>docker-client</artifactId>
  <classifier>shaded</classifier>
  <version>3.5.12</version>
</dependency>
in above example, can I mention the classifier in main kts script somehow?
i
This might work, for at least maven resolver, se the test here - https://github.com/JetBrains/kotlin/blob/master/libraries/scripting/dependencies-maven/test/kotlin/script/experimental/test/MavenResolverTest.kt#L79 But
main-kts
uses different -
ivy
-based resolver, and this scenario hasn't been tested. If you find it working, please tell. BTW, we'll gladly accept PRs with improvements in these libs. If you're willing to contribute, please speak up, and we can discuss the directions.
v
Thanks a lot for the info, I tried the above format and it didn't work, will confirm this after trying again. Regarding contributing I may not be able to do it right now, but this definitely seems interesting and will look into it.
278 Views