Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robberphex/gradle-example
https://github.com/robberphex/gradle-example
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/robberphex/gradle-example
- Owner: robberphex
- Created: 2022-12-20T10:14:38.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-25T08:58:30.000Z (10 months ago)
- Last Synced: 2025-01-21T00:14:03.658Z (6 days ago)
- Language: Java
- Size: 68.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# an example to show dependency from platform and exclusion
1. introduce `dependencyManagement` module, add constraints.
```kts
val sentinelVersion = "1.8.6"
dependencies {
constraints {
api("com.alibaba.csp:sentinel-spring-webmvc-adapter:$sentinelVersion")
api("com.alibaba.csp:sentinel-core:$sentinelVersion")
}
}
```2. add dependency in `app` module, with exclusion, without version.
```kts
dependencies {
implementation(enforcedPlatform(project(":dependencyManagement")))
implementation("com.alibaba.csp:sentinel-spring-webmvc-adapter") {
exclude("com.alibaba.csp", "sentinel-core")
}
}
```3. verify
```bash
$ ./gradlew -q :app:dependencies
------------------------------------------------------------
Project ':app'
------------------------------------------------------------
runtimeClasspath - Runtime classpath of source set 'main'.
+--- project :dependencyManagement
| \--- com.alibaba.csp:sentinel-spring-webmvc-adapter:1.8.6 (c)
\--- com.alibaba.csp:sentinel-spring-webmvc-adapter -> 1.8.6
$ ./gradlew -q run
Hello, world!
load adapter success! com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.UrlCleaner
load core failed! java.lang.ClassNotFoundException: com.alibaba.csp.sentinel.Env
```## reference
1.