Gradle 2.0 用户指南翻译——第二十二章. 标准的 Gradle 插件

翻译项目请关注Github上的地址:
https://github.com/msdx/gradledoc
本文翻译所在分支:
https://github.com/msdx/gradledoc/tree/2.0 。
在线浏览地址:
http://gradledoc.qiniudn.com/2.0/userguide/userguide.html 。
另外,Android 手机用户可通过我写的一个程序浏览文档,带缓存功能的,目前0.6开发中版本兼容 Android 2.3以上系统,项目地址如下:
https://github.com/msdx/gradle-doc-apk
翻译不易,转载请注明本文在CSDN博客上的出处:
https://blog.csdn.net/maosidiaoxian/article/details/80106838

关于我对Gradle的翻译,以Github上的项目及http://gradledoc.qiniudn.com 上的文档为准。如发现翻译有误的地方,将首先在以上两个地方更新。因时间精力问题,博客中发表的译文基本不会同步修改。


第二十二章. 标准的 Gradle 插件

Chapter 22. Standard Gradle plugins

Gradle 发行版中包含一些插件,如下列所示 
There are a number of plugins included in the Gradle distribution. These are listed below.

22.1. 语言插件

22.1. Language plugins

这些插件添加了让各种语言可以在 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
javajava-base-

向一个项目添加 Java 编译,测试和捆绑的功能。它是许多其他 Gradle 插件的基础服务。另请参阅《第7章,Java 快速入门》。


Adds Java compilation, testing and bundling capabilities to a project. It serves as the basis for many of the other Gradle plugins. See also Chapter 7, Java Quickstart.

groovyjavagroovy-base-

添加对 Groovy 项目构建的支持。另请参阅《第九章,Groovy 快速入门》。


Adds support for building Groovy projects. See also Chapter 9, Groovy Quickstart.

scalajavascala-base-

添加对 Scala 项目构建的支持。


Adds support for building Scala projects.

antlrjava-

添加对使用 Antlr 作为生成解析器的支持。


Adds support for generating parsers using Antlr.

22.2. 试验性的语言插件

22.2. Incubating language plugins

这些插件添加了对各种语言的支持:
These plugins add support for various languages:

表 22.2. 语言插件 - Table 22.2. Language plugins

插件 Id
Plugin Id
自动应用
Automatically applies
与什么一起使用
Works with
描述
Description
assembler--

向项目添加本地汇编语言的功能。


Adds native assembly language capabilities to a project.

c--

向项目添加 C语言代码编译的功能。


Adds C source compilation capabilities to a project.

cpp--

向项目添加 C++ 代码编译的功能。


Adds C++ source compilation capabilities to a project.

objective-c--

向项目中添加 Objective-C 代码编译的功能。


Adds Objective-C source compilation capabilities to a project.

objective-cpp--

向项目中添加 Objective-C 代码编译的功能。


Adds Objective-C++ source compilation capabilities to a project.

windows-resources--

添加对本地二进制文件包含 Windows 资源的支持。


Adds support for including Windows resources in native binaries.

22.3. 集成插件

22.3. Integration plugins

以下这些插件提供了一些与各种运行时技术的集成。
These plugins provide some integration with various runtime technologies.

表 22.3. 集成插件 - Table 22.3. Integration plugins

插件 Id
Plugin Id
自动应用
Automatically applies
与什么一起使用
Works with
描述
Description
applicationjava-

添加了一些用于运行和捆绑 Java 项目的任务作为命令行应用程序。


Adds tasks for running and bundling a Java project as a command-line application.

ear-java

添加用于构建 J2EE 应用程序的支持。


Adds support for building J2EE applications.

jettywar-

在构建中将你的 web 应用程序部署到内嵌的 Jetty web 容器中。另请参阅《第十章,Web 应用程序快速入门》。


Deploys your web application to a Jetty web container embedded in the build. See also Chapter 10, Web Application Quickstart.

maven-javawar

添加将项目发布到 Maven 仓库的支持。


Adds support for publishing artifacts to Maven repositories.

osgijava-basejava

添加构建 OSGi 包的支持。


Adds support for building OSGi bundles.

warjava-

添加装配 web 应用程序的 WAR 文件的支持。另请参阅《第十章,Web 应用程序快速入门》。


Adds support for assembling web application WAR files. See also Chapter 10, Web Application Quickstart.

22.4. 试验性的集成插件

22.4. Incubating integration plugins

以下这些插件提供了一些与各种运行时技术的集成。
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 分发包的支持。


Adds support for building ZIP and TAR distributions.

java-library-distributionjavadistribution-

添加构建 Java 库的 ZIP 和 TAR 分发包的支持。


Adds support for building ZIP and TAR distributions for a Java library.

ivy-publish-javawar

这个插件提供了一个新的 DSL,用于支持发布工件到 Ivy 存储库,它改进了现有的 DSL。


This plugin provides a new DSL to support publishing artifacts to Ivy repositories, which improves on the existing DSL.

maven-publish-javawar

这个插件提供了一个新的 DSL,用于支持发布工件到 Maven 存储库,它改进了现有的 DSL。


This plugin provides a new DSL to support publishing artifacts to Maven repositories, which improves on the existing DSL.

22.5. 软件开发插件

22.5. Software development plugins

这些插件为你的软件开发过程提供帮助。
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。


Publish messages to your favourite platforms, such as Twitter or Growl.

build-announcementsannounce-

在构建的生命周期中,把本地公告中有关你感兴趣的事件发送到你的桌面。


Sends local announcements to your desktop about interesting events in the build lifecycle.

checkstylejava-base-

对你的项目的 Java 源文件使用 Checkstyle 执行质量检查并生成报告。


Performs quality checks on your project's Java source files using Checkstyle and generates reports from these checks.

codenarcgroovy-base-

对你的项目的 Groovy 源文件使用 CodeNarc 执行质量检查并生成报告。


Performs quality checks on your project's Groovy source files using CodeNarc and generates reports from these checks.

eclipse-java,groovyscala

生成 Eclipse IDE 所用到的文件,从而使项目能够导入到 Eclipse。另请参阅《第七章,Java 快速入门》。


Generates files that are used by Eclipse IDE, thus making it possible to import the project into Eclipse. See also Chapter 7, Java Quickstart.

eclipse-wtp-earwar

与 eclipse 插件一样,但它还生成 eclipse WTP(Web 工具平台)的配置文件。你的 war/ear 项目在导入 eclipse 后,应配置为能在 WTP 中使用。另请参阅《第七章,Java 快速入门》。


Does the same as the eclipse plugin plus generates eclipse WTP (Web Tools Platform) configuration files. After importing to eclipse your war/ear projects should be configured to work with WTP. See also Chapter 7, Java Quickstart.

findbugsjava-base-

对你的项目的 Java 源文件使用 FindBugs 执行质量检查并生成报告。


Performs quality checks on your project's Java source files using FindBugs and generates reports from these checks.

idea-java

生成 Intellij IDEA IDE 所用到的文件,从而使项目能够导入到 IDEA。


Generates files that are used by Intellij IDEA IDE, thus making it possible to import the project into IDEA.

jdependjava-base-

使用 JDepend 对你的项目的源文件执行质量检查并生成报告。


Performs quality checks on your project's source files using JDepend and generates reports from these checks.

pmd 
pmd
java-base-

对你的项目的 Java 源文件使用 PMD 执行质量检查并生成报告。


Performs quality checks on your project's Java source files using PMD and generates reports from these checks.

project-reportreporting-base-

生成包括了关于你的 Gradle 构建的有用信息的报告。


Generates reports containing useful information about your Gradle build.

signingbase-

添加对生成的文件或工件进行数字签名的功能。


Adds the ability to digitally sign built files and artifacts.

sonar-java-base,java,jacoco
java-base, java, jacoco

提供对 Sonar 代码质量平台的集成。已经被 sonar-runner 插件取代。


Provides integration with the Sonar code quality platform. Superceeded by the sonar-runner plugin.

22.6. 试验性的软件开发插件

22.6. Incubating software development plugins

这些插件为你的软件开发过程提供帮助。
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-dashboardreporting-base-

生成构建仪表板报告。


Generates build dashboard report.

build-initwrapper-

添加用于初始化一个新 Gradle 构建的支持,以及处理从 Maven 构建到 Gradle 构建的转换。


Adds support for initializing a new Gradle build. Handles converting a Maven build to a Gradle build.

cunit--

添加用于运行 CUnit 测试的支持。


Adds support for running CUnit tests.

jacocoreporting-basejava

提供对 Java 的JaCoCo 代码覆盖率库的集成。


Provides integration with the JaCoCo code coverage library for Java.

sonar-runner-java-base,java,jacoco
java-base, java, jacoco

取代 sonar 插件,提供对 Sonar 代码质量平台的集成。


Provides integration with the Sonar code quality platform. Supersedes the sonar plugin.

visual-studio-本机语言插件
native language plugins

添加对 Visual Studio 的集成。


Adds integration with Visual Studio.

wrapper--

添加用于生成 Gradle wrapper 文件的 Wrapper 任务。


Adds a Wrapper task for generating Gradle wrapper files.

22.7. 基本插件

22.7. Base plugins

这些插件构成了基本构建块,其他插件都由此组装而来。它们可供您在构建文件中使用,并在此处完整列出。但是请注意,它们还没有被视为 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

添加标准的生命周期任务,并为归档任务默认进行合理的配置:

  • 添加构建 ConfigurationName 的任务,这些任务组装了属于指定配置的工件。
  • 添加上传 ConfigurationName 的任务,这些任务组装并上传属于指定配置的工件。
  • 为所有归档任务(比如从 AbstractArchiveTask 中继承的任务)配置合理的默认值。例如,以下类型的归档任务:JarTarZip。确切地说,是对这些归档任务的 destinationDirbaseName 和 version 属性预先配置了默认值。这是非常有用的,因为它可以推动项目之间的一致性,以及关于构建完成后档案的命名规范及其位置的一致性。


Adds the standard lifecycle tasks and configures reasonable defaults for the archive tasks:

  • adds build ConfigurationName tasks. Those tasks assemble the artifacts belonging to the specified configuration.
  • adds upload ConfigurationName tasks. Those tasks assemble and upload the artifacts belonging to the specified configuration.
  • configures reasonable default values for all archive tasks (e.g. tasks that inherit from AbstractArchiveTask). For example, the archive tasks are tasks of types: JarTarZip. Specifically, destinationDirbaseName and version properties of the archive tasks are preconfigured with defaults. This is extremely useful because it drives consistency across projects; the consistency regarding naming conventions of archives and their location after the build completed.

java-base

对项目添加源集的概念。它不会添加任何特定的源集。


Adds the source sets concept to the project. Does not add any particular source sets.

groovy-base

向项目添加 Groovy 源集的概念。


Adds the Groovy source sets concept to the project.

scala-base

向项目添加 Scala 源集的概念。


Adds the Scala source sets concept to the project.

reporting-base

将一些共享的约定属性添加到项目中,它们与报告的生成有关。


Adds some shared convention properties to the project, relating to report generation.

22.8. 第三方插件

22.8. Third party plugins

你可以在维基上找到外部插件列表。 
You can find a list of external plugins on the wiki.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值