Gradle 的发行包中有大量的插件。如下列所示:
There are a number of plugins included in the Gradle distribution. These are listed below.
这些插件添加了让各种语言可以被编译和在JVM执行的支持。
These plugins add support for various languages which can be compiled for and executed in the JVM.
表 22.1. 语言插件
Table 22.1. Language plugins
插件 Id Plugin Id |
自动应用 Automatically applies |
与什么插件一起使用 Works with |
描述 Description |
java
|
java-base
|
- |
向一个项目添加 Java 编译、 测试和捆绑的能力。它是很多其他 Gradle
插件的基础服务。另请参阅
第 7 章,
Java 快速入门。 |
groovy
|
java
,
groovy-base
|
- |
添加对 Groovy 项目构建的支持。另请参阅
第9章,
Groovy 快速入门。 |
scala
|
java
,
scala-base
|
- |
添加对 Scala 项目构建的支持。 |
antlr
|
java
|
- |
添加对使用
Antlr作为生成解析器的支持。 |
这些插件添加了对多种语言的支持:
These plugins add support for various languages:
表 22.2. 语言插件
Table 22.2. Language plugins
插件 Id Plugin Id |
自动应用 Automatically applies |
与什么插件一起使用 Works with |
描述 Description |
assembler
|
- | - |
向项目添加本机汇编语言的功能。 |
c
|
- | - |
向项目添加 C语言源代码编译功能。 |
cpp
|
- | - |
向项目添加 c++ 源代码编译功能。 |
objective-c
|
- | - |
向项目中添加 Objective-C 源代码编译功能。 |
objective-cpp
|
- | - |
向项目中添加 Objective-C++ 源代码编译功能。 |
windows-resources
|
- | - |
添加对在本地bin文件中包含 Windows 资源的支持。 |
以下这些插件提供了一些与各种运行时技术的集成。
These plugins provide some integration with various runtime technologies.
表 22.3. 集成插件
Table 22.3. Integration plugins
插件 Id Plugin Id |
自动应用 Automatically applies |
与什么插件一起使用 Works with |
描述 Description |
application
|
java
|
- |
添加了一些任务,用于运行和捆绑一个Java项目作为命令行应用程序。 |
ear
|
- |
java
|
添加用于构建 J2EE 应用程序的支持。 |
jetty
|
war
|
- |
在构建中部署你的web程序到一个内嵌的Jetty web容器中。另请参阅
第 10 章,
Web 应用程序快速入门。 |
maven
|
- |
java
,
war
|
添加用于将项目发布到 Maven 仓库的支持。 |
osgi
|
java-base
|
java
|
添加构建 OSGi 捆绑包的支持。 |
war
|
java
|
- |
添加用于组装 web 应用程序的 WAR 文件的支持。另请参阅 第 10 章, Web 应用程序快速入门。 Adds support for assembling web application WAR files. See also Chapter 10, Web Application Quickstart . |
以下这些插件提供了一些与各种运行时技术的集成。
These plugins provide some integration with various runtime technologies.
表 22.4. 孵化中的集成插件
Table 22.4. Incubating integration plugins
插件 Id Plugin Id |
自动应用 Automatically applies |
与什么插件一起使用 Works with |
描述 Description |
distribution
|
- | - |
添加构建 ZIP 和 TAR 分发包的支持。 |
java-library-distribution
|
java
,
distribution
|
- |
添加构建一个Java类库的 ZIP 和 TAR 分发包的支持。 |
ivy-publish
|
- |
java
,
war
|
这个插件提供了新的 DSL,用于支持发布文件到 Ivy 存储库,改善了现有的 DSL。 |
maven-publish
|
- |
java
,
war
|
这个插件提供了新的 DSL,用于支持发布文件到 Maven 存储库,改善了现有的 DSL。 |
这些插件提供一些软件开发过程上的帮助。
These plugins provide help with your software development process.
表 22.5. 软件开发插件
Table 22.5. Software development plugins
插件 Id Plugin Id |
自动应用 Automatically applies |
与什么插件一起使用 Works with |
描述 Description |
announce
|
- | - |
将消息发布到你所喜爱的平台,如 Twitter 或 Growl。 |
build-announcements
|
announce | - |
在构建的生命周期中,把本地公告中有关你感兴趣的事件发送到你的桌面。 |
checkstyle
|
java-base
|
- |
使用
Checkstyle对您的项目的 Java 源文件执行质量检查并生成报告。 |
codenarc
|
groovy-base
|
- |
使用
CodeNarc对您的项目的
Groovy 源文件执行质量检查并生成报告。 |
eclipse
|
- |
java
,
groovy
,
scala
|
生成
Eclipse
IDE所用到的文件,从而使项目能够导入到 Eclipse。另请参阅
第 7 章,
Java 快速入门。 |
eclipse-wtp
|
- |
ear
,
war
|
与 eclipse 插件一样,但它还生成 eclipse WTP (Web 工具平台)
的配置文件。你的war/ear项目在导入eclipse 后,应配置为能在 WTP 中使用。另请参阅
第 7 章,
Java 快速入门。 |
findbugs
|
java-base
|
- |
使用
FindBugs对您的项目的 Java
源文件执行质量检查并生成报告。 |
idea
|
- |
java
|
生成
Intellij IDEA
IDE所用到的文件,从而使项目能够导入到 IDEA。 |
jdepend
|
java-base
|
- |
使用
JDepend对您的项目的源文件执行质量检查并生成报告。 |
pmd
|
java-base
|
- |
使用
PMD对您的项目的 Java
源文件执行质量检查并生成报告。 |
project-report
|
reporting-base
|
- |
生成关于Gradle构建中有用的信息的报告。 |
signing
|
base | - |
添加对生成的文件或构件进行数字签名的功能。 |
sonar
|
- | java-base, java, jacoco |
提供对
Sonar代码质量平台的集成。由
|
这些插件提供一些软件开发过程上的帮助。
These plugins provide help with your software development process.
表 22.6. 软件开发插件
Table 22.6. Software development plugins
插件 Id Plugin Id |
自动应用 Automatically applies |
与什么插件一起使用 Works with |
描述 Description |
build-dashboard
|
reporting-base | - |
生成构建的主控面板的报表。 |
build-init
|
wrapper | - |
添加用于初始化一个新 Gradle 构建的支持。处理转换 Maven 构建为 Gradle 构建。 |
cunit
|
- | - | |
jacoco
|
reporting-base | java |
提供对 Java 的
JaCoCo代码覆盖率库的集成。 |
sonar-runner
|
- | java-base, java, jacoco |
提供对
Sonar代码质量平台的集成。由
|
visual-studio
|
- | 本机语言插件 native language plugins |
添加对 Visual Studio 的集成。 |
wrapper
|
- | - |
添加一个用于生成 Gradle wrapper 文件的
|
这些插件组成了基本的构建块,其他插件都由此组装而来。它们可供你在你的构建文件中使用,并在此处完整列出。然而,请注意它们都不被认为是
Gradle 公共 API 的一部分。因此,这些插件都不在用户指南中记录。您可能会引用他们的 API
文档,以了解更多关于它们的信息。
These plugins form the basic building blocks which the other plugins are assembled from. They are
available for you to use in your build files, and are listed here for completeness. However, be aware that
they are not yet considered part of Gradle's public API. As such, these plugins are not documented in the
user guide. You might refer to their API documentation to learn more about them.
表 22.7. 基本插件
Table 22.7. Base plugins
插件 Id Plugin Id |
描述 Description |
base |
添加标准的生命周期任务,并为归档任务默认进行合理的配置:
|
java-base |
对项目添加源集的概念。不会添加任何特定的源集。 Adds the source sets concept to the project. Does not add any particular source sets. |
groovy-base |
向项目中添加Groovy 的源集概念。 |
scala-base |
向项目中添加Scala 的源集概念。 |
reporting-base |
将一些共享的公约属性添加到项目中,它们与报告的生成有关。 |