依赖项配置中 "ext: 'jar'" 的目的是什么?
What is the purpose of "ext: 'jar'" in dependencies config?
我看到很多 build.gradle 配置使用此设置:
compile group: 'org.jenkins-ci.main', name: 'jenkins-core', version: '+', ext: 'jar'
ext: 'jar'
是做什么的?
ext 是 DefaultExtraPropertiesExtension,但我找不到“jar”是什么的文档。
如果我在这个例子中去掉 ext: jar
,我会得到一个看起来像传递依赖的错误:
Could not find org.connectbot.jbcrypt:jbcrypt:1.0.0.
“jar”是在下载预编译的 uber jar 还是其他东西,而不是正确的 Maven 包?为什么这方面的文档似乎为零 - 也许我没有找对地方?
编辑
我找到了解释 here:
NOTE 2: The ext: 'jar' is VERY important to ensure that jar files,
instead of hpi/jpi files, are being downloaded and understood by
IntellJ. Without that ext option specified, IntellJ won’t find JAR
files nested in hpi/jpi files which is the default binaries for
Jenkins plugins.
但我仍然对发生的事情感到困惑。参数“jar”是否被传递给依赖项并且这些 Jenkins 依赖项知道这个“jar”参数?所以 jar 不是标准的 Gradle dep 东西,它特定于这些 Jenkins deps?
这在 DependencyHander
的 DSL 文档中有记录:
https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.dsl.DependencyHandler.html#N16E3D
There are two notations supported for declaring a dependency on an external module. One is a string notation formatted this way:
configurationName "group:name:version:classifier@extension"
The other is a map notation:
configurationName group: group, name: name, version: version, classifier: classifier, ext: extension
并且在 Javadoc 中有进一步的记录:
Returns the extension of this artifact. Often the extension is the same as the type, but sometimes this is not the case. For example for an ivy XML module descriptor, the type is ivy and the extension is xml.
我看到很多 build.gradle 配置使用此设置:
compile group: 'org.jenkins-ci.main', name: 'jenkins-core', version: '+', ext: 'jar'
ext: 'jar'
是做什么的?
ext 是 DefaultExtraPropertiesExtension,但我找不到“jar”是什么的文档。
如果我在这个例子中去掉 ext: jar
,我会得到一个看起来像传递依赖的错误:
Could not find org.connectbot.jbcrypt:jbcrypt:1.0.0.
“jar”是在下载预编译的 uber jar 还是其他东西,而不是正确的 Maven 包?为什么这方面的文档似乎为零 - 也许我没有找对地方?
编辑
我找到了解释 here:
NOTE 2: The ext: 'jar' is VERY important to ensure that jar files, instead of hpi/jpi files, are being downloaded and understood by IntellJ. Without that ext option specified, IntellJ won’t find JAR files nested in hpi/jpi files which is the default binaries for Jenkins plugins.
但我仍然对发生的事情感到困惑。参数“jar”是否被传递给依赖项并且这些 Jenkins 依赖项知道这个“jar”参数?所以 jar 不是标准的 Gradle dep 东西,它特定于这些 Jenkins deps?
这在 DependencyHander
的 DSL 文档中有记录:
https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.dsl.DependencyHandler.html#N16E3D
There are two notations supported for declaring a dependency on an external module. One is a string notation formatted this way:
configurationName "group:name:version:classifier@extension"
The other is a map notation:
configurationName group: group, name: name, version: version, classifier: classifier, ext: extension
并且在 Javadoc 中有进一步的记录:
Returns the extension of this artifact. Often the extension is the same as the type, but sometimes this is not the case. For example for an ivy XML module descriptor, the type is ivy and the extension is xml.