首页 > 代码库 > gradle基础的build文件模板

gradle基础的build文件模板

group ‘组织名‘
version ‘版本号‘

/* 支持的插件 */ apply plugin:
‘java‘ apply plugin: ‘war‘ apply plugin: ‘eclipse‘ apply plugin: ‘eclipse-wtp‘ apply plugin: ‘idea‘ apply plugin: ‘jetty‘ // 使用jetty作为服务器 sourceCompatibility = 1.6 // jdk版本 targetCompatibility = 1.6 sourceSets.main.output.classesDir = file("bin") // 为了配合eclipse而定义的文件结构 repositories { maven { url "http://maven.aliyun.com/nexus/content/groups/public/" // 这个仓库好,下载jar速度超级快 } mavenLocal() mavenCentral() 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的版本选择 }

 

gradle基础的build文件模板