The peacetrue-gradle-plugin
is used to configure Java projects according to conventions and automatically prepare the test environment. The conventions are as follows:
-
Apply the
JavaLibraryPlugin
to all projects. -
Configure the use of
JUnitPlatform
in all projects. -
Add the test library
org.junit.jupiter:junit-jupiter-engine
in sub-projects. -
Apply the
JacocoPlugin
to sub-projects. -
If it is a multi-project repository, apply the
TestReportAggregationPlugin
andJacocoReportAggregationPlugin
to the root project.
Note
|
A repository may contain one or more projects. If it contains only one project, the root project is considered a sub-project. |
Multiple Java projects often require similar configurations. Using a plugin can help standardize these configurations.
From the mavenCentral (real-time):
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "com.github.peacetrue.gradle:peacetrue-gradle-plugin:{latest-version}"
}
}
apply plugin: "io.github.peacetrue.build-convention"
From the gradlePluginPortal (delayed, subject to approval):
plugins {
id "io.github.peacetrue.build-convention" version "{latest-version}"
}
Or:
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath "io.github.peacetrue:peacetrue-gradle-plugin:{latest-version}"
}
}
apply plugin: "io.github.peacetrue.build-convention"
Check the version badge at the top of the page for the latest version.
-
peacetrue(xiayouxue@hotmail.com)