Replace Sub-Dependency of SPM


I did not found this in the docs: How to manually override a sub-dependency of a dependency?

Example: I have a server app based on vapor and I would like to exclude the routing-kit dependency of vapor to replace the routing-kit with my own implementation.

The exclude parameter of the .target() does not exclude dependencies, but source files.

Other build tools, like Gradle supports excluding sub-dependencies, eg:

// build.gradle.kts
dependencies {
testImplementation("org.springframework.boot:spring-boot-starter-test") {
        exclude(group = "org.junit.vintage", module = "junit-vintage-engine")

If you just want to replace the default RoutingKit with your own version of it, you should be able just declare that dependency directly in your Package, assuming SPM works like other package managers here.