https://kotlinlang.org logo
Title
b

Bruno_

03/17/2019, 12:18 PM
what's the difference between
"implementation"
and
implementation
? either I can't use search engine or noone explains it https://docs.gradle.org/5.0/userguide/multi_project_builds.html#sec:project_jar_dependencies
d

Dominaezzz

03/17/2019, 12:20 PM
They do the same thing.
b

Bruno_

03/17/2019, 12:45 PM
@Dominaezzz in the end, yeah they should. The thing is if I extract dependencies block to .gradle.kts I can't use the latter one without applying plugins. I've asked because I don't understand how it works and when to use it
d

Dominaezzz

03/17/2019, 12:49 PM
The latter is quite limited as every possible string isn't statically defined. Only
implemention
,
api
,
compile
, etc. You don't get
testImplementation
but you can work-around that with
"testImplementation"
. I think of the former as a work-around.
g

gildor

03/17/2019, 12:59 PM
This is not a "workaround", string version is default way to define dependency in configuration, type safe version is available only when you applied plugin, so Gradle knows exactly which configurations are available in this plugin, so it may generate type safe accessors
For your example above you cannot use type safe accessors
d

Dico

03/17/2019, 1:01 PM
Think you need to use special plugins {} block no?
g

gildor

03/17/2019, 1:02 PM
This wouldn't be something different
Because in this case you apply configurations for submodules, so there is no type safety
Even if you would have type safe accessor in your root project because applied plugin, using it for submodules wouldn't be safe
But I wouldn't say this is something wrong, it's completely valid case, and Gradle doesn't pretend that you can use type safe accessors when cannot prove that it's actually type safe
There are some other approaches about extracting common configuration and using plugins, but it's another topic