转载地址:http://ask.android-studio.org/?/article/8

This chapter is a work in progress.这一章是一项正在进行中的工作。

This chapter introduces the Gradle support for web applications. Gradle provides two plugins for web application development: the War plugin and the Jetty plugin. The War plugin extends the Java plugin to build a WAR file for your project. The Jetty plugin extends the War plugin to allow you to deploy your web application to an embedded Jetty web container.
<翻译>这一章介绍Gradle对网络应用的支持。Gradle为网络应用开发提供了2个插件:War和Jetty。War继承自Java,为你的项目构建一个War文件。Jetty继承自War,允许你部署你的网络应用到一个嵌入式Jetty网络容器。

10.1. Building a WAR file 构建一个War文件

To build a WAR file, you apply the War plugin to your project:
<翻译>如果想要构建一个War文件,你需要在你的项目中应用War插件

Example 10.1. War plugin 
<翻译>例 10.1.War插件

build.gradle
apply plugin: 'war'

Note: The code for this example can be found at samples/webApplication/quickstart which is in both the binary and source distributions of Gradle.
This also applies the Java plugin to your project. Running gradle build will compile, test and WAR your project. Gradle will look for the source files to include in the WAR file in src/main/webapp. Your compiled classes and their runtime dependencies are also included in the WAR file, in the WEB-INF/classes and WEB-INF/lib directories, respectively.
<翻译>笔记:例子的代码可以在Gradle的二进制和源分布文件的samples/webApplication/quickstart中找到。同时也需要在你的项目中应用Java插件。运行gradle build命令将编译,测试和打包(War包)你的项目。gradle将查找源文件放到war文件的src/main/webapp路径下。你编译的类和它们运行时的依赖文件也会分别放到war文件的WEB-INF/classes和WEB-INF/lib路径下。

Groovy web applications Groovy网络应用

You can combine multiple plugins in a single project, so you can use the War and Groovy plugins together to build a Groovy based web application. The appropriate Groovy libraries will be added to the WAR file for you.
<翻译>你能够在一个项目中结合多个插件,所以你可以同时使用War和Groovy构建一个基于Groovy的网络应用

10.2. Running your web application 运行你的网络应用

To run your web application, you apply the Jetty plugin to your project:
<翻译>如果想要运行你的网络应用,你需要在你的项目中应用Jetty插件。

Example 10.2. Running web application with Jetty plugin 
<翻译>例 10.2.使用Jetty插件运行网络应用

build.gradle
apply plugin: 'jetty'

This also applies the War plugin to your project. Running gradle jettyRun will run your web application in an embedded Jetty web container. Running gradle jettyRunWar will build the WAR file, and then run it in an embedded web container.
<翻译>这里同样需要在你的项目中应用War插件。运行gradle jettyRun命令将在一个嵌入式Jetty玩了容器中运行你的网络应用。运行gradle jettyRunWar命令将构建War文件,接着在一个嵌入式Jetty玩了容器中运行你的网络应用。

TODO: which url, configure port, uses source files in place and can edit your files and reload.
<翻译> TODO:哪个url,配置端口,使用源文件并编辑和重载你的文件。

10.3. Summary 摘要

You can find out more about the War plugin in Chapter 26, The War Plugin and the Jetty plugin in Chapter 28, The Jetty Plugin. You can find more sample Java projects in the samples/webApplication directory in the Gradle distribution.
<翻译>你可以在第二十六章中发现更多关于War插件的说明,在第二十六章中发现更多关于War插件和Jetty插件的说明。你可以在gradle中samples/webApplication找到更多的java项目示例。

原文地址:http://www.gradle.org/docs/cur ... .html
翻译者:wellchang
邮箱:2483808264@qq.com

如对翻译内容有异议,请在评论区提出或联系作者

【转载】Gradle学习 第十章:网络应用快速入门的更多相关文章

  1. 【转】MyBatis学习总结(一)——MyBatis快速入门

    [转]MyBatis学习总结(一)——MyBatis快速入门 一.Mybatis介绍 MyBatis是一个支持普通SQL查询,存储过程和高级映射的优秀持久层框架.MyBatis消除了几乎所有的JDBC ...

  2. MyBatis学习总结(一)——MyBatis快速入门(转载)

    本文转载自http://www.cnblogs.com/jpf-java/p/6013537.html MyBatis是一个支持普通SQL查询,存储过程和高级映射的优秀持久层框架.MyBatis消除了 ...

  3. 大数据技术之_09_Flume学习_Flume概述+Flume快速入门+Flume企业开发案例+Flume监控之Ganglia+Flume高级之自定义MySQLSource+Flume企业真实面试题(重点)

    第1章 Flume概述1.1 Flume定义1.2 Flume组成架构1.2.1 Agent1.2.2 Source1.2.3 Channel1.2.4 Sink1.2.5 Event1.3 Flum ...

  4. JavaScript学习02(js快速入门)

    快速入门 基本语法 JavaScript的语法和Java的语法类似,每个语句以;结束,语句块用{...}.但是JavaScrip并不强制要求在每个语句的结尾加;,浏览器中负责执行JavaScript代 ...

  5. MyBatis学习总结(一)——MyBatis快速入门

    一.Mybatis介绍 MyBatis是一个支持普通SQL查询,存储过程和高级映射的优秀持久层框架.MyBatis消除了几乎所有的JDBC代码和参数的手工设置以及对结果集的检索封装.MyBatis可以 ...

  6. 【Python】【学习笔记】1.快速入门

    1.软件安装 从官网下载相应版本的安装包,一般不大. https://www.python.org/ 安装一路默认即可 2. 参考教程:快速入门:十分钟学会Python 本文的内容介于教程(Totur ...

  7. MyBatis学习总结(一)——MyBatis快速入门

    一.Mybatis介绍 MyBatis是一个支持普通SQL查询,存储过程和高级映射的优秀持久层框架.MyBatis消除了几乎所有的JDBC代码和参数的手工设置以及对结果集的检索封装.MyBatis可以 ...

  8. Mybatis学习(一) - 快速入门

    MyBatis是支持普通SQL查询,存储过程和高级映射的优秀持久层框架. MyBatis消除了几乎所有的JDBC代码和参数的手工设置以及对结果集的检索封装. MyBatis可以使用简单的XML或注解用 ...

  9. MyBatis学习笔记(一)——MyBatis快速入门

    转自孤傲苍狼的博客:http://www.cnblogs.com/xdp-gacl/p/4261895.html 一.Mybatis介绍 MyBatis是一个支持普通SQL查询,存储过程和高级映射的优 ...

随机推荐

  1. 201871010135 张玉晶《面向对象程序设计(java)》第十二周学习总结

      内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 https://www.cnblogs.com/zyja/p/118654 ...

  2. JVM 启动参数,共分为3类

    JVM 启动参数,共分为3类: 类别 说明 标准参数(-) 所有的JVM实现都必须实现这些参数的功能,而且向后兼容: 非标准参数(-X) 这些参数不是虚拟机规范规定的.因此,不是所有VM的实现(如:H ...

  3. 69.x的平方根 (平)(简单)

    实现 int sqrt(int x) 函数. 计算并返回 x 的平方根,其中 x 是非负整数. 由于返回类型是整数,结果只保留整数的部分,小数部分将被舍去. 示例 1: 输入: 4输出: 2示例 2: ...

  4. Docker常用安装(九)

    一.安装mysql 1.  docker hub上面查找mysql镜像 2. 拉取镜像 #获取mysql镜像 docker pull mysql:5.6 3. 运行容器 docker run -p 1 ...

  5. jenkins+maven+svn实现springboot项目的自动化部署过程

    说明:部署springboot项目的jar 前提(参考:https://www.cnblogs.com/myitnews/p/11493779.html): 全局安全配置(前面配置过) 全局工具配置( ...

  6. js将字符串内空格去除的方法

    function noSpace(x){ if(x.match(/\s*/g)){ return x.replace(/\s*/g,""); }else{ return x; } ...

  7. ES5.1下的作用域链

    作用域链(ES5.1规格视角) javascript作用域类型 javascript采用的是词法作用域(静态作用域) 与之相对的是动态作用域,以下的例子可以很好地说明 let a = 3 functi ...

  8. html头部中各式各样的meta

    在写网页的过程中,第一步就是创建一个html文档.如下是最简单的 html5 文档. <!DOCTYPE html> <html lang="en"> &l ...

  9. Golang 基础语法介绍及对比(二)

    传值与传参 Golong func main() { a := fmt.Println("a = ", a) // 应该输出 "a= 3" a1 := add1 ...

  10. postman使用的时候注意的坑

    https://cloud.tencent.com/developer/article/1341037