【转载】Gradle学习 第十章:网络应用快速入门
转载地址: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学习 第十章:网络应用快速入门的更多相关文章
- 【转】MyBatis学习总结(一)——MyBatis快速入门
[转]MyBatis学习总结(一)——MyBatis快速入门 一.Mybatis介绍 MyBatis是一个支持普通SQL查询,存储过程和高级映射的优秀持久层框架.MyBatis消除了几乎所有的JDBC ...
- MyBatis学习总结(一)——MyBatis快速入门(转载)
本文转载自http://www.cnblogs.com/jpf-java/p/6013537.html MyBatis是一个支持普通SQL查询,存储过程和高级映射的优秀持久层框架.MyBatis消除了 ...
- 大数据技术之_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 ...
- JavaScript学习02(js快速入门)
快速入门 基本语法 JavaScript的语法和Java的语法类似,每个语句以;结束,语句块用{...}.但是JavaScrip并不强制要求在每个语句的结尾加;,浏览器中负责执行JavaScript代 ...
- MyBatis学习总结(一)——MyBatis快速入门
一.Mybatis介绍 MyBatis是一个支持普通SQL查询,存储过程和高级映射的优秀持久层框架.MyBatis消除了几乎所有的JDBC代码和参数的手工设置以及对结果集的检索封装.MyBatis可以 ...
- 【Python】【学习笔记】1.快速入门
1.软件安装 从官网下载相应版本的安装包,一般不大. https://www.python.org/ 安装一路默认即可 2. 参考教程:快速入门:十分钟学会Python 本文的内容介于教程(Totur ...
- MyBatis学习总结(一)——MyBatis快速入门
一.Mybatis介绍 MyBatis是一个支持普通SQL查询,存储过程和高级映射的优秀持久层框架.MyBatis消除了几乎所有的JDBC代码和参数的手工设置以及对结果集的检索封装.MyBatis可以 ...
- Mybatis学习(一) - 快速入门
MyBatis是支持普通SQL查询,存储过程和高级映射的优秀持久层框架. MyBatis消除了几乎所有的JDBC代码和参数的手工设置以及对结果集的检索封装. MyBatis可以使用简单的XML或注解用 ...
- MyBatis学习笔记(一)——MyBatis快速入门
转自孤傲苍狼的博客:http://www.cnblogs.com/xdp-gacl/p/4261895.html 一.Mybatis介绍 MyBatis是一个支持普通SQL查询,存储过程和高级映射的优 ...
随机推荐
- 201871010134-周英杰《面向对象程序设计(java)》第十四周学习总结
项目 内容 这个作业属于哪个课程 <https://home.cnblogs.com/u/nwnu-daizh/> 这个作业的要求在哪里 <https://www.cnblogs.c ...
- MyBatisPlus快速入门
MyBatisPlus快速入门 官方网站 https://mp.baomidou.com/guide 慕课网视频 https://www.imooc.com/learn/1130 入门 https:/ ...
- JDOJ 1770 埃及分数
JDOJ 1770: 埃及分数 https://neooj.com/oldoj/problem.php?id=1770 Description 分子均为1的分数叫做埃及分数,因为古代埃及人在进行分数运 ...
- 2.GO-可变参数函数、匿名函数和函数变量
2.1.可变参数函数 可变参数指参数的个数可以是任意个 可变参数必须在参数列表最后的位置,在参数名和类型之间添加三个点表示可变参数函数 声明函数时,在函数体把可变参数当作切片使用即可 package ...
- 【CFGym102059G】Fascination Street(思维DP)
点此看题面 大致题意: 有\(n\)个路灯,每个路灯有一定的建造费用,且建成后可照亮自身及周围距离为\(1\)的两个格子.你可以交换\(k\)次两个路灯的建造费用,求照亮所有格子的最小费用. 题意转换 ...
- windows下sed回车换行符处理
windows下sed回车换行符处理如果用sed for windows对整个文件进行了编辑,编辑之后一般需要处理回车换行符:rem windows的回车换行符是\r\n,linux的是\n,所以要替 ...
- [LeetCode] 731. My Calendar II 我的日历之二
Implement a MyCalendarTwo class to store your events. A new event can be added if adding the event w ...
- [LeetCode] 72. Edit Distance 编辑距离
Given two words word1 and word2, find the minimum number of operations required to convert word1 to ...
- [LeetCode] 52. N-Queens II N皇后问题之二
The n-queens puzzle is the problem of placing nqueens on an n×n chessboard such that no two queens a ...
- 虚拟路由冗余(VRRP)协议
1. 前言 VRRP(Virtual Router Redundancy Protocol)协议是用于实现路由器冗余的协议,最新协议在RFC3768中定义,原来的定义RFC2338被废除,新协议相对还 ...