Search code examples
gradlepluginseartransitive-dependency

gradle earlib not pulling transitive libraries


I got gradle 3.5.1 and using ear plugin. The documentation says that deploy configuration is not transitive but earlib actually is (https://docs.gradle.org/3.3/userguide/ear_plugin.html). My configuration is a below

dependencies {
    earlib(
            "org.mybatis:mybatis:3.2.8"
    )
}

It was supposed to get a few other transitive libraries but here is all I get when I run gradle dependencies

earlib - Classpath for module dependencies.
\--- org.mybatis:mybatis:3.2.8

What am I doing wrong here?


Solution

  • Actually, you are doing nothing wrong. Your module dependency org.mybatis:mybatis:3.2.8 simply does not define any (mandatory) transitive dependency, since every compile or provided dependency is marked as optional.

    According to the Maven docs,

    If a user wants to use functionality related to an optional dependency, they will have to redeclare that optional dependency in their own project.