我在项目io.dengchao.generic.server.util.IdWorker
和项目common
app
中创建了一个名为compile project(':common')
的类。
root build.gradle:
group 'generic-server'
version '1.0.0-dev'
buildscript {
repositories {
maven { url = "http://maven.aliyun.com/nexus/content/groups/public" }
jcenter()
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.2.RELEASE")
}
}
subprojects { project ->
println(project.name)
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
sourceCompatibility = 1.8
repositories {
maven { url = "http://maven.aliyun.com/nexus/content/groups/public" }
jcenter()
mavenCentral()
}
}
root settings.gradle:
rootProject.name = 'generic-server'
include 'app', 'common'
common build.gradle:
dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation("org.springframework.boot:spring-boot-starter-test")
compile 'org.jetbrains:annotations:15.0'
compile("org.springframework.boot:spring-boot-starter-data-rest")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.springframework.boot:spring-boot-starter-aop")
compile("org.springframework.boot:spring-boot-starter-security")
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-actuator
compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
compileOnly "org.springframework.boot:spring-boot-configuration-processor"
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
compile 'mysql:mysql-connector-java'
}
compileJava.dependsOn(processResources)
//bootJar.dependsOn(test)
app build.gradle:
bootJar {
baseName = 'generic-server'
version = '1.0'
}
dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation("org.springframework.boot:spring-boot-starter-test")
// http://blog.csdn.net/wm5920/article/details/76566095
// https://mvnrepository.com/artifact/com.googlecode.log4jdbc/log4jdbc
testImplementation 'com.googlecode.log4jdbc:log4jdbc:1.2'
compile project(':common')
}
gradle wrapper:'4.6-all'和'4.8-all'都试过。