问题描述
我不理解gradle插件块
I don't understand gradle plugins block
apply plugin: 'someplugin1'
apply plugin: 'maven'
和另外一个:
plugins {
id 'org.hidetake.ssh' version '1.1.2'
}
在第一步中,我们有一些插件名称.在第二个软件包和版本中.我不知道应该在哪里使用第一个方块,什么时候第二个.
In first block We have some plugin name. in second one package and version. I don't understand where I should use first block and when second one.
推荐答案
plugins
块是应用插件的较新方法,并且它们必须在 Gradle插件存储库. apply
方法是将插件添加到构建中的较旧但更灵活的方法.
The plugins
block is the newer method of applying plugins, and they must be available in the Gradle plugin repository. The apply
approach is the older, yet more flexible method of adding a plugin to your build.
新的plugins
方法不适用于多项目配置(subprojects
,allprojects
),但适用于每个子项目的构建配置.
The new plugins
method does not work in multi-project configurations (subprojects
, allprojects
), but will work on the build configuration for each child project.
我认为随着功能的发展,plugins
配置方法将取代旧的方法,但是在这一点上,两者可以同时使用.
I would think that as functionality progresses, the plugins
configuration method will overtake the older approach, but at this point both can be and are used concurrently.
这篇关于应用gradle插件有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!