Hi! Have you used kotlin dsl with maven-publish? I...
# gradle
a
Hi! Have you used kotlin dsl with maven-publish? I am trying to get transitive dependencies like here https://gist.github.com/Robyer/a6578e60127418b380ca133a1291f017 in Kotlin DSL. I struggle with
dep.transitive
. The interface
Dependency
does not include anything with
transitive
. I am not sure how to port this groovy fragment to kotlin dsl
j
There are many sub-interfaces of Dependency, one of them being ModuleDependency (https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/ModuleDependency.html). This one does have a
transitive
property. So I guess you should check if the dependency is an instance of ModuleDependency and if it is transitive:
if (!(dep is ModuleDependency && dep.isTransitive))
s
Not sure if this helps, but I had an issue with transitive dependencies not showing up in the POM files of uploaded artifacts and it turns out I just needed to specifically upload them in the right order. For example, I had 4 subprojects-- subproject 2 depended on subproject 1, subproject 3 depended on subproject 2, etc. etc.. Subproject 2 was larger than the other subprojects (and they are uploaded async with maven-publish plugin) so it wasn't uploading until after subproject 3 was uploaded, and thus the transitive dependencies were not generated correctly in the Pom file.
I fixed it by just explicitly calling the publish tasks in the proper order in my runner config file like
Copy code
./gradlew :subproject1:publish
./gradlew :subproject2:publish
//etc
a
@jbnizet good guess! That what I had done and its working like a charm 🙂. Thanks for respones