gradle基础的build文件模板_jetty
- group '组织名'
- version '版本号'
/* 支持的插件 */- apply plugin: 'java' // 项目基础变成语言支持为java
- apply plugin: 'war' // 可将项目打包成war形式运行
- apply plugin: 'eclipse' // 支持ECLIPSE的导入和编辑
- apply plugin: 'eclipse-wtp' // 支持ECLIPSE-WEB的导入和编辑
- apply plugin: 'idea' // 支持IntelliJ IDEA直接导入和编辑
- apply plugin: 'jetty' // 使用jetty作为服务器,也可自行替换为tomcat作为服务器
- sourceCompatibility = 1.6 // jdk版本
- targetCompatibility = 1.6
- compileJava.options.encoding = 'UTF-8' // 使gradle支持中文字符,如果没有这段配置,代码中的中文字符将会出现无法编译性错误
compileTestJava.options.encoding = 'UTF-8'
- sourceSets.main.output.classesDir = file("bin") // 为了配合eclipse而定义的文件结构
- repositories {
maven {
url "http://maven.aliyun.com/nexus/content/groups/public/" // 这个仓库好,下载jar包的速度超级快
}
mavenLocal() // maven本地仓库
mavenCentral() // maven远程仓库
flatDir name: 'localRepository', dirs: 'lib'
}- // 综合版本控制
- project.ext {
- springVersion = '4.3.2.RELEASE' /* 框架版本控制 */
- aspectjVersion = '1.8.9'
- jacksonVersion = '2.8.4'
- }
- dependencies {
- providedCompile ( // 为了eclipse能正常编译
- 'javax.servlet:servlet-api:3.0-alpha-1',
- 'tomcat:servlet:4.1.36',
- 'javax.servlet:jstl:1.1.2',
- 'taglibs:standard:1.1.2' /* JSP的扩展标记库 */
- )
- compile (
- 'com.google.guava:guava:20.0',
- 'org.springframework:spring-web:' + springVersion,
- 'org.springframework:spring-webmvc:' + springVersion,
- 'org.springframework:spring-aop:' + springVersion
- runtime (
- 'org.slf4j:slf4j-log4j12:1.7.5',
- 'log4j:log4j:1.2.17'
- )
- testCompile (
- 'junit:junit:4.4',
- 'org.springframework:spring-test:' + springVersion
- )
- }
- jettyRunWar.contextPath = ''
- /* jettyRun 的配置 */
- jettyRun {
- httpPort = 8080 // 服务端口,可自定义
- reload = "automatic" // 当代码重新编译时,系统会自动重载
- scanIntervalSeconds = 1
- contextPath = '项目名或者为空,即ROOT'
- }
- task wrapper(type: Wrapper) {
- gradleVersion = '2.14.1' // gradle的版本选择,可自定义版本
- }
注释:我认为,针对与java开发,红色部分的配置为必须的。
再来一个新版本的,跟之前的版本类似,部分小地方有改动。
- group 'com.cloud13th'
- version '1.0'
- apply plugin: 'java'
- apply plugin: 'war'
- apply plugin: 'eclipse'
- apply plugin: 'eclipse-wtp'
- apply plugin: 'idea'
- apply plugin: 'jetty'
- apply plugin: 'pmd'
- apply plugin: 'findbugs' /* 代码检查工具 */
- sourceCompatibility = 1.8 /* JDK版本和编译版本 */
- targetCompatibility = 1.8
- /* 支持中文字符 */
- [compileJava, compileTestJava, javadoc]*.options*.encoding = "UTF-8"
- sourceSets.main.output.classesDir = file("bin")
- repositories {
- maven {
- url "http://maven.aliyun.com/nexus/content/groups/public/"
- }
- mavenLocal()
- mavenCentral()
- flatDir name: 'localRepository', dirs: 'lib'
- }
- project.ext {
- springVersion = '4.3.4.RELEASE'
- aspectjVersion = '1.8.9'
- jacksonVersion = '2.8.4'
- }
- dependencies {
- providedCompile(
- 'javax.servlet:servlet-api:3.0-alpha-1',
- 'javax.servlet:jstl:1.1.2',
- 'taglibs:standard:1.1.2'
- )
- compile(
- fileTree(dir: 'lib', include: ['*.jar']), /* 包含lib文件夹下的所有jar文件 */
- 'com.google.guava:guava:20.0',
- 'org.springframework:spring-core:' + springVersion,
- 'org.springframework:spring-web:' + springVersion,
- 'org.springframework:spring-webmvc:' + springVersion,
- 'org.springframework:spring-aop:' + springVersion,
- 'org.aspectj:aspectjrt:' + aspectjVersion,
- 'org.aspectj:aspectjweaver:' + aspectjVersion,
- 'org.aspectj:aspectjtools:' + aspectjVersion,
- /* 日志 */
- 'org.slf4j:slf4j-api:1.7.23',
- 'org.slf4j:slf4j-log4j12:1.7.23',
- 'log4j:log4j:1.2.17',
- 'commons-logging:commons-logging:1.2',
- /* 连接池 */
- 'com.alibaba:druid:1.0.27',
- /* json */
- 'org.codehaus.jackson:jackson-mapper-asl:1.9.13',
- 'org.codehaus.jackson:jackson-core-asl:1.9.13',
- 'com.fasterxml.jackson.core:jackson-core:' + jacksonVersion,
- 'com.fasterxml.jackson.core:jackson-databind:' + jacksonVersion,
- 'com.fasterxml.jackson.core:jackson-annotations:' + jacksonVersion,
- 'org.apache.poi:poi:3.15',
- 'org.apache.poi:poi-ooxml:3.15',
- 'com.github.virtuald:curvesapi:1.04',
- 'commons-codec:commons-codec:1.10',
- 'org.apache.poi:poi-ooxml-schemas:3.15',
- 'org.apache.commons:commons-collections4:4.1',
- 'commons-io:commons-io:2.2',
- 'commons-fileupload:commons-fileupload:1.3.2',
- 'com.belerweb:pinyin4j:2.5.1'
- )
- testCompile(
- 'junit:junit:4.12',
- 'org.hamcrest:hamcrest-core:1.3', /* 一个测试用的工具 */
- 'org.springframework:spring-test:' + springVersion
- )
- }
- /* jettyRun 的配置 */
- jettyRun {
- httpPort = 8080
- reload = "automatic"
- scanIntervalSeconds = 1
- contextPath = 'dataImport'
- }
- test {
- ignoreFailures = true
- }
- pmd {
- ignoreFailures = true
- }
- findbugs {
- sourceSets = [sourceSets.main]
- ignoreFailures = true
- reportsDir = file("$project.buildDir/findbugsReports")
- effort = "default"
- reportLevel = "medium"
- }
- task wrapper(type: Wrapper) {
- gradleVersion = '2.14.1'
- }
无关的讯息自动忽略掉吧,只取需要的就行。
gradle基础的build文件模板_jetty的更多相关文章
- gradle基础的build文件模板_tomcat
group '组织名' version '版本号' /* 支持的插件 */ apply plugin: 'java' // 项目基础变成语言支持为java apply plugin: 'war' // ...
- Gradle基础
什么是Gradle? Gradle是一种依赖管理工具,基于Groovy语言,面向Java应用为主,它抛弃了基于XML的各种繁琐配置,取而代之的是一种基于Groovy的内部领域特定(DSL)语言. Gr ...
- Android studio:Groovy 与 Gradle 基础【三】
转载:http://www.apkbus.com/forum.php?mod=viewthread&tid=255064&extra=page%3D2%26filter%3Dautho ...
- Android Studio系列教程四--Gradle基础
Android Studio系列教程四--Gradle基础 2014 年 12 月 18 日 DevTools 本文为个人原创,欢迎转载,但请务必在明显位置注明出处!http://stormzhang ...
- 【转】Android Studio安装配置学习教程指南 Gradle基础--不错
原文网址:http://www.linuxidc.com/Linux/2015-02/113890p4.htm 其实很早之前也写了一篇Gradle的基础博客,但是时间很久了,现在Gradle已经更新了 ...
- android studio学习----gradle基础
Gradle是一种依赖管理工具,基于Groovy语言,面向Java应用为主,它抛弃了基于XML的各种繁琐配置,取而代之的是一种基于Groovy的内部领域特定(DSL)语言. 安装Gradle 在And ...
- Gradle系列之Android Gradle基础配置
原文发于微信公众号 jzman-blog,欢迎关注交流. 通过前面几篇文章学习了 Gradle 基础知识以及 Gradle 插件相关的知识,关于 Gradle 及其插件相关知识请先阅读下面几篇文章: ...
- 基于androidstudio3.0的build文件配置问题
最近,在研究APP自动化相关的东西,在搭建环境的时候,遇到的坑以及最后解决的方法,不过目前很多东西了解得还不是很细,暂时先简单的记录一下一.build配置文件 主要分为两种: 1.工程下的build配 ...
- Maven 项目依赖 pom 文件模板
下面是网上down的 pom 文件模板: <!-- 属性 --> <properties> <spring.version>4.2.4.RELEASE</sp ...
随机推荐
- poj 3254 状压dp入门题
1.poj 3254 Corn Fields 状态压缩dp入门题 2.总结:二进制实在巧妙,以前从来没想过可以这样用. 题意:n行m列,1表示肥沃,0表示贫瘠,把牛放在肥沃处,要求所有牛不能相 ...
- Node.js 手册查询-4-Express 方法
express 标签(空格分隔): node.js express [TOC] 安装: 新版本中命令行工具分家了 npm install -g express //安装 express 然后 npm ...
- sencha 安装、学习
sencha touch 是Extjs 的手机版,Extjs是创建富客户端的AJAX应用中的重量级框架,sencha touch当然就是面向触摸设备的重量级js框架,在做基于桌面的网页时经常用的js ...
- RecyclerView使用时遇到的问题
一.概述 二.常见问题: 1.如何为RecyclerView的Item设置点击事件? 1.1 问题描述 类似于下列方法 RecyclerView.setOnItemClickListener(OnCl ...
- scala - Enumeration 诡异问题
object WeekDay extends Enumeration { type WeekDay = Value val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Va ...
- HDU 4006 优先队列
The kth great number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Oth ...
- 面试之Java多线程
Java多线程1.什么是多线程2.为什么需要多线程 有什么优点和缺点3.怎么运行 一.多线程是在软件或硬件上并发执行的技术共享数据空间,内存资源和CPU二.优点:把长时间运行的程序任务放到后台处理, ...
- centos6 LVS-DR模式---分析
LVS是什么就不多说了. 先上拓扑图 1台LVS 3台Realserver 一个客户端. 环境全部模拟全在内网环境(selinux和iptables关闭) 先简略说一下安装步骤: LVS上 ...
- thinkphp自定义权限管理之名称判断
权限管理,就是给不同的用户分配不同的权限.当用户登录或者操作时候进行判断,来阻止用户进行权限以外的操作.本次讲的是当用户登录一刻,只显示权限开启的内容. 一.建立数据库. 1.权限表funcla.来存 ...
- BizTalk开发系列(三十六) Orchestration单实例执行
BizTalk 是高效的消息处理引擎,采用多线程并发的方式来处理消息.也就是说当有消息被接收的时候就会产生一个新的消息处理实例.但有时目标系统可能并没有并发处理 的能力, 这时就需要在BizTalk中 ...