1 Star 0 Fork 15

rockyman/Spring-Kafka

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.gradle 16.28 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
buildscript {
ext.kotlinVersion = '1.5.31'
repositories {
mavenCentral()
gradlePluginPortal()
maven { url 'https://repo.spring.io/plugins-release' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion"
}
}
plugins {
id 'base'
id 'project-report'
id 'idea'
id 'org.sonarqube' version '2.8'
id 'org.ajoberstar.grgit' version '4.0.1' apply false
id 'io.spring.nohttp' version '0.0.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' apply false
id 'com.jfrog.artifactory' version '4.18.2' apply false
id 'org.asciidoctor.jvm.pdf' version '3.3.2'
id 'org.asciidoctor.jvm.gems' version '3.3.2'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
}
apply plugin: 'io.spring.nohttp'
def gitPresent = new File('.git').exists()
if(gitPresent) {
apply plugin: 'org.ajoberstar.grgit'
}
description = 'Spring for Apache Kafka'
ext {
linkHomepage = 'https://github.com/spring-projects/spring-kafka'
linkCi = 'https://build.spring.io/browse/SK'
linkIssue = 'https://github.com/spring-projects/spring-kafka/issues'
linkScmUrl = 'https://github.com/spring-projects/spring-kafka'
linkScmConnection = 'https://github.com/spring-projects/spring-kafka.git'
linkScmDevConnection = 'git@github.com:spring-projects/spring-kafka.git'
docResourcesVersion = '0.2.5'
javadocLinks = [
'https://docs.oracle.com/en/java/javase/17/docs/api/',
'https://docs.spring.io/spring-framework/docs/current/javadoc-api/'
] as String[]
if (gitPresent) {
modifiedFiles =
files(grgit.status().unstaged.modified).filter{ f -> f.name.endsWith('.java') || f.name.endsWith('.kt') }
}
assertjVersion = '3.22.0'
awaitilityVersion = '4.2.0'
googleJsr305Version = '3.0.2'
hamcrestVersion = '2.2'
hibernateValidationVersion = '7.0.4.Final'
jacksonBomVersion = '2.13.3'
jaywayJsonPathVersion = '2.6.0'
junit4Version = '4.13.2'
junitJupiterVersion = '5.8.2'
kafkaVersion = '3.2.0'
log4jVersion = '2.17.2'
micrometerVersion = '1.10.0-M2'
micrometerTracingVersion = '1.0.0-M5'
mockitoVersion = '4.5.1'
reactorVersion = '2020.0.19'
scalaVersion = '2.13'
springBootVersion = '2.6.7' // docs module
springDataVersion = '2022.0.0-M4'
springRetryVersion = '1.3.3'
springVersion = '6.0.0-M4'
zookeeperVersion = '3.6.3'
idPrefix = 'kafka'
}
nohttp {
source.include '**/src/**'
source.exclude '**/*.gif', '**/*.ks'
}
allprojects {
group = 'org.springframework.kafka'
apply plugin: 'io.spring.dependency-management'
dependencyManagement {
resolutionStrategy {
cacheChangingModulesFor 0, 'seconds'
}
applyMavenExclusions = false
generatedPomCustomization {
enabled = false
}
imports {
mavenBom "com.fasterxml.jackson:jackson-bom:$jacksonBomVersion"
mavenBom "org.junit:junit-bom:$junitJupiterVersion"
mavenBom "org.springframework:spring-framework-bom:$springVersion"
mavenBom "io.projectreactor:reactor-bom:$reactorVersion"
mavenBom "org.springframework.data:spring-data-bom:$springDataVersion"
mavenBom "io.micrometer:micrometer-bom:$micrometerVersion"
mavenBom "io.micrometer:micrometer-tracing-bom:$micrometerTracingVersion"
}
}
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/release' }
maven { url 'https://repo.spring.io/milestone' }
if (version.endsWith('SNAPSHOT')) {
maven { url 'https://repo.spring.io/snapshot' }
}
// maven { url 'https://repository.apache.org/content/groups/staging/' }
}
}
subprojects { subproject ->
apply plugin: 'java-library'
apply plugin: 'java'
apply from: "${rootProject.projectDir}/publish-maven.gradle"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
java {
withJavadocJar()
withSourcesJar()
registerFeature('optional') {
usingSourceSet(sourceSets.main)
}
registerFeature('provided') {
usingSourceSet(sourceSets.main)
}
}
compileJava {
sourceCompatibility = 17
targetCompatibility = 17
}
compileTestJava {
sourceCompatibility = 17
options.encoding = 'UTF-8'
}
compileTestKotlin {
kotlinOptions {
jvmTarget = '16'
}
}
eclipse.project.natures += 'org.springframework.ide.eclipse.core.springnature'
jacoco {
toolVersion = '0.8.7'
}
// dependencies that are common across all java projects
dependencies {
implementation "com.google.code.findbugs:jsr305:$googleJsr305Version"
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
// To avoid compiler warnings about @API annotations in JUnit code
testCompileOnly 'org.apiguardian:apiguardian-api:1.0.0'
testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion"
testImplementation 'org.jetbrains.kotlin:kotlin-reflect'
testImplementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
testImplementation("org.awaitility:awaitility:$awaitilityVersion") {
exclude group: 'org.hamcrest'
}
testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion"
optionalApi "org.assertj:assertj-core:$assertjVersion"
}
// enable all compiler warnings; individual projects may customize further
[compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all,-options']
test {
testLogging {
events "skipped", "failed"
showStandardStreams = project.hasProperty("showStandardStreams") ?: false
showExceptions = true
showStackTraces = true
exceptionFormat = 'full'
}
maxHeapSize = '1536m'
// jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:8111'
jacoco {
destinationFile = file("$buildDir/jacoco.exec")
}
useJUnitPlatform()
if (System.properties['sonar.host.url']) {
finalizedBy jacocoTestReport
}
}
checkstyle {
configDirectory.set(rootProject.file("src/checkstyle"))
toolVersion = '9.0'
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
html.enabled false
xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
}
}
publishing {
publications {
mavenJava(MavenPublication) {
suppressAllPomMetadataWarnings()
from components.java
pom.withXml {
def pomDeps = asNode().dependencies.first()
subproject.configurations.providedImplementation.allDependencies.each { dep ->
pomDeps.remove(pomDeps.'*'.find { it.artifactId.text() == dep.name })
pomDeps.appendNode('dependency').with {
it.appendNode('groupId', dep.group)
it.appendNode('artifactId', dep.name)
it.appendNode('version', dep.version)
it.appendNode('scope', 'provided')
}
}
}
}
}
}
task updateCopyrights {
onlyIf { gitPresent && !System.getenv('GITHUB_ACTION') && !System.getenv('bamboo_buildKey') }
if (gitPresent) {
inputs.files(modifiedFiles.filter { f -> f.path.contains(subproject.name) })
}
outputs.dir('build')
doLast {
def now = Calendar.instance.get(Calendar.YEAR) as String
inputs.files.each { file ->
def line
file.withReader { reader ->
while (line = reader.readLine()) {
def matcher = line =~ /Copyright (20\d\d)-?(20\d\d)?/
if (matcher.count) {
def beginningYear = matcher[0][1]
if (now != beginningYear && now != matcher[0][2]) {
def years = "$beginningYear-$now"
def sourceCode = file.text
sourceCode = sourceCode.replaceFirst(/20\d\d(-20\d\d)?/, years)
file.write(sourceCode)
println "Copyright updated for file: $file"
}
break
}
}
}
}
}
}
compileKotlin.dependsOn updateCopyrights
jar {
manifest {
attributes(
'Implementation-Version': archiveVersion,
'Created-By': "JDK ${System.properties['java.version']} (${System.properties['java.specification.vendor']})",
'Implementation-Title': subproject.name,
'Implementation-Vendor-Id': subproject.group,
'Implementation-Vendor': 'Pivotal Software, Inc.',
'Implementation-URL': linkHomepage,
'Automatic-Module-Name': subproject.name.replace('-', '.') // for Jigsaw
)
}
from("${rootProject.projectDir}/src/dist") {
include 'notice.txt'
into 'META-INF'
expand(copyright: new Date().format('yyyy'), version: project.version)
}
from("${rootProject.projectDir}") {
include 'LICENSE.txt'
into 'META-INF'
}
}
tasks.withType(Javadoc) {
options.addBooleanOption('Xdoclint:syntax', true) // only check syntax with doclint
options.addBooleanOption('Werror', true) // fail build on Javadoc warnings
}
}
project ('spring-kafka') {
description = 'Spring Kafka Support'
dependencies {
api 'org.springframework:spring-context'
api 'org.springframework:spring-messaging'
api 'org.springframework:spring-tx'
api ("org.springframework.retry:spring-retry:$springRetryVersion") {
exclude group: 'org.springframework'
}
api "org.apache.kafka:kafka-clients:$kafkaVersion"
optionalApi "org.apache.kafka:kafka-streams:$kafkaVersion"
optionalApi 'com.fasterxml.jackson.core:jackson-core'
optionalApi 'com.fasterxml.jackson.core:jackson-databind'
optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-joda'
optionalApi ('com.fasterxml.jackson.module:jackson-module-kotlin') {
exclude group: 'org.jetbrains.kotlin'
}
// Spring Data projection message binding support
optionalApi ("org.springframework.data:spring-data-commons") {
exclude group: 'org.springframework'
exclude group: 'io.micrometer'
}
optionalApi "com.jayway.jsonpath:json-path:$jaywayJsonPathVersion"
optionalApi 'io.projectreactor:reactor-core'
optionalApi 'io.projectreactor.kafka:reactor-kafka'
optionalApi 'io.micrometer:micrometer-core'
optionalApi 'io.micrometer:micrometer-tracing-api'
testImplementation project (':spring-kafka-test')
testImplementation 'io.projectreactor:reactor-test'
testImplementation "org.mockito:mockito-junit-jupiter:$mockitoVersion"
testImplementation "org.hibernate.validator:hibernate-validator:$hibernateValidationVersion"
testImplementation 'io.micrometer:micrometer-tracing-bridge-brave'
testImplementation 'io.micrometer:micrometer-tracing-test'
testImplementation 'io.micrometer:micrometer-tracing-integration-test'
}
}
project ('spring-kafka-test') {
description = 'Spring Kafka Test Support'
dependencies {
api 'org.springframework:spring-context'
api 'org.springframework:spring-test'
api ("org.springframework.retry:spring-retry:$springRetryVersion") {
exclude group: 'org.springframework'
}
api ("org.apache.zookeeper:zookeeper:$zookeeperVersion") {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'log4j'
}
api "org.apache.kafka:kafka-clients:$kafkaVersion:test"
api "org.apache.kafka:kafka-metadata:$kafkaVersion"
api "org.apache.kafka:kafka-streams-test-utils:$kafkaVersion"
api "org.apache.kafka:kafka_$scalaVersion:$kafkaVersion"
api "org.apache.kafka:kafka_$scalaVersion:$kafkaVersion:test"
api 'org.junit.jupiter:junit-jupiter-api'
optionalApi "org.hamcrest:hamcrest-core:$hamcrestVersion"
optionalApi "org.mockito:mockito-core:$mockitoVersion"
optionalApi ("junit:junit:$junit4Version") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
optionalApi "org.apache.logging.log4j:log4j-core:$log4jVersion"
}
}
project ('spring-kafka-docs') {
description = 'Spring Kafka Code Snippets For Docs'
dependencies {
api "org.springframework.boot:spring-boot-starter:$springBootVersion"
api project (':spring-kafka')
optionalApi 'org.jetbrains.kotlin:kotlin-stdlib'
optionalApi 'com.fasterxml.jackson.core:jackson-core'
optionalApi 'com.fasterxml.jackson.core:jackson-databind'
}
compileKotlin {
kotlinOptions {
jvmTarget = '16'
}
}
sonarqube {
skipProject = true
}
}
sonarqube {
properties {
property 'sonar.links.homepage', linkHomepage
property 'sonar.links.ci', linkCi
property 'sonar.links.issue', linkIssue
property 'sonar.links.scm', linkScmUrl
property 'sonar.links.scm_dev', linkScmDevConnection
}
}
configurations {
docs
}
dependencies {
docs "io.spring.docresources:spring-doc-resources:${docResourcesVersion}@zip"
}
task prepareAsciidocBuild(type: Sync) {
dependsOn configurations.docs
from {
configurations.docs.collect { zipTree(it) }
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from 'spring-kafka-docs/src/main/asciidoc/','spring-kafka-docs/src/main/java','spring-kafka-docs/src/main/kotlin'
into "$buildDir/asciidoc"
}
asciidoctorPdf {
dependsOn prepareAsciidocBuild
baseDirFollowsSourceFile()
configurations 'asciidoctorExt'
asciidoctorj {
sourceDir "$buildDir/asciidoc"
inputs.dir(sourceDir)
sources {
include 'index.adoc'
}
options doctype: 'book'
attributes 'icons': 'font',
'sectanchors': '',
'sectnums': '',
'toc': '',
'source-highlighter' : 'coderay',
revnumber: project.version,
'project-version': project.version
}
}
asciidoctorj {
version = '2.4.1'
// fatalWarnings ".*"
options doctype: 'book', eruby: 'erubis'
attributes([
icons: 'font',
idprefix: '',
idseparator: '-',
docinfo: 'shared',
revnumber: project.version,
sectanchors: '',
sectnums: '',
'source-highlighter': 'highlight.js',
highlightjsdir: 'js/highlight',
'highlightjs-theme': 'googlecode',
stylesdir: 'css/',
stylesheet: 'stylesheet.css',
'spring-version': project.version,
'project-version': project.version,
'java-examples': 'org/springframework/kafka/jdocs',
'kotlin-examples': 'org/springframework/kafka/kdocs'
])
}
asciidoctor {
dependsOn asciidoctorPdf
baseDirFollowsSourceFile()
configurations 'asciidoctorExt'
sourceDir = file("$buildDir/asciidoc")
sources {
include '*.adoc'
}
resources {
from(sourceDir) {
include 'images/*', 'css/**', 'js/**'
}
}
}
task reference(dependsOn: asciidoctor) {
group = 'Documentation'
description = 'Generate the reference documentation'
}
reference.onlyIf { "$System.env.NO_REFERENCE_TASK" != 'true' || project.hasProperty('ignoreEnvToStopReference') }
task api(type: Javadoc) {
group = 'Documentation'
description = 'Generates aggregated Javadoc API documentation.'
title = "${rootProject.description} ${version} API"
options {
encoding = 'UTF-8'
memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
author = true
header = rootProject.description
use = true
overview = 'src/api/overview.html'
splitIndex = true
links(project.ext.javadocLinks)
addBooleanOption('Xdoclint:syntax', true) // only check syntax with doclint
}
source subprojects.collect { project ->
project.sourceSets.main.allJava
}
classpath = files(subprojects.collect { project ->
project.sourceSets.main.compileClasspath
})
destinationDir = new File(buildDir, 'api')
}
task docsZip(type: Zip, dependsOn: [reference]) {
group = 'Distribution'
archiveClassifier = 'docs'
description = "Builds -${archiveClassifier} archive containing api and reference " +
"for deployment at static.spring.io/spring-kafka/docs."
from('src/dist') {
include 'changelog.txt'
}
from(api) {
into 'api'
}
from ('build/docs/asciidoc') {
into 'reference/html'
}
from ('build/docs/asciidocPdf') {
include 'index.pdf'
rename 'index.pdf', 'spring-kafka-reference.pdf'
into 'reference/pdf'
}
}
task distZip(type: Zip, dependsOn: [docsZip]) { //, schemaZip]) {
group = 'Distribution'
archiveClassifier = 'dist'
description = "Builds -${archiveClassifier} archive, containing all jars and docs, " +
"suitable for community download page."
ext.baseDir = "${project.name}-${project.version}"
from('src/dist') {
include 'readme.txt'
include 'notice.txt'
into "${baseDir}"
}
from("$project.rootDir") {
include 'LICENSE.txt'
into "${baseDir}"
}
from(zipTree(docsZip.archivePath)) {
into "${baseDir}/docs"
}
subprojects.each { subproject ->
into ("${baseDir}/libs") {
from subproject.jar
from subproject.sourcesJar
from subproject.javadocJar
}
}
}
artifacts {
archives distZip
archives docsZip
}
task dist(dependsOn: assemble) {
group = 'Distribution'
description = 'Builds -dist, -docs distribution archives.'
}
apply from: "${rootProject.projectDir}/publish-maven.gradle"
publishing {
publications {
mavenJava(MavenPublication) {
artifact docsZip
artifact distZip
}
}
}
apply from: "${rootDir}/gradle/docs.gradle"
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/rockygitee/Spring-Kafka.git
git@gitee.com:rockygitee/Spring-Kafka.git
rockygitee
Spring-Kafka
Spring-Kafka
main

搜索帮助