【转载】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查询,存储过程和高级映射的优 ...
随机推荐
- 201871010128-杨丽霞《面向对象程序设计(java)》第十周学习总结
201871010128-杨丽霞<面向对象程序设计(java)>第十周学习总结 项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这 ...
- IIS网站应用偶尔出现"服务不可用"或者显示乱码字体
IIS网站应用偶尔出现"服务不可用"或者显示乱码字体,使用以下办法可以解决. 原因:此种情况常会出现在iis是在Visual Studio或者.NET Framework之后安装发 ...
- LeetCode 145. Binary Tree Postorder Traversal二叉树的后序遍历 (C++)
题目: Given a binary tree, return the postorder traversal of its nodes' values. Example: Input: [1,nul ...
- File.createNewFile和 File.createTempFile比较和区别
原文地址:http://wzhiju.iteye.com/blog/1119037 最近,在看代码时看到了一个方法, File.createTempFile() ,由此联想到File.createNe ...
- 【LG1600】[NOIP2016]天天爱跑步
[LG1600][NOIP2016]天天爱跑步 题面 洛谷 题解 考虑一条路径\(S\rightarrow T\)是如何给一个观测点\(x\)造成贡献的, 一种是从\(x\)的子树内出来,另外一种是从 ...
- [LeetCode] 565. Array Nesting 数组嵌套
A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest ...
- Oracle 10G RAC集群安装
一,基本环境配置 01,hosts cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.loc ...
- Java软件生产监控工具Btrace的使用
Btrace BTrace是sun公司推出的一款Java 动态.安全追踪(监控)工具,可以在不用重启的情况下监控系统运行情况,方便的获取程序运行时的数据信息,如方法参数.返回值.全局变量和堆栈信息等, ...
- Github的初始设置
设置姓名和邮箱地址 git config --global user.name "Firstname Lastname" git config --global user.emai ...
- 容斥原理--计算错排的方案数 UVA 10497
错排问题是一种特殊的排列问题. 模型:把n个元素依次标上1,2,3.......n,求每一个元素都不在自己位置的排列数. 运用容斥原理,我们有两种解决方法: 1. 总的排列方法有A(n,n),即n!, ...