Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,52 @@ Spring Cloud 使用 Maven 来构建,最快的使用方式是将本项目 clone
</servers>
```

### 如何引入 Gradle 依赖

#### 正式版

在 `build.gradle`(或 `build.gradle.kts`)中通过 `platform` 引入 BOM:

```groovy
dependencies {
implementation platform("com.alibaba.cloud:spring-cloud-alibaba-dependencies:2025.1.0.0")

// 按需选择 starter
implementation "com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config"
}
```
Comment on lines +143 to +152

Copilot AI Apr 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里提到可用于 build.gradle.kts,但示例代码块是 Groovy DSL(Kotlin DSL 不能直接复制粘贴使用)。建议补充一个 Kotlin DSL 版本的示例,或把文案调整为仅针对 build.gradle

Copilot uses AI. Check for mistakes.

#### 快照

如果需要使用已发布的`快照版本`,使用快照 BOM 并添加 GitHub Packages 仓库:

```groovy
repositories {
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/alibaba/spring-cloud-alibaba")
credentials {
username = findProperty("gpr.user") ?: System.getenv("GITHUB_USERNAME")
password = findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
Comment thread
VenkataAnilKumar marked this conversation as resolved.
Comment thread
VenkataAnilKumar marked this conversation as resolved.
}
}

dependencies {
implementation platform("com.alibaba.cloud:spring-cloud-alibaba-dependencies:2025.1.0.0-SNAPSHOT")

// 按需选择 starter
implementation "com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config"
}
```

你可以在 `~/.gradle/gradle.properties` 中配置凭据:

```properties
gpr.user=你的 GitHub 用户名
gpr.key=你的 GitHub Token(需要 read:packages 权限)
```

## 演示 Demo

为了演示如何使用,Spring Cloud Alibaba 项目包含了一个子模块`spring-cloud-alibaba-examples`。此模块中提供了演示用的 example ,您可以阅读对应的 example 工程下的 readme 文档,根据里面的步骤来体验。
Expand Down
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,52 @@ Add the following configuration in `settings.xml`.
</servers>
```

### Add Gradle dependency

#### Release Version

Use Maven Central BOM in your `build.gradle` (or `build.gradle.kts`) via `platform`:

```groovy
dependencies {
implementation platform("com.alibaba.cloud:spring-cloud-alibaba-dependencies:2025.1.0.0")

// choose starter(s) as needed
implementation "com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config"
}
Comment on lines +139 to +147

Copilot AI Apr 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The section mentions build.gradle.kts, but the example is Groovy DSL (and will not paste directly into Kotlin DSL). Either add a Kotlin DSL variant (including dependencies { implementation(platform("...")) } syntax) or adjust the text to only reference build.gradle/Groovy.

Copilot uses AI. Check for mistakes.
```

#### Snapshot

If you need the published `Snapshot Version`, use snapshot BOM and add GitHub Packages repository:

```groovy
repositories {
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/alibaba/spring-cloud-alibaba")
credentials {
username = findProperty("gpr.user") ?: System.getenv("GITHUB_USERNAME")
Comment thread
VenkataAnilKumar marked this conversation as resolved.
password = findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
Comment on lines +155 to +163

Copilot AI Apr 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the GitHub Packages repository used only for snapshots, consider restricting it to snapshots (Gradle equivalent of the earlier Maven <releases><enabled>false</enabled></releases> / <snapshots><enabled>true</enabled></snapshots>). Without this, Gradle may attempt release resolution against GitHub Packages, which can slow dependency resolution and cause surprising results.

Copilot uses AI. Check for mistakes.
}

dependencies {
implementation platform("com.alibaba.cloud:spring-cloud-alibaba-dependencies:2025.1.0.0-SNAPSHOT")

// choose starter(s) as needed
implementation "com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config"
}
```

You can put credentials in `~/.gradle/gradle.properties`:

```properties
gpr.user=Your GitHub Username
gpr.key=Your GitHub Token (requires read:packages permission)
```

## Examples

A `spring-cloud-alibaba-examples` module is included in our project for you to get started with Spring Cloud Alibaba quickly. It contains an example, and you can refer to the readme file in the example project for a quick walkthrough.
Expand Down
Loading