diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index 9f155d9..9f280c1 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -29,6 +29,7 @@ jobs: env: ORG_GRADLE_PROJECT_repoUsername: ${{ secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_repoPassword: ${{ secrets.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_snapshotRepoUrl: "https://central.sonatype.com/repository/maven-snapshots/" ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3b5be9e..6d32a49 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,9 +63,10 @@ jobs: run: ./gradlew build - name: Publish release package env: + ORG_GRADLE_PROJECT_releaseRepoUrl: "https://ossrh-staging-api.central.sonatype.com/service/local/" ORG_GRADLE_PROJECT_repoUsername: ${{ secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_repoPassword: ${{ secrets.SONATYPE_PASSWORD }} ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} - run: ./gradlew publish + run: ./gradlew publishToSonatype closeSonatypeStagingRepository diff --git a/README.md b/README.md index 3ea04da..71b31b4 100644 --- a/README.md +++ b/README.md @@ -50,10 +50,10 @@ | 依赖 | 版本 | | ------------ |----------| | JDK | 17 | -| Kotlin | 1.8.22 | -| Gradle | 7.6.3 | -| Spring Boot | 3.0.11 | -| Spring Cloud | 2022.0.4 | +| Kotlin | 2.0.21 | +| Gradle | 8.10.2 | +| Spring Boot | 3.4.0 | +| Spring Cloud | 2024.0.0 | ## 示例 diff --git a/build.gradle.kts b/build.gradle.kts index 01eedb0..90c597a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,8 @@ +import org.gradle.api.publish.maven.MavenPublication +import org.gradle.api.publish.maven.tasks.PublishToMavenRepository +import org.gradle.plugins.signing.Sign + description = "Tencent BlueKing DevOps Framework Build" @@ -11,7 +15,7 @@ plugins { id("com.tencent.devops.publish") version Versions.DevopsReleasePlugin } -val projectVersion = rootProject.file("version.txt").readText() +val projectVersion = rootProject.file("version.txt").readText().trim() allprojects { group = "com.tencent.devops" @@ -24,6 +28,10 @@ allprojects { gradlePluginPortal() } + tasks.withType().configureEach { + dependsOn(tasks.withType(Sign::class.java)) + } + publishing { publications { withType { diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index cdf25fb..b09f5a8 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -5,7 +5,7 @@ object Libs { const val SpringBootGradlePlugin = "org.springframework.boot:spring-boot-gradle-plugin:${Versions.SpringBoot}" const val DependencyManagement = "io.spring.gradle:dependency-management-plugin:${Versions.DependencyManagement}" const val KotlinSpringGradlePlugin = "org.jetbrains.kotlin:kotlin-allopen:${Versions.Kotlin}" - const val KtLint = "com.pinterest:ktlint:${Versions.KtLint}" + const val KtLint = "com.pinterest.ktlint:ktlint-cli:${Versions.KtLint}" const val GoogleJibPlugin = "gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:${Versions.Jib}" const val GradleNexuxPublishPlugin = "io.github.gradle-nexus:publish-plugin:${Versions.GradleNexusPublish}" } @@ -15,4 +15,3 @@ object MavenBom { const val SpringCloud = "org.springframework.cloud:spring-cloud-dependencies:${Versions.SpringCloud}" const val DevOpsBoot = ":devops-boot-project:devops-boot-dependencies" } - diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index e4eec53..cfaffa9 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -1,11 +1,11 @@ object Versions { const val Jib: String = "3.2.0" const val Java = "17" - const val Kotlin = "1.8.22" - const val SpringBoot = "3.3.2" - const val SpringCloud = "2023.0.3" + const val Kotlin = "2.0.21" + const val SpringBoot = "3.4.0" + const val SpringCloud = "2024.0.0" const val DependencyManagement = "1.1.6" const val GradleNexusPublish = "1.3.0" - const val KtLint = "0.50.0" + const val KtLint = "1.3.1" const val DevopsReleasePlugin = "0.0.9" } diff --git a/buildSrc/src/main/kotlin/ktlint.gradle.kts b/buildSrc/src/main/kotlin/ktlint.gradle.kts index 6a46ae1..836e554 100644 --- a/buildSrc/src/main/kotlin/ktlint.gradle.kts +++ b/buildSrc/src/main/kotlin/ktlint.gradle.kts @@ -8,7 +8,7 @@ dependencies { } } -val outputDir = "${project.buildDir}/reports/ktlint/" +val outputDir = "${project.layout.buildDirectory}/reports/ktlint/" val inputFiles = project.fileTree(mapOf("dir" to "src", "include" to "**/*.kt")) val ktlintCheck by tasks.creating(JavaExec::class) { @@ -18,7 +18,7 @@ val ktlintCheck by tasks.creating(JavaExec::class) { description = "Check Kotlin code style." classpath = ktlint - main = "com.pinterest.ktlint.Main" + mainClass.set("com.pinterest.ktlint.Main") args = listOf("src/**/*.kt") } @@ -29,6 +29,6 @@ val ktlintFormat by tasks.creating(JavaExec::class) { description = "Fix Kotlin code style deviations." classpath = ktlint - main = "com.pinterest.ktlint.Main" + mainClass.set("com.pinterest.ktlint.Main") args = listOf("-F", "src/**/*.kt") } diff --git a/devops-boot-project/devops-boot-core/build.gradle.kts b/devops-boot-project/devops-boot-core/build.gradle.kts index 61e096f..bca7476 100644 --- a/devops-boot-project/devops-boot-core/build.gradle.kts +++ b/devops-boot-project/devops-boot-core/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + plugins { kotlin("jvm") kotlin("kapt") @@ -36,17 +38,24 @@ subprojects { targetCompatibility = Versions.Java } compileKotlin { - kotlinOptions.freeCompilerArgs = listOf("-Xjsr305=strict", "-java-parameters") - kotlinOptions.jvmTarget = Versions.Java + compilerOptions { + freeCompilerArgs.add("-Xjsr305=strict") + freeCompilerArgs.add("-java-parameters") + jvmTarget.set(JvmTarget.fromTarget(Versions.Java)) + } } compileTestKotlin { - kotlinOptions.jvmTarget = Versions.Java + compilerOptions { + jvmTarget.set(JvmTarget.fromTarget(Versions.Java)) + } } test { useJUnitPlatform() } withType(org.jetbrains.kotlin.gradle.internal.KaptGenerateStubsTask::class.java).configureEach { - kotlinOptions.jvmTarget = Versions.Java + compilerOptions { + jvmTarget.set(JvmTarget.fromTarget(Versions.Java)) + } } } } diff --git a/devops-boot-project/devops-boot-core/devops-circuitbreaker/src/main/resources/META-INF/spring.factories b/devops-boot-project/devops-boot-core/devops-circuitbreaker/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 95be97b..0000000 --- a/devops-boot-project/devops-boot-core/devops-circuitbreaker/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.tencent.devops.circuitbreaker.CircuitBreakerAutoConfiguration diff --git a/devops-boot-project/devops-boot-core/devops-circuitbreaker/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/devops-boot-project/devops-boot-core/devops-circuitbreaker/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..c72430e --- /dev/null +++ b/devops-boot-project/devops-boot-core/devops-circuitbreaker/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.tencent.devops.circuitbreaker.CircuitBreakerAutoConfiguration \ No newline at end of file diff --git a/devops-boot-project/devops-boot-core/devops-loadbalancer/src/main/resources/META-INF/spring.factories b/devops-boot-project/devops-boot-core/devops-loadbalancer/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 54e3d1f..0000000 --- a/devops-boot-project/devops-boot-core/devops-loadbalancer/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.tencent.devops.loadbalancer.LoadBalancerAutoConfiguration diff --git a/devops-boot-project/devops-boot-core/devops-loadbalancer/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/devops-boot-project/devops-boot-core/devops-loadbalancer/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..e5f7721 --- /dev/null +++ b/devops-boot-project/devops-boot-core/devops-loadbalancer/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.tencent.devops.loadbalancer.LoadBalancerAutoConfiguration \ No newline at end of file diff --git a/devops-boot-project/devops-boot-core/devops-logging/src/main/kotlin/com/tencent/devops/logging/LoggingAutoConfiguration.kt b/devops-boot-project/devops-boot-core/devops-logging/src/main/kotlin/com/tencent/devops/logging/LoggingAutoConfiguration.kt index abfe600..5abd0af 100644 --- a/devops-boot-project/devops-boot-core/devops-logging/src/main/kotlin/com/tencent/devops/logging/LoggingAutoConfiguration.kt +++ b/devops-boot-project/devops-boot-core/devops-logging/src/main/kotlin/com/tencent/devops/logging/LoggingAutoConfiguration.kt @@ -1,11 +1,13 @@ package com.tencent.devops.logging import com.tencent.devops.logging.props.DevopsLoggingProperties +import com.tencent.devops.logging.system.DevopsLoggingApplicationListener import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication import org.springframework.boot.context.properties.EnableConfigurationProperties +import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @Configuration(proxyBeanMethods = false) @ConditionalOnWebApplication @EnableConfigurationProperties(DevopsLoggingProperties::class) -class LoggingAutoConfiguration +class LoggingAutoConfiguration \ No newline at end of file diff --git a/devops-boot-project/devops-boot-core/devops-logging/src/main/resources/META-INF/spring.factories b/devops-boot-project/devops-boot-core/devops-logging/src/main/resources/META-INF/spring.factories index c40d86e..c5c3518 100644 --- a/devops-boot-project/devops-boot-core/devops-logging/src/main/resources/META-INF/spring.factories +++ b/devops-boot-project/devops-boot-core/devops-logging/src/main/resources/META-INF/spring.factories @@ -1,4 +1,2 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.tencent.devops.logging.LoggingAutoConfiguration org.springframework.context.ApplicationListener=\ com.tencent.devops.logging.system.DevopsLoggingApplicationListener diff --git a/devops-boot-project/devops-boot-core/devops-logging/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/devops-boot-project/devops-boot-core/devops-logging/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..80f0758 --- /dev/null +++ b/devops-boot-project/devops-boot-core/devops-logging/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.tencent.devops.logging.LoggingAutoConfiguration diff --git a/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/core/PluginLoader.kt b/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/core/PluginLoader.kt index 011ad74..49a16a8 100644 --- a/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/core/PluginLoader.kt +++ b/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/core/PluginLoader.kt @@ -4,8 +4,8 @@ import com.tencent.devops.plugin.api.EXTENSION_LOCATION import com.tencent.devops.plugin.api.ExtensionType import com.tencent.devops.plugin.api.PluginInfo import com.tencent.devops.plugin.api.PluginMetadata -import org.springframework.boot.loader.launch.LaunchedClassLoader import org.springframework.boot.loader.launch.Archive +import org.springframework.boot.loader.launch.LaunchedClassLoader import java.io.IOException import java.net.URL import java.nio.file.Files @@ -115,9 +115,10 @@ class PluginLoader( } private fun createClassloader(pluginPath: Path): ClassLoader { - val jarArchive = Archive.create(pluginPath.toFile()) + val pluginFile = pluginPath.toFile() + val jarArchive = Archive.create(pluginFile) val archives = jarArchive.getClassPathUrls(includeFilter, directorySearchFilter) - val urls = mutableListOf() + val urls = mutableListOf(pluginFile.toURI().toURL()) archives.forEach { urls.add(it) } diff --git a/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/spring/SpringExtensionRegistry.kt b/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/spring/SpringExtensionRegistry.kt index 753eb98..6393257 100644 --- a/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/spring/SpringExtensionRegistry.kt +++ b/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/spring/SpringExtensionRegistry.kt @@ -30,7 +30,10 @@ class SpringExtensionRegistry : ExtensionRegistry, ApplicationContextAware { require(WebApplicationContext::class.java.isAssignableFrom(applicationContext::class.java)) this.applicationContext = applicationContext this.beanFactory = applicationContext.autowireCapableBeanFactory as DefaultListableBeanFactory - this.requestMappingHandlerMapping = applicationContext.getBean(RequestMappingHandlerMapping::class.java) + this.requestMappingHandlerMapping = applicationContext.getBean( + "requestMappingHandlerMapping", + RequestMappingHandlerMapping::class.java + ) } override fun registerExtensionController(plugin: String, name: String, type: Class<*>) { diff --git a/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/resources/META-INF/spring.factories b/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 6e4189c..0000000 --- a/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,3 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.tencent.devops.plugin.PluginAutoConfiguration,\ -com.tencent.devops.plugin.spring.PluginEndpointAutoConfiguration diff --git a/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..c4bf7ef --- /dev/null +++ b/devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,2 @@ +com.tencent.devops.plugin.PluginAutoConfiguration +com.tencent.devops.plugin.spring.PluginEndpointAutoConfiguration \ No newline at end of file diff --git a/devops-boot-project/devops-boot-core/devops-pulsar/src/main/kotlin/com/tencent/devops/stream/binder/pulsar/convert/PulsarMessageConverter.kt b/devops-boot-project/devops-boot-core/devops-pulsar/src/main/kotlin/com/tencent/devops/stream/binder/pulsar/convert/PulsarMessageConverter.kt index f2f708e..4291df9 100644 --- a/devops-boot-project/devops-boot-core/devops-pulsar/src/main/kotlin/com/tencent/devops/stream/binder/pulsar/convert/PulsarMessageConverter.kt +++ b/devops-boot-project/devops-boot-core/devops-pulsar/src/main/kotlin/com/tencent/devops/stream/binder/pulsar/convert/PulsarMessageConverter.kt @@ -71,7 +71,7 @@ class PulsarMessageConverter { ClassUtils.forName( "com.alibaba.fastjson.support.spring.messaging.MappingFastJsonMessageConverter", ClassUtils.getDefaultClassLoader() - ).newInstance() as MessageConverter + ).getDeclaredConstructor().newInstance() as MessageConverter ) } catch (ignored: ClassNotFoundException) { // ignore this exception diff --git a/devops-boot-project/devops-boot-core/devops-pulsar/src/main/kotlin/com/tencent/devops/stream/binder/pulsar/integration/inbound/PulsarInboundChannelAdapter.kt b/devops-boot-project/devops-boot-core/devops-pulsar/src/main/kotlin/com/tencent/devops/stream/binder/pulsar/integration/inbound/PulsarInboundChannelAdapter.kt index 630e3b5..313a72d 100644 --- a/devops-boot-project/devops-boot-core/devops-pulsar/src/main/kotlin/com/tencent/devops/stream/binder/pulsar/integration/inbound/PulsarInboundChannelAdapter.kt +++ b/devops-boot-project/devops-boot-core/devops-pulsar/src/main/kotlin/com/tencent/devops/stream/binder/pulsar/integration/inbound/PulsarInboundChannelAdapter.kt @@ -88,7 +88,7 @@ class PulsarInboundChannelAdapter( concurrency = extendedConsumerProperties.concurrency ) } catch (e: Exception) { - logger.error("DefaultPulsarConsumer init failed, Caused by " + e.message) + log.error("DefaultPulsarConsumer init failed, Caused by " + e.message) throw MessagingException( MessageBuilder.withPayload( "DefaultPulsarConsumer init failed, Caused by " + e.message @@ -132,16 +132,16 @@ class PulsarInboundChannelAdapter( private fun createListener(): (Consumer<*>, Message<*>) -> Unit { return { it: Consumer<*>, msg: Message<*> -> try { - if (logger.isDebugEnabled) { - logger.debug("Message received $msg ${msg.messageId}") + if (log.isDebugEnabled) { + log.debug("Message received $msg ${msg.messageId}") } val message = PulsarMessageConverterSupport.convertMessage2Spring(msg) if (retryTemplate != null) { retryTemplate!!.execute( RetryCallback { _: RetryContext? -> sendMessage(message) - if (logger.isDebugEnabled) { - logger.debug("will send acknowledge: ${msg.messageId}") + if (log.isDebugEnabled) { + log.debug("will send acknowledge: ${msg.messageId}") } it.acknowledge(msg) message @@ -150,16 +150,16 @@ class PulsarInboundChannelAdapter( ) } else { sendMessage(message) - if (logger.isDebugEnabled) { - logger.debug("will send acknowledge: ${msg.messageId}") + if (log.isDebugEnabled) { + log.debug("will send acknowledge: ${msg.messageId}") } it.acknowledge(msg) } - if (logger.isDebugEnabled) { - logger.debug("Message ${msg.messageId} has been consumed") + if (log.isDebugEnabled) { + log.debug("Message ${msg.messageId} has been consumed") } } catch (e: Exception) { - logger.warn("Error occurred while consuming message ${msg.messageId}: $e") + log.warn("Error occurred while consuming message ${msg.messageId}: $e") it.negativeAcknowledge(msg) } } @@ -187,7 +187,7 @@ class PulsarInboundChannelAdapter( consumers.add(consumer) } } catch (e: Exception) { - logger.error("Error occurred while creating consumer $e") + log.error("Error occurred while creating consumer $e") } // val instrumentation = Instrumentation(topic, this) @@ -195,7 +195,7 @@ class PulsarInboundChannelAdapter( // instrumentation.markStartedSuccessfully() // } catch (e: java.lang.Exception) { // instrumentation.markStartFailed(e) -// logger.error("PulsarConsumer init failed, Caused by " + e.message) +// log.error("PulsarConsumer init failed, Caused by " + e.message) // throw MessagingException( // MessageBuilder.withPayload( // "PulsarConsumer init failed, Caused by " + e.message @@ -228,6 +228,8 @@ class PulsarInboundChannelAdapter( } companion object { - private val logger = LoggerFactory.getLogger(PulsarInboundChannelAdapter::class.java) + // 命名为logger会和IntegrationObjectSupport中的logger冲突 + // https://youtrack.jetbrains.com/issue/KT-56386 + private val log = LoggerFactory.getLogger(PulsarInboundChannelAdapter::class.java) } } diff --git a/devops-boot-project/devops-boot-core/devops-pulsar/src/main/kotlin/com/tencent/devops/stream/binder/pulsar/support/PulsarMessageConverterSupport.kt b/devops-boot-project/devops-boot-core/devops-pulsar/src/main/kotlin/com/tencent/devops/stream/binder/pulsar/support/PulsarMessageConverterSupport.kt index 65e90bd..9508b92 100644 --- a/devops-boot-project/devops-boot-core/devops-pulsar/src/main/kotlin/com/tencent/devops/stream/binder/pulsar/support/PulsarMessageConverterSupport.kt +++ b/devops-boot-project/devops-boot-core/devops-pulsar/src/main/kotlin/com/tencent/devops/stream/binder/pulsar/support/PulsarMessageConverterSupport.kt @@ -69,7 +69,7 @@ object PulsarMessageConverterSupport { messageBuilder: MessageBuilder<*> ) { if (!CollectionUtils.isEmpty(properties)) { - properties.forEach { (key: String?, value: String?) -> + properties.forEach { (key: String, value: String) -> if (MessageHeaders.ID != key && MessageHeaders.TIMESTAMP != key ) { diff --git a/devops-boot-project/devops-boot-core/devops-pulsar/src/main/resources/META-INF/spring.factories b/devops-boot-project/devops-boot-core/devops-pulsar/src/main/resources/META-INF/spring.factories deleted file mode 100644 index e927bf5..0000000 --- a/devops-boot-project/devops-boot-core/devops-pulsar/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.tencent.devops.stream.binder.pulsar.autoconfigurate.ExtendedBindingHandlerMappingsProviderConfiguration diff --git a/devops-boot-project/devops-boot-core/devops-pulsar/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/devops-boot-project/devops-boot-core/devops-pulsar/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..76f9136 --- /dev/null +++ b/devops-boot-project/devops-boot-core/devops-pulsar/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.tencent.devops.stream.binder.pulsar.autoconfigurate.ExtendedBindingHandlerMappingsProviderConfiguration \ No newline at end of file diff --git a/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/src/main/resources/META-INF/spring.factories b/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 1228817..0000000 --- a/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ - com.tencent.devops.schedule.mongo.config.MongoModelAutoConfiguration diff --git a/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..72dab88 --- /dev/null +++ b/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-model-mongodb/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ + com.tencent.devops.schedule.mongo.config.MongoModelAutoConfiguration \ No newline at end of file diff --git a/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/META-INF/spring.factories b/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports similarity index 68% rename from devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/META-INF/spring.factories rename to devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 7a69873..5c6fff4 100644 --- a/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/META-INF/spring.factories +++ b/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-server/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,4 +1,3 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.tencent.devops.schedule.config.ScheduleServerAutoConfiguration,\ -com.tencent.devops.schedule.config.ScheduleServerRpcAutoConfiguration,\ -com.tencent.devops.schedule.config.ScheduleServerDiscoveryAutoConfiguration +com.tencent.devops.schedule.config.ScheduleServerAutoConfiguration +com.tencent.devops.schedule.config.ScheduleServerRpcAutoConfiguration +com.tencent.devops.schedule.config.ScheduleServerDiscoveryAutoConfiguration \ No newline at end of file diff --git a/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/resources/META-INF/spring.factories b/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 7118444..0000000 --- a/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,4 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ - com.tencent.devops.schedule.config.ScheduleWorkerAutoConfiguration,\ - com.tencent.devops.schedule.config.ScheduleWorkerRpcAutoConfiguration,\ - com.tencent.devops.schedule.config.ScheduleWorkerDiscoveryAutoConfiguration diff --git a/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..d4b7e02 --- /dev/null +++ b/devops-boot-project/devops-boot-core/devops-schedule/devops-schedule-worker/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,3 @@ +com.tencent.devops.schedule.config.ScheduleWorkerAutoConfiguration +com.tencent.devops.schedule.config.ScheduleWorkerRpcAutoConfiguration +com.tencent.devops.schedule.config.ScheduleWorkerDiscoveryAutoConfiguration \ No newline at end of file diff --git a/devops-boot-project/devops-boot-core/devops-service-reactive/src/main/resources/META-INF/spring.factories b/devops-boot-project/devops-boot-core/devops-service-reactive/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 6de9802..0000000 --- a/devops-boot-project/devops-boot-core/devops-service-reactive/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.tencent.devops.service.ServiceReactiveAutoConfiguration diff --git a/devops-boot-project/devops-boot-core/devops-service-reactive/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/devops-boot-project/devops-boot-core/devops-service-reactive/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..236ca98 --- /dev/null +++ b/devops-boot-project/devops-boot-core/devops-service-reactive/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.tencent.devops.service.ServiceReactiveAutoConfiguration \ No newline at end of file diff --git a/devops-boot-project/devops-boot-core/devops-service-servlet/src/main/resources/META-INF/spring.factories b/devops-boot-project/devops-boot-core/devops-service-servlet/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 683d338..0000000 --- a/devops-boot-project/devops-boot-core/devops-service-servlet/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.tencent.devops.service.ServiceServletAutoConfiguration diff --git a/devops-boot-project/devops-boot-core/devops-service-servlet/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/devops-boot-project/devops-boot-core/devops-service-servlet/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..af9889e --- /dev/null +++ b/devops-boot-project/devops-boot-core/devops-service-servlet/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.tencent.devops.service.ServiceServletAutoConfiguration \ No newline at end of file diff --git a/devops-boot-project/devops-boot-core/devops-service/src/main/kotlin/com/tencent/devops/service/ServiceBootstrapEnvironmentPostProcessor.kt b/devops-boot-project/devops-boot-core/devops-service/src/main/kotlin/com/tencent/devops/service/ServiceBootstrapEnvironmentPostProcessor.kt index 332b7cb..dc2e0a1 100644 --- a/devops-boot-project/devops-boot-core/devops-service/src/main/kotlin/com/tencent/devops/service/ServiceBootstrapEnvironmentPostProcessor.kt +++ b/devops-boot-project/devops-boot-core/devops-service/src/main/kotlin/com/tencent/devops/service/ServiceBootstrapEnvironmentPostProcessor.kt @@ -32,7 +32,7 @@ class ServiceBootstrapEnvironmentPostProcessor: EnvironmentPostProcessor, Ordere with(Properties()) { if (isConsulPresent()) { setProperty("spring.cloud.consul.config.name", SERVICE_NAME) - setProperty("spring.cloud.consul.config.prefix", CONSUL_CONFIG_PREFIX) + setProperty("spring.cloud.consul.config.prefixes", CONSUL_CONFIG_PREFIX) setProperty("spring.cloud.consul.config.format", CONSUL_CONFIG_FORMAT) setProperty("spring.cloud.consul.config.profile-separator", CONSUL_CONFIG_SEPARATOR) setProperty("spring.cloud.consul.discovery.service-name", SERVICE_NAME) diff --git a/devops-boot-project/devops-boot-core/devops-service/src/main/resources/META-INF/spring.factories b/devops-boot-project/devops-boot-core/devops-service/src/main/resources/META-INF/spring.factories index 1ab1fe2..22efcd1 100644 --- a/devops-boot-project/devops-boot-core/devops-service/src/main/resources/META-INF/spring.factories +++ b/devops-boot-project/devops-boot-core/devops-service/src/main/resources/META-INF/spring.factories @@ -1,4 +1,2 @@ org.springframework.boot.env.EnvironmentPostProcessor=\ com.tencent.devops.service.ServiceBootstrapEnvironmentPostProcessor -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.tencent.devops.service.ServiceAutoConfiguration diff --git a/devops-boot-project/devops-boot-core/devops-service/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/devops-boot-project/devops-boot-core/devops-service/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..3fa9ea4 --- /dev/null +++ b/devops-boot-project/devops-boot-core/devops-service/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.tencent.devops.service.ServiceAutoConfiguration \ No newline at end of file diff --git a/devops-boot-project/devops-boot-core/devops-web/src/main/kotlin/com/tencent/devops/web/swagger/SwaggerConfiguration.kt b/devops-boot-project/devops-boot-core/devops-web/src/main/kotlin/com/tencent/devops/web/swagger/SwaggerConfiguration.kt index 5c038bb..f3e987f 100644 --- a/devops-boot-project/devops-boot-core/devops-web/src/main/kotlin/com/tencent/devops/web/swagger/SwaggerConfiguration.kt +++ b/devops-boot-project/devops-boot-core/devops-web/src/main/kotlin/com/tencent/devops/web/swagger/SwaggerConfiguration.kt @@ -30,6 +30,7 @@ class SwaggerConfiguration { return GroupedOpenApi.builder() .pathsToMatch(ALL_PATTERN) .packagesToScan("com.tencent") + .group("tencent") .build() } diff --git a/devops-boot-project/devops-boot-core/devops-web/src/main/resources/META-INF/spring.factories b/devops-boot-project/devops-boot-core/devops-web/src/main/resources/META-INF/spring.factories index 616847c..6fddc36 100644 --- a/devops-boot-project/devops-boot-core/devops-web/src/main/resources/META-INF/spring.factories +++ b/devops-boot-project/devops-boot-core/devops-web/src/main/resources/META-INF/spring.factories @@ -1,4 +1,2 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.tencent.devops.web.WebAutoConfiguration org.springframework.context.ApplicationContextInitializer=\ com.tencent.devops.web.banner.DevOpsBannerInitializer diff --git a/devops-boot-project/devops-boot-core/devops-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/devops-boot-project/devops-boot-core/devops-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..b14ca03 --- /dev/null +++ b/devops-boot-project/devops-boot-core/devops-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.tencent.devops.web.WebAutoConfiguration \ No newline at end of file diff --git a/devops-boot-project/devops-boot-core/devops-webmvc/src/main/resources/META-INF/spring.factories b/devops-boot-project/devops-boot-core/devops-webmvc/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 810fab5..0000000 --- a/devops-boot-project/devops-boot-core/devops-webmvc/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.tencent.devops.webmvc.WebMvcAutoConfiguration diff --git a/devops-boot-project/devops-boot-core/devops-webmvc/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/devops-boot-project/devops-boot-core/devops-webmvc/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..690a15e --- /dev/null +++ b/devops-boot-project/devops-boot-core/devops-webmvc/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.tencent.devops.webmvc.WebMvcAutoConfiguration \ No newline at end of file diff --git a/devops-boot-project/devops-boot-dependencies/build.gradle.kts b/devops-boot-project/devops-boot-dependencies/build.gradle.kts index 2704f46..c1474a1 100644 --- a/devops-boot-project/devops-boot-dependencies/build.gradle.kts +++ b/devops-boot-project/devops-boot-dependencies/build.gradle.kts @@ -33,13 +33,12 @@ dependencies { api("com.google.guava:guava:33.2.1-jre") // swagger - api("io.swagger.core.v3:swagger-annotations:2.2.22") - api("io.swagger.core.v3:swagger-models:2.2.22") - api("io.swagger.core.v3:swagger-jaxrs2:2.2.22") - api("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0") + api("io.swagger.core.v3:swagger-annotations:2.2.25") + api("io.swagger.core.v3:swagger-models:2.2.25") + api("io.swagger.core.v3:swagger-jaxrs2:2.2.25") + api("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.7.0") // mq stream - api("org.apache.pulsar:pulsar-client:2.9.5") api("com.google.protobuf:protobuf-java:3.19.6") // s3 @@ -47,5 +46,8 @@ dependencies { // crypto api("com.tencent.bk.sdk:crypto-java-sdk:1.1.1") + + //okhttp + api("com.squareup.okhttp3:okhttp:4.12.0") } } diff --git a/devops-boot-project/devops-boot-tools/build.gradle.kts b/devops-boot-project/devops-boot-tools/build.gradle.kts index 3486de8..43a03f4 100644 --- a/devops-boot-project/devops-boot-tools/build.gradle.kts +++ b/devops-boot-project/devops-boot-tools/build.gradle.kts @@ -1,3 +1,4 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile description = "Tools for DevOps Boot" @@ -7,7 +8,9 @@ subprojects { tasks { getByName("compileKotlin") { - kotlinOptions.jvmTarget = Versions.Java + compilerOptions { + jvmTarget.set(JvmTarget.fromTarget(Versions.Java)) + } } } } diff --git a/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/actions/KtLintCheckAction.kt b/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/actions/KtLintCheckAction.kt index a000c1b..d5921fb 100644 --- a/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/actions/KtLintCheckAction.kt +++ b/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/actions/KtLintCheckAction.kt @@ -13,14 +13,14 @@ class KtLintCheckAction( override fun execute(javaExec: JavaExec) { with(javaExec) { - val outputDir = "${project.buildDir}/reports/ktlint/" + val outputDir = "${project.layout.buildDirectory}/reports/ktlint/" val inputFiles = project.fileTree(mapOf("dir" to "src", "include" to "**/*.kt")) group = "verification" inputs.files(inputFiles) outputs.dir(outputDir) description = "Check Kotlin code style." classpath = ktLint - main = "com.pinterest.ktlint.Main" + mainClass.set("com.pinterest.ktlint.Main") args = listOf("src/**/*.kt") } } diff --git a/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/actions/KtLintFormatAction.kt b/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/actions/KtLintFormatAction.kt index d3b3d0f..1c059ca 100644 --- a/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/actions/KtLintFormatAction.kt +++ b/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/actions/KtLintFormatAction.kt @@ -13,14 +13,14 @@ class KtLintFormatAction( override fun execute(javaExec: JavaExec) { with(javaExec) { - val outputDir = "${project.buildDir}/reports/ktlint/" + val outputDir = "${project.layout.buildDirectory}/reports/ktlint/" val inputFiles = project.fileTree(mapOf("dir" to "src", "include" to "**/*.kt")) group = "formatting" inputs.files(inputFiles) outputs.dir(outputDir) description = "Fix Kotlin code style deviations." classpath = ktLint - main = "com.pinterest.ktlint.Main" + mainClass.set("com.pinterest.ktlint.Main") args = listOf("-F", "src/**/*.kt") } } diff --git a/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/conventions/KotlinConvention.kt b/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/conventions/KotlinConvention.kt index f3cf0c6..4a7cd24 100644 --- a/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/conventions/KotlinConvention.kt +++ b/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/conventions/KotlinConvention.kt @@ -4,7 +4,8 @@ import com.tencent.devops.utils.findJavaVersion import com.tencent.devops.utils.isKotlinSupport import org.gradle.api.Project import org.jetbrains.kotlin.allopen.gradle.SpringGradleSubplugin -import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformJvmPlugin +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.utils.IMPLEMENTATION @@ -12,7 +13,6 @@ import org.jetbrains.kotlin.gradle.utils.IMPLEMENTATION * kotlin相关配置 */ class KotlinConvention { - /** * 配置Kotlin默认编译选项 */ @@ -21,12 +21,12 @@ class KotlinConvention { if (!isKotlinSupport(this)) { return } - pluginManager.apply(KotlinPlatformJvmPlugin::class.java) + pluginManager.apply(KotlinPluginWrapper::class.java) // all-open kotlin class pluginManager.apply(SpringGradleSubplugin::class.java) tasks.withType(KotlinCompile::class.java) { - it.kotlinOptions.jvmTarget = findJavaVersion(this) - it.kotlinOptions.freeCompilerArgs = listOf("-Xjsr305=strict", "-java-parameters") + it.compilerOptions.jvmTarget.set(JvmTarget.fromTarget(findJavaVersion(this))) + it.compilerOptions.freeCompilerArgs.addAll(listOf("-Xjsr305=strict", "-java-parameters")) } dependencies.add(IMPLEMENTATION, KOTLIN_STDLIB) dependencies.add(IMPLEMENTATION, KOTLIN_REFLECT) @@ -35,7 +35,6 @@ class KotlinConvention { } companion object { - /** * std-jdk8依赖 */ diff --git a/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/conventions/RepositoryConvention.kt b/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/conventions/RepositoryConvention.kt index 05cfde5..fa0a013 100644 --- a/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/conventions/RepositoryConvention.kt +++ b/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/conventions/RepositoryConvention.kt @@ -26,6 +26,14 @@ class RepositoryConvention { project.findPropertyOrNull("mavenRepoUrl")?.let { url -> maven { it.url = URI(url) } } + // snapshot + maven { + it.name = "MavenSnapshot" + it.url = URI("https://central.sonatype.com/repository/maven-snapshots/") + it.mavenContent { descriptor -> + descriptor.snapshotsOnly() + } + } // release if (System.getenv("GITHUB_WORKFLOW") == null) { maven { it.url = URI("https://mirrors.tencent.com/nexus/repository/maven-public") } @@ -36,14 +44,6 @@ class RepositoryConvention { } // spring maven { it.url = URI("https://repo.spring.io/milestone") } - // snapshot - maven { - it.name = "MavenSnapshot" - it.url = URI("https://oss.sonatype.org/content/repositories/snapshots/") - it.mavenContent { descriptor -> - descriptor.snapshotsOnly() - } - } mavenLocal() } } diff --git a/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/enums/AssemblyMode.kt b/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/enums/AssemblyMode.kt index b606ac5..f190b85 100644 --- a/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/enums/AssemblyMode.kt +++ b/devops-boot-project/devops-boot-tools/devops-boot-gradle-plugin/src/main/kotlin/com/tencent/devops/enums/AssemblyMode.kt @@ -1,5 +1,7 @@ package com.tencent.devops.enums +import java.util.Locale + enum class AssemblyMode { NONE, CONSUL, @@ -9,8 +11,8 @@ enum class AssemblyMode { companion object { fun ofValueOrDefault(value: String): AssemblyMode { - val upperCase = value.toUpperCase() - return values().find { it.name == upperCase } ?: CONSUL + val upperCase = value.uppercase(Locale.getDefault()) + return entries.find { it.name == upperCase } ?: CONSUL } } } diff --git a/devops-boot-project/devops-boot-tools/devops-publish-gradle-plugin/README.md b/devops-boot-project/devops-boot-tools/devops-publish-gradle-plugin/README.md index f205941..7c62dc0 100644 --- a/devops-boot-project/devops-boot-tools/devops-publish-gradle-plugin/README.md +++ b/devops-boot-project/devops-boot-tools/devops-publish-gradle-plugin/README.md @@ -65,8 +65,8 @@ key=value | 属性 | 类型 | 默认值 | 说明 | | --------------- | ------- | ------ | ---------- | -| releaseRepoUrl | string | [https://oss.sonatype.org/service/local/](https://oss.sonatype.org/service/local/) | release仓库地址,默然为SONATYPE中央仓库地址 | -| snapshotRepoUrl | string | [https://oss.sonatype.org/content/repositories/snapshots/](https://oss.sonatype.org/content/repositories/snapshots/) | snapshot仓库地址,默然为SONATYPE中央仓库地址 | +| releaseRepoUrl | string | [https://ossrh-staging-api.central.sonatype.com/service/local/](https://ossrh-staging-api.central.sonatype.com/service/local/) | release仓库地址,默然为SONATYPE中央仓库地址 | +| snapshotRepoUrl | string | [https://central.sonatype.com/repository/maven-snapshots/](https://central.sonatype.com/repository/maven-snapshots/) | snapshot仓库地址,默然为SONATYPE中央仓库地址 | | repoUsername | string | null | 仓库认证用户名 | | repoPassword | string | null | 仓库认证密码 | diff --git a/devops-boot-project/devops-boot-tools/devops-publish-gradle-plugin/src/main/kotlin/com/tencent/devops/DevOpsPublishPlugin.kt b/devops-boot-project/devops-boot-tools/devops-publish-gradle-plugin/src/main/kotlin/com/tencent/devops/DevOpsPublishPlugin.kt index 669f175..9dfe371 100644 --- a/devops-boot-project/devops-boot-tools/devops-publish-gradle-plugin/src/main/kotlin/com/tencent/devops/DevOpsPublishPlugin.kt +++ b/devops-boot-project/devops-boot-tools/devops-publish-gradle-plugin/src/main/kotlin/com/tencent/devops/DevOpsPublishPlugin.kt @@ -17,6 +17,7 @@ import org.gradle.plugins.signing.Sign import org.gradle.plugins.signing.SigningExtension import org.gradle.plugins.signing.SigningPlugin import java.io.File +import org.gradle.api.publish.maven.tasks.PublishToMavenRepository /** * DevOps Publish Gradle插件,提供公共配置 @@ -101,6 +102,10 @@ class DevOpsPublishPlugin : Plugin { tasks.withType(Sign::class.java) { it.onlyIf { isReleaseVersion } } + + tasks.withType(PublishToMavenRepository::class.java).configureEach { publishTask -> + publishTask.dependsOn(tasks.withType(Sign::class.java)) + } } } diff --git a/devops-boot-sample/gradle/wrapper/gradle-wrapper.properties b/devops-boot-sample/gradle/wrapper/gradle-wrapper.properties index 068cdb2..1e2fbf0 100644 --- a/devops-boot-sample/gradle/wrapper/gradle-wrapper.properties +++ b/devops-boot-sample/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/devops-boot-sample/settings.gradle.kts b/devops-boot-sample/settings.gradle.kts index f21cbf5..0a9c8fb 100644 --- a/devops-boot-sample/settings.gradle.kts +++ b/devops-boot-sample/settings.gradle.kts @@ -5,7 +5,7 @@ rootProject.name = "devops-boot-sample" // for debug devops-boot locally @Suppress("UnstableApiUsage") pluginManagement { - val projectVersion = File(rootDir.parent,"version.txt").readText() + val projectVersion = File(rootDir.parent,"version.txt").readText().trim() plugins { id("com.tencent.devops.boot") version projectVersion } @@ -14,7 +14,7 @@ pluginManagement { mavenCentral() gradlePluginPortal() maven { - setUrl("https://oss.sonatype.org/content/repositories/snapshots/") + setUrl("https://central.sonatype.com/repository/maven-snapshots/") } } } diff --git a/docs/contribute.md b/docs/contribute.md index c2543c2..c6ea4c9 100644 --- a/docs/contribute.md +++ b/docs/contribute.md @@ -30,7 +30,7 @@ devops-framework/ ./gradlew publishToMavenLocal ``` -- 发布jar包到sonatype中央仓库,同时会发布插件jar包 +- 发布jar包到Sonatype中央仓库,同时会发布插件jar包 ```shell script ./gradlew publish ``` @@ -43,8 +43,8 @@ devops-framework/ ### 环境变量准备 当需要发布到中央仓库时,会读取以下环境变量: -- `ORG_GRADLE_PROJECT_repoUsername` sonatype用户名 -- `ORG_GRADLE_PROJECT_repoPassword` sonatype密码 +- `ORG_GRADLE_PROJECT_repoUsername` Sonatype用户名 +- `ORG_GRADLE_PROJECT_repoPassword` Sonatype密码 - `ORG_GRADLE_PROJECT_signingKey` gpg签名key - `ORG_GRADLE_PROJECT_signingKeyId` gpg签名key id - `ORG_GRADLE_PROJECT_signingPassword` gpg签名密码 diff --git a/docs/dependency/repository.md b/docs/dependency/repository.md index 3d03a62..607abaf 100644 --- a/docs/dependency/repository.md +++ b/docs/dependency/repository.md @@ -24,5 +24,5 @@ https://mirrors.tencent.com/nexus/repository/gradle-plugins/ ``` #### 三. snapshot库 ``` -https://oss.sonatype.org/content/repositories/snapshots/ +https://central.sonatype.com/repository/maven-snapshots/ ``` diff --git a/docs/plugin/devops-boot-gradle-plugin.md b/docs/plugin/devops-boot-gradle-plugin.md index a90f2f8..f0bc07c 100644 --- a/docs/plugin/devops-boot-gradle-plugin.md +++ b/docs/plugin/devops-boot-gradle-plugin.md @@ -56,7 +56,7 @@ plugins { 1. [Tencent Mirrors](https://mirrors.tencent.com/nexus/repository/maven-public/) 2. mavenCentral 3. jcenter -4. [MavenSnapshotRepo](https://oss.sonatype.org/content/repositories/snapshots/) +4. [MavenSnapshotRepo](https://central.sonatype.com/repository/maven-snapshots/) ### 2. 配置依赖管理 - 添加`dependency-management`插件 diff --git a/docs/plugin/devops-publish-gradle-plugin.md b/docs/plugin/devops-publish-gradle-plugin.md index e9b1c98..2e73c3c 100644 --- a/docs/plugin/devops-publish-gradle-plugin.md +++ b/docs/plugin/devops-publish-gradle-plugin.md @@ -66,8 +66,8 @@ key=value | 属性 | 类型 | 默认值 | 说明 | | --------------- | ------- | ------ | ---------- | -| releaseRepoUrl | string | [https://oss.sonatype.org/service/local/](https://oss.sonatype.org/service/local/) | release仓库地址,默然为SONATYPE中央仓库地址 | -| snapshotRepoUrl | string | [https://oss.sonatype.org/content/repositories/snapshots/](https://oss.sonatype.org/content/repositories/snapshots/) | snapshot仓库地址,默然为SONATYPE中央仓库地址 | +| releaseRepoUrl | string | [https://ossrh-staging-api.central.sonatype.com/service/local/](https://ossrh-staging-api.central.sonatype.com/service/local/) | release仓库地址,默然为SONATYPE中央仓库地址 | +| snapshotRepoUrl | string | [https://central.sonatype.com/repository/maven-snapshots/](https://central.sonatype.com/repository/maven-snapshots/) | snapshot仓库地址,默然为SONATYPE中央仓库地址 | | repoUsername | string | null | 仓库认证用户名 | | repoPassword | string | null | 仓库认证密码 | diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 068cdb2..1e2fbf0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/version.txt b/version.txt index afaf360..a8e8241 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.0 \ No newline at end of file +1.1.1-SNAPSHOT \ No newline at end of file