Merge pull request #7449 from JohnNiang/refactor/libs-versions

Refactor dependencies and plugins with version catelog
pull/7455/head
John Niang 2025-05-20 10:45:35 +08:00 committed by GitHub
commit f18cf18862
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 99 additions and 81 deletions

View File

@ -2,8 +2,8 @@ plugins {
id 'java-library'
id 'halo.publish'
id 'jacoco'
id "io.freefair.lombok"
id "com.github.ben-manes.versions"
alias(libs.plugins.lombok)
alias(libs.plugins.versions)
}
group = 'run.halo.app'

View File

@ -2,18 +2,18 @@ import de.undercouch.gradle.tasks.download.Download
import org.gradle.crypto.checksum.Checksum
plugins {
id 'org.springframework.boot'
id 'io.spring.dependency-management'
id "com.gorylenko.gradle-git-properties"
id "checkstyle"
id 'java'
id 'idea'
id 'jacoco'
id "de.undercouch.download"
id "io.freefair.lombok"
id 'org.gradle.crypto.checksum'
id 'org.springdoc.openapi-gradle-plugin'
id "com.github.ben-manes.versions"
alias(libs.plugins.spring.boot)
alias(libs.plugins.spring.dependency.management)
alias(libs.plugins.git.properties)
alias(libs.plugins.undercouch.download)
alias(libs.plugins.lombok)
alias(libs.plugins.checksum)
alias(libs.plugins.springdoc.openapi)
alias(libs.plugins.versions)
}
group = 'run.halo.app'
@ -72,6 +72,10 @@ bootJar {
}
}
gitProperties {
dotGitDirectory = layout.settingsDirectory.dir('.git')
}
tasks.named('jar') {
enabled = false
}

View File

@ -36,7 +36,7 @@ class FileTypeDetectUtilsTest {
void detectMimeTypeWithNameTest() throws IOException {
var stream = getFileInputStream("classpath:file-type-detect/index.js");
String mimeType = FileTypeDetectUtils.detectMimeType(stream, "index.js");
assertThat(mimeType).isEqualTo("application/javascript");
assertThat(mimeType).isEqualTo("text/javascript");
stream = getFileInputStream("classpath:file-type-detect/index.html");
mimeType =

View File

@ -12,6 +12,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@ -145,7 +146,9 @@ class ContentTemplateHeadProcessorIntegrationTest {
2. global head meta is overridden by content head meta
3. but global head meta is not overridden by global seo meta
*/
assertThat(Jsoup.parse(result).html()).isEqualTo("""
var outputSettings = new Document.OutputSettings().prettyPrint(true);
var actual = Jsoup.parse(result).outputSettings(outputSettings).html();
var expected = Jsoup.parse("""
<!doctype html>
<html lang="en">
<head>
@ -155,10 +158,10 @@ class ContentTemplateHeadProcessorIntegrationTest {
<meta name="description" content="post-description">
<meta name="other" content="post-other-meta">
</head>
<body>
this is body
</body>
</html>""");
<body>this is body</body>
</html>"""
).outputSettings(outputSettings).html();
assertThat(actual).isEqualTo(expected);
}
Map<String, String> mutableMetaMap(String nameValue, String contentValue) {

View File

@ -1,11 +0,0 @@
plugins {
id 'org.springframework.boot' version '3.4.5' apply false
id 'io.spring.dependency-management' version '1.1.7' apply false
id "com.gorylenko.gradle-git-properties" version "2.4.1" apply false
id "de.undercouch.download" version "5.6.0" apply false
id "io.freefair.lombok" version "8.6" apply false
id 'org.gradle.crypto.checksum' version '1.4.0' apply false
id "com.github.node-gradle.node" version "7.0.2" apply false
id "org.springdoc.openapi-gradle-plugin" version "1.9.0" apply false
id "com.github.ben-manes.versions" version "0.51.0" apply false
}

51
gradle/libs.versions.toml Normal file
View File

@ -0,0 +1,51 @@
[versions]
lucene = '9.12.0'
resilience4j = '2.3.0'
therapi = '0.15.0'
[libraries]
lucene-core = { module = 'org.apache.lucene:lucene-core', version.ref = 'lucene' }
lucene-queryparser = { module = 'org.apache.lucene:lucene-queryparser', version.ref = 'lucene' }
lucene-highlighter = { module = 'org.apache.lucene:lucene-highlighter', version.ref = 'lucene' }
lucene-backward-codecs = { module = 'org.apache.lucene:lucene-backward-codecs', version.ref = 'lucene' }
lucene-analyzers-common = { module = 'org.apache.lucene:lucene-analysis-common', version.ref = 'lucene' }
therapi-runtime-javadoc = { module = 'com.github.therapi:therapi-runtime-javadoc', version.ref = 'therapi' }
therapi-runtime-javadoc-scribe = { module = 'com.github.therapi:therapi-runtime-javadoc-scribe', version.ref = 'therapi' }
resilience4j-springboot3 = { module = 'io.github.resilience4j:resilience4j-spring-boot3', version.ref = 'resilience4j' }
resilience4j-reactor = { module = 'io.github.resilience4j:resilience4j-reactor', version.ref = 'resilience4j' }
apache-commons-lang3 = 'org.apache.commons:commons-lang3:3.12.0'
apache-tika-core = 'org.apache.tika:tika-core:3.1.0'
encoding-base62 = 'io.seruco.encoding:base62:0.1.3'
pf4j = 'org.pf4j:pf4j:3.13.0'
guava = 'com.google.guava:guava:33.4.8-jre'
java-diff-utils = 'io.github.java-diff-utils:java-diff-utils:4.15'
jsoup = 'org.jsoup:jsoup:1.20.1'
json-patch = 'com.github.java-json-tools:json-patch:1.13'
springdoc-openapi = 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.8.8'
openapi-schema-validator = 'org.openapi4j:openapi-schema-validator:1.0.7'
bouncycastle-bcpkix = 'org.bouncycastle:bcpkix-jdk18on:1.80'
twofactor-auth = 'com.j256.two-factor-auth:two-factor-auth:1.3'
imgscalr-lib = 'org.imgscalr:imgscalr-lib:4.2'
metadata-extractor = 'com.drewnoakes:metadata-extractor:2.19.0'
[bundles]
lucene = ['lucene-core', 'lucene-queryparser', 'lucene-highlighter', 'lucene-backward-codecs', 'lucene-analyzers-common']
resilience4j = ['resilience4j-springboot3', 'resilience4j-reactor']
apache = ['apache-commons-lang3', 'apache-tika-core']
therapi = ['therapi-runtime-javadoc', 'therapi-runtime-javadoc-scribe']
[plugins]
spring-boot = 'org.springframework.boot:3.4.5'
spring-dependency-management = 'io.spring.dependency-management:1.1.7'
git-properties = 'com.gorylenko.gradle-git-properties:2.5.0'
undercouch-download = 'de.undercouch.download:5.6.0'
lombok = 'io.freefair.lombok:8.13.1'
checksum = 'org.gradle.crypto.checksum:1.4.0'
node = 'com.github.node-gradle.node:7.1.0'
openapi-generator = 'org.openapi.generator:7.12.0'
springdoc-openapi = 'org.springdoc.openapi-gradle-plugin:1.9.0'
versions = 'com.github.ben-manes.versions:0.52.0'

View File

@ -1,33 +1,14 @@
import org.springframework.boot.gradle.plugin.SpringBootPlugin
plugins {
id 'org.springframework.boot' apply false
id 'java-platform'
id 'halo.publish'
alias(libs.plugins.spring.boot) apply false
}
group = 'run.halo.tools.platform'
description = 'Platform of application.'
ext {
commonsLang3 = "3.12.0"
base62 = "0.1.3"
pf4j = '3.13.0'
javaDiffUtils = "4.12"
guava = "33.3.1-jre"
jsoup = '1.18.1'
jsonPatch = "1.13"
springDocOpenAPI = "2.8.3"
lucene = "9.12.0"
resilience4jVersion = "2.2.0"
twoFactorAuth = "1.3"
tika = "2.9.2"
imgscalr = '4.2'
exifExtractor = '2.19.0'
therapiVersion = '0.13.0'
bouncycastleVersion = '1.80'
}
javaPlatform {
allowDependencies()
}
@ -36,34 +17,24 @@ dependencies {
api platform(SpringBootPlugin.BOM_COORDINATES)
constraints {
api "org.springdoc:springdoc-openapi-starter-webflux-ui:$springDocOpenAPI"
api 'org.openapi4j:openapi-schema-validator:1.0.7'
api "org.bouncycastle:bcpkix-jdk18on:$bouncycastleVersion"
// Apache Lucene
api "org.apache.lucene:lucene-core:$lucene"
api "org.apache.lucene:lucene-queryparser:$lucene"
api "org.apache.lucene:lucene-highlighter:$lucene"
api "org.apache.lucene:lucene-backward-codecs:$lucene"
api "org.apache.lucene:lucene-analysis-common:$lucene"
api "org.apache.commons:commons-lang3:$commonsLang3"
api "io.seruco.encoding:base62:$base62"
api "org.pf4j:pf4j:$pf4j"
api "com.google.guava:guava:$guava"
api "org.jsoup:jsoup:$jsoup"
api "io.github.java-diff-utils:java-diff-utils:$javaDiffUtils"
api libs.bundles.lucene
api libs.bundles.apache
api libs.bundles.therapi
api libs.springdoc.openapi
api libs.openapi.schema.validator
api libs.bouncycastle.bcpkix
api libs.encoding.base62
api libs.pf4j
api libs.guava
api libs.java.diff.utils
api libs.jsoup
api libs.json.patch
api libs.bundles.resilience4j
api libs.twofactor.auth
api libs.imgscalr.lib
api libs.metadata.extractor
api "org.springframework.integration:spring-integration-core"
api "com.github.java-json-tools:json-patch:$jsonPatch"
api "org.thymeleaf.extras:thymeleaf-extras-springsecurity6"
api "io.github.resilience4j:resilience4j-spring-boot3:$resilience4jVersion"
api "io.github.resilience4j:resilience4j-reactor:$resilience4jVersion"
api "com.j256.two-factor-auth:two-factor-auth:$twoFactorAuth"
api "org.apache.tika:tika-core:$tika"
api "org.imgscalr:imgscalr-lib:$imgscalr"
api "com.drewnoakes:metadata-extractor:$exifExtractor"
api "com.github.therapi:therapi-runtime-javadoc:$therapiVersion"
api "com.github.therapi:therapi-runtime-javadoc-scribe:$therapiVersion"
}
}

View File

@ -1,7 +1,7 @@
plugins {
id 'idea'
id 'com.github.node-gradle.node'
id 'org.openapi.generator' version '7.6.0'
alias(libs.plugins.node)
alias(libs.plugins.openapi.generator)
}
idea {