https://kotlinlang.org logo
Title
u

ursus

04/15/2020, 9:58 PM
then why do I still see it, if the lib includes the gson via
implementation
anyways?
o

octylFractal

04/15/2020, 9:59 PM
implementation
only affects consumers of your program, not of the library mentioned in the declaration
i.e. if someone depended on your code, they would not see the 3rd party lib or GSON
it does not control if the 3rd party lib leaks its transitive dependencies to your compile classpath, which it clearly does. there's not much you can do to fix this besides asking them to properly separate their transitive dependencies (I don't recommend blindling excluding transitive dependencies since they won't end up on your runtime classpath without careful handling)
u

ursus

04/15/2020, 10:01 PM
okay so youre saying A > B > C, if B includes implementation of C, then A wont see C right?
o

octylFractal

04/15/2020, 10:01 PM
yes, if
B
had
implementation(C)
,
A
would not see
C
but if
B
is e.g. a maven project and declares a normal dependency on
C
, then
A
having
implementation(B)
would still allow it to see
C
u

ursus

04/15/2020, 10:02 PM
okay, but this still doesnt explain it why does B sees Gson if its B > C > Gson
if C.implementation(Gson)
(C is the 3rd party lib)
o

octylFractal

04/15/2020, 10:02 PM
are you sure that
C
has
implementation(Gson)
?
u

ursus

04/15/2020, 10:03 PM
and in my build.gradle ,
implementation "com.exponea.sdk:sdk:2.4.0"}
o

octylFractal

04/15/2020, 10:09 PM
hmm, I'm not sure why, but the real source of truth is the pom.xml: https://repo1.maven.org/maven2/com/exponea/sdk/sdk/2.7.2/sdk-2.7.2.pom which clearly states that everything is in the compile scope, not the runtime scope, meaning it will be included on your compile classpath
typically using
implementation
will result in the published pom.xml having a scope of
runtime
for those dependencies, but maybe that only happens if the
java-library
plugin is applied to the project
u

ursus

04/15/2020, 10:10 PM
okay, so, if I implementation exponea, when I should only see exponea own code, not its dependencies, right?
(if all went well, just to clarify)
o

octylFractal

04/15/2020, 10:11 PM
pretty much, since it declares no
api
dependencies -- if it did you would see those
u

ursus

04/15/2020, 10:12 PM
okay so atleast I understood it correctly all along. Im going to open up a ticket with them, thank you!