Java Gradle マルチプロジェクト作成方法
プロジェクト構成
multi-sample +--- sample-common +--- sample-core (sample-commonに依存)
- multi-sampleの直下でGradleによるプロジェクト初期化
gradle init
- settings.gradleを編集
rootProject.name = 'multi-sample' include "sample-common", "sample-core"
- build.gradleを編集
subprojects {
apply plugin: 'eclipse'
apply plugin: 'java'
apply plugin: 'idea'
def defaultEncoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.encoding = defaultEncoding
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
project.ext {
authorName = 'YOUR NAME'
dropwizardVersion = 'バージョン'
}
repositories {
mavenCentral()
}
dependencies {
compile "io.dropwizard:dropwizard-core:${dropwizardVersion}"
}
version = '1.0'
task wrapper(type: Wrapper) {
gradleVersion = '2.14'
}
}
project(':sample-common') {
}
project(':sample-core') {
dependencies {
compile project(':sample-common')
}
}
gradle eclipseを叩く