I have a Kotlin project, which consists of three modules:
Core < Service < Web
Structure:
build.gradle
core/
build.gradle
service/
build.gradle
web/
build.gradle
The structure of the root file build.gradle:
buildscript {
ext.kotlin_version = '1.1.60'
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
subprojects {
apply plugin: 'kotlin'
apply plugin: 'jacoco'
compileKotlin {
kotlinOptions.jvmTarget = '1.8'
}
repositories {
mavenCentral()
jcenter()
}
}
Separate assembly files look like (for core):
dependencies {
// Kotlin
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
...
}
And for service(note that the only difference depends on the project):
dependencies {
compile project (':core')
// Kotlin
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
...
}
There are a few optimizations that I would like to do, but I'm still learning Gradle and can't find the right way to reorganize things. I have a problem's:
I cannot create serviceeither webindividually, as they complain that they cannot find their dependent subprojects. (For example, through gradle buildthe directory service/).
Kotlin stdlib-jre8 , ?
/buildscript , mavenCentral()/jcenter()?
, , , /-, , , , , ( 1) Gradle, (2) - IDEA.