Gradle 如何解决未在 Gradle 插件门户中列出的插件?
How does Gradle resolve plugins not listed in the Gradle Plugin Portal?
在 spring-security
项目中,在 build.gradle 文件中,以下插件可用:
apply plugin: 'io.spring.nohttp'
apply plugin: 'locks'
apply plugin: 'io.spring.convention.root'
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'org.springframework.security.update-dependencies'
apply plugin: 'org.springframework.security.sagan'
apply plugin: 'org.springframework.github.milestone'
apply plugin: 'org.springframework.github.changelog'
关于列表中的第一个插件 (io.spring.nohttp
) - 在 Gradle - Plugins page, if in the Search Gradle plugins
text field is used the io.spring.nohttp
term, appears the io.spring.nohttp result - and can be opened the Owner: Spring IO 中出现了同一所有者的许多插件。如果您在其中一些的新标签页中打开,您将观察到它适用于 GitHub 中的两个不同帐户 - 例如:
- io.spring.nohttp ->
https://github.com/spring-io/nohttp
(spring-io
用户)
- io.spring.dependency-management ->
https://github.com/spring-gradle-plugins/dependency-management-plugin
(spring-gradle-plugins
用户)
所以,我可以分析和理解每个插件的工作原理或作用。
对于其他插件 - org.jetbrains.kotlin.jvm
- 与上面分享的经验相同
这个post的原因:对于许多其他插件,如果我尝试搜索其他插件,例如关于Sagan
- 如果在文本字段使用了 org.springframework.security.sagan
术语,它没有 return 结果(即使只使用了 sagan
术语) - 但我知道存在于 GitHub spring-io/sagan 项目,插件对吗?
那么Gradle插件页面中“理论上”不存在的插件如何解决?
spring-security
定义的某些插件未发布到 Gradle 插件门户,也不在任何其他存储库中。但是,它之所以有效,是因为项目也可以使用 buildSrc
目录定义自定义插件。
例如ID为org.springframework.security.sagan
的插件定义在各自的buildSrc/build.gradle
:
gradlePlugin {
plugins {
sagan {
id = "org.springframework.security.sagan"
implementationClass = "org.springframework.gradle.sagan.SaganPlugin"
}
}
}
spring-io/sagan
本身不是 Gradle 插件。
在官方 Gradle 文档中阅读有关机制的更多信息:
在 spring-security
项目中,在 build.gradle 文件中,以下插件可用:
apply plugin: 'io.spring.nohttp'
apply plugin: 'locks'
apply plugin: 'io.spring.convention.root'
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'org.springframework.security.update-dependencies'
apply plugin: 'org.springframework.security.sagan'
apply plugin: 'org.springframework.github.milestone'
apply plugin: 'org.springframework.github.changelog'
关于列表中的第一个插件 (io.spring.nohttp
) - 在 Gradle - Plugins page, if in the Search Gradle plugins
text field is used the io.spring.nohttp
term, appears the io.spring.nohttp result - and can be opened the Owner: Spring IO 中出现了同一所有者的许多插件。如果您在其中一些的新标签页中打开,您将观察到它适用于 GitHub 中的两个不同帐户 - 例如:
- io.spring.nohttp ->
https://github.com/spring-io/nohttp
(spring-io
用户) - io.spring.dependency-management ->
https://github.com/spring-gradle-plugins/dependency-management-plugin
(spring-gradle-plugins
用户)
所以,我可以分析和理解每个插件的工作原理或作用。
对于其他插件 - org.jetbrains.kotlin.jvm
- 与上面分享的经验相同
这个post的原因:对于许多其他插件,如果我尝试搜索其他插件,例如关于Sagan
- 如果在文本字段使用了 org.springframework.security.sagan
术语,它没有 return 结果(即使只使用了 sagan
术语) - 但我知道存在于 GitHub spring-io/sagan 项目,插件对吗?
那么Gradle插件页面中“理论上”不存在的插件如何解决?
spring-security
定义的某些插件未发布到 Gradle 插件门户,也不在任何其他存储库中。但是,它之所以有效,是因为项目也可以使用 buildSrc
目录定义自定义插件。
例如ID为org.springframework.security.sagan
的插件定义在各自的buildSrc/build.gradle
:
gradlePlugin {
plugins {
sagan {
id = "org.springframework.security.sagan"
implementationClass = "org.springframework.gradle.sagan.SaganPlugin"
}
}
}
spring-io/sagan
本身不是 Gradle 插件。
在官方 Gradle 文档中阅读有关机制的更多信息: