Last active
September 28, 2021 06:58
-
-
Save peter-y/d9fff60f9b52d93f3698c15f086b3323 to your computer and use it in GitHub Desktop.
build.gradle #template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.nio.charset.StandardCharsets | |
plugins { | |
//使用maven的依赖管理方式 来管理依赖 引入插件 | |
id "io.spring.dependency-management" version "1.0.11.RELEASE" apply false | |
id "io.freefair.lombok" version "6.2.0" apply false | |
} | |
//声明包装产生的类型和版本 | |
wrapper { | |
distributionType = Wrapper.DistributionType.ALL | |
gradleVersion = "7.2" | |
} | |
ext { | |
//变量声明方式 | |
lombokVersion = '1.18.20' | |
junitVersion = '5.8.0' | |
logbackVsersion = '1.2.6' | |
} | |
//设置 all 和 sub 多模块之后 java 依赖需要在 projects 中声明 | |
allprojects { | |
apply plugin: 'java' | |
apply plugin: 'io.freefair.lombok' | |
// apply plugin: 'war' | |
group 'org.example' | |
version "${multithreadedVersion}" | |
//java 版本 | |
sourceCompatibility = JavaVersion.VERSION_11 | |
targetCompatibility = JavaVersion.VERSION_11 | |
//字符集 或者设置 system_environment_variables GRADLE_OPTS=-Dfile.encoding=utf-8 | |
compileJava.options.encoding = StandardCharsets.UTF_8.displayName() | |
compileTestJava.options.encoding = StandardCharsets.UTF_8.displayName() | |
javadoc.options.encoding = StandardCharsets.UTF_8.displayName() | |
repositories { | |
google() | |
mavenCentral() | |
mavenLocal() | |
} | |
dependencies { | |
//注意这里引用使用的是双引号 | |
testImplementation(platform("org.junit:junit-bom:$junitVersion")) | |
testImplementation('org.junit.jupiter:junit-jupiter:5.8.0') | |
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.32' | |
implementation group: 'ch.qos.logback', name: 'logback-classic', version: "$logbackVsersion" | |
implementation group: 'ch.qos.logback', name: 'logback-core', version: "$logbackVsersion" | |
} | |
} | |
subprojects { | |
dependencies { | |
implementation group: 'org.openjdk.jol', name: 'jol-core', version: '0.16' | |
} | |
test { | |
maxParallelForks = 4 | |
useJUnitPlatform() | |
testLogging { | |
showExceptions = true | |
showCauses = true | |
showStackTraces = true | |
showStandardStreams = true | |
displayGranularity = 0 | |
events = ["PASSED", "SKIPPED", "FAILED", "STANDARD_ERROR", "STANDARD_OUT", "STARTED"] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment