-
Notifications
You must be signed in to change notification settings - Fork 8.5k
docs: add Gradle dependency tutorial in README #4304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2025.1.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
|
||
| ``` | ||
|
|
||
| #### 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") | ||
|
VenkataAnilKumar marked this conversation as resolved.
|
||
| password = findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN") | ||
| } | ||
| } | ||
|
Comment on lines
+155
to
+163
|
||
| } | ||
|
|
||
| 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. | ||
|
|
||
There was a problem hiding this comment.
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。