hello everyone - I was wondering if anyone here ha...
# gradle
t
hello everyone - I was wondering if anyone here has any experience setting up a multi-module Spring Boot project using Gradle Kotlin DSL
x
I would suggest using a composite build instead of a multi-module
that means each "sub module" stands alone if you want it to
here's my root project relevant code this is my root project
build.gradle.kts
Copy code
import org.gradle.api.credentials.AwsCredentials
import org.gradle.internal.impldep.com.fasterxml.jackson.databind.AnnotationIntrospector.pair
import org.gradle.kotlin.dsl.maven
import org.gradle.kotlin.dsl.repositories
import org.gradle.kotlin.dsl.creating
import org.gradle.kotlin.dsl.support.illegalElementType
import org.gradle.model.internal.core.TypeCompatibilityModelProjectionSupport.description
import org.gradle.plugins.ide.idea.model.IdeaModel
import org.gradle.plugins.ide.idea.model.IdeaProject
import java.lang.System

plugins {
    `idea`
    id("com.brightsparklabs.gradle.multi-git").version("1.3.0")
}

group = "com.xenoterracide.rpf"
version = "0.1.0-SNAPSHOT"

multiGitPluginConfig {
    repositoriesDir = file("lib")
    repositories = mapOf(
        Pair("constants", "<mailto:git@bitbucket.org|git@bitbucket.org>:xenworks/rpf-constants.git"),
        Pair("is", "<mailto:git@bitbucket.org|git@bitbucket.org>:xenworks/rpf-infrastructure-services.git"),
        Pair("http-config", "<mailto:git@bitbucket.org|git@bitbucket.org>:xenworks/rpf-http-config.git"),
        Pair("sec", "<mailto:git@bitbucket.org|git@bitbucket.org>:xenworks/rpf-security.git"),
        Pair("sec-dtos", "<mailto:git@bitbucket.org|git@bitbucket.org>:xenworks/rpf-security-dtos.git"),
        Pair("sec-user-authn", "<mailto:git@bitbucket.org|git@bitbucket.org>:xenworks/rpf-user-authn.git"),
        Pair("sec-user-reg", "<mailto:git@bitbucket.org|git@bitbucket.org>:xenworks/rpf-registration.git"),
        Pair("api-root", "<mailto:git@bitbucket.org|git@bitbucket.org>:xenworks/api-root.git"),
        Pair("changeset", "<mailto:git@bitbucket.org|git@bitbucket.org>:xenworks/rpf-db-changeset.git"),
        Pair("pdf", "<mailto:git@bitbucket.org|git@bitbucket.org>:xenworks/rpf-pdf.git"),
        Pair("app", "<mailto:git@bitbucket.org|git@bitbucket.org>:xenworks/rpf-app.git" )
    )
}

tasks {
    "build" {
        if (gradle.includedBuilds.isEmpty()) {
            dependsOn("gitClone")
            println("run build again to actually build!")
        } else {
            gradle.includedBuilds.forEach({ dependsOn(it.task(":build")) })
        }
    }
}
settings.gradle.kts
Copy code
import org.gradle.internal.nativeintegration.filesystem.DefaultFileMetadata.file

rootProject.name = "rpf"
var cwd = file(".")
file("lib")
    .listFiles(File::isDirectory)
    .filter({ it.walkTopDown().maxDepth(1).any { it.name.startsWith("settings.gradle") } })
    .forEach({ includeBuild(it.toRelativeString(cwd)) })
each of the sub projects is just a normal project
t
this is awesome - thank you @xenoterracide!
x
I also have some more vanilla gradle.build.kts here https://bitbucket.org/account/user/xenworks/projects/FLOSS
and have started extracting my shared settings into a kotlin build, but java based plugins here