https://kotlinlang.org logo
#spring
Title
b

bjonnh

04/25/2019, 4:12 PM
I was also missing the dependency management plugin
c

Czar

04/25/2019, 4:16 PM
I think you also need spring milestone repository in
settings.gradle.kts
for plugin resolution.
b

bjonnh

04/25/2019, 4:18 PM
yes I have both of them
Now it seems that I broke the full kotlin…
Plugin [id: 'org.jetbrains.kotlin.jvm'] was not found in any of the following sources: - Gradle Core Plugins (plugin is not in 'org.gradle' namespace) - Plugin Repositories (plugin dependency must include a version number for this source)
c

Czar

04/25/2019, 4:24 PM
Don't know why that error message, but not specifying version for kotlin plugin and specifying it for kotlin compiler plugins can lead to a conflict. Those need to be in sync.
kotlin("jvm") version kotlinVersion
b

bjonnh

04/25/2019, 4:24 PM
it is because it is a subproject
so it explicitly tells me not to put it
the main build.gradle.kts has a version
kotlin("jvm") version "1.3.30"
maybe my settings.gradle is overwriting some default plugin repository?
c

Czar

04/25/2019, 4:25 PM
plugins
block must be specified in the root project
in subprojects you just apply the plugins
b

bjonnh

04/25/2019, 4:26 PM
pluginManagement { repositories { maven { url 'https://repo.spring.io/snapshot' } maven { url 'https://repo.spring.io/milestone' } gradlePluginPortal() } resolutionStrategy { eachPlugin { if (requested.id.id == 'org.springframework.boot') { useModule("org.springframework.bootspring boot gradle plugin${requested.version}") } if (requested.id.id == "kotlin-multiplatform") { useModule("org.jetbrains.kotlinkotlin gradle plugin${requested.version}") } if (requested.id.id == "kotlinx-serialization") { useModule("org.jetbrains.kotlinkotlin serialization${requested.version}") } } } }
yep well it used to work before I changed to the 2.2.0
so clearly there is something I did that is not right
c

Czar

04/25/2019, 4:26 PM
if you do not need a plugin in root project but only need it in sub, you define it with
apply false
in the root project and apply in subprojects where necessary
b

bjonnh

04/25/2019, 4:26 PM
I'm talking about kotlin here…
If I don't have kotlin("jvm") in my sub project, I can't even get gradle to load my build.gradle.kts
so my hypothesis now is that I messed up something in the settings.gradle
c

Czar

04/25/2019, 4:28 PM
your setup seems not correct to me, I've explained why, if you think I'm wrong, well good luck, I can't help 🙂
b

bjonnh

04/25/2019, 4:30 PM
I don't understand what is wrong from what you said
I have : plugins { kotlin("jvm") version "1.3.30" apply false } in my base project
plugins { kotlin("jvm") } in my sub projects.
(with additional plugins when needed
I removed stuff I had on the base project that I was not using so now I was able to "apply false" the plugin on the base project. And now it works
but I don't really get why
aren't they supposed to all use the same version?
it seems that removing the dokka tasks I had in the root project is what made it work (removing the apply false still make the project compile)
c

Czar

04/25/2019, 4:35 PM
what version of gradle are you working on? apparently I lag behind a bit and
plugins {}
blocks are now supported in subprojects
b

bjonnh

04/25/2019, 4:35 PM
latest included with the EAP intelliJ
4.10 maybe
c

Czar

04/25/2019, 4:36 PM
that's important, check please, 4.10 is a dinosaur in terms of kotlin-dsl support
you can run
./gradlew -version
b

bjonnh

04/25/2019, 4:37 PM
nevermind 5.2.1
I have various projects working with Boot 2.2.0.M2 and Gradle Kotlin DSL
b

bjonnh

04/25/2019, 4:42 PM
yep looks like what I have
it works now
c

Czar

04/25/2019, 4:42 PM
Ok, with that plugins are specified like this: * in root project you specify all plugins which are to be used in the build, including all the plugins only subprojects will use * those plugins that are not needed in the root project you specify with
apply false
* in subprojects you specify the plugins that need to be applied without version * buildscript with repository you have in the snippet in theory does nothing and can be removed.
s

sdeleuze

04/25/2019, 4:43 PM
Oh ok
What was missing?
b

bjonnh

04/25/2019, 4:43 PM
I have no idea
just disabling dokka and its task in the root module seems to have made it
I didn't need it anyway there…
s

sdeleuze

04/25/2019, 4:43 PM
Oh Dokka is another thing
Let me find the link
b

bjonnh

04/25/2019, 4:44 PM
@Czar Ok I'll move all my modules down at root then
Dokka 0.9.18 now requires additional repositories, see the thead for more details
Not sure if that's related but worth to know
I hope they will change that confusing requirement
Gradle Kotlin DSL will be shortly supported on start.spring.io
b

bjonnh

04/25/2019, 4:46 PM
I switched to orchid to generate my docs anyway so I don't use dokka directly anymore
it was an old remnant
Now that I moved spring boot plugins declaration to the root
it cannot find the right versions in the submodule…
I'll compare with your spring-fu
see what I missed
what is that: imports { mavenBom("org.springframework.bootspring boot dependencies$bootVersion") }
s

sdeleuze

04/25/2019, 5:04 PM
Spring Fu is not a Boot app itself so that's not relevant for your use case
b

bjonnh

04/25/2019, 5:05 PM
I'm completely lost now
I tried to move the plugins to the root project
but now it cannot find spring boot for the subprojects
s

sdeleuze

04/25/2019, 5:06 PM
I think the easier way for others to help you is to share the structure of your project in a repo
Otherwise it will be frustrating for everybody
yeah I'll make a repo
I moved the repositories back to the root project
s

sdeleuze

04/25/2019, 5:11 PM
Thanks I will have a look later (currently away from keyboard)
b

bjonnh

04/25/2019, 5:12 PM
thx
I'll continue working on it and updating the repo
ok I forgot to include the plugin in the subprojects
sorry for the disturbance…
I really have a hard time wrapping my head around gradle
and thanks both of you for the help!
s

sdeleuze

04/25/2019, 5:28 PM
So that works now?
b

bjonnh

04/25/2019, 5:31 PM
YES ! \o/
6 Views