一份IDEA + gradle + spring项目的build.gradle清单
2017-04-22 14:39
176 查看
group 'com.superserver' version '1.0-SNAPSHOT' // 应用Gradle各插件 apply plugin: 'java' apply plugin: 'war' // war包生产插件 apply plugin: 'idea' apply plugin: 'org.akhikhl.gretty' // 应用gretty插件 version = "" // 项目版本 //Gretty Embedded Jetty buildscript { repositories { jcenter() } dependencies { classpath 'org.akhikhl.gretty:gretty:+' } } // 指定JDK版本 sourceCompatibility = 1.8 targetCompatibility = 1.8 ext { jvmVersion = "1.8" springVersion = "4.0.6.RELEASE" sl4jVersion = "1.7.6" } repositories { // maven库 def cn = "http://maven.oschina.net/content/groups/public/" def abroad = "http://central.maven.org/maven2/" // 先从url中下载jar若没有找到,则在artifactUrls中寻找 maven { url cn artifactUrls abroad } } [compileJava, compileTestJava, javadoc]*.options*.encoding = "UTF-8" dependencies { def springVersion = "4.0.6.RELEASE" def hibernateVer = "4.3.6.Final" // providedCompile在编译时提供,不会写入war providedCompile( "javax.servlet:javax.servlet-api:3.1.0", "javax.servlet.jsp:jsp-api:2.2.1-b03" ) // 引入项目中/libs中的jar compile files( 'libs/spring-framework-bom-4.0.6.RELEASE.jar') compile("org.apache.taglibs:taglibs-standard-impl:1.2.1") // aspectjtools-1.6.11是测可试用版本,使用其他版本会报"dataSource无法注入"的Exception compile("javax:javaee-api:7.0", "javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.1", "org.aspectj:aspectjtools:1.6.11", "antlr:antlr:2.7.7", "org.aspectj:aspectjrt:1.6.11", "org.aspectj:aspectjmatcher:1.6.11") compile("org.apache.commons:com.springsource.org.apache.commons.fileupload:1.2.1", "commons-codec:commons-codec:1.6", "commons-collections:commons-collections:3.2.1", "commons-lang:commons-lang:2.6", "commons-logging:commons-logging:1.2", "commons-pool:commons-pool:1.5.5", "org.apache.commons:commons-lang3:3.1") // 数据库连接部分依赖 compile("mysql:mysql-connector-java:5.1.36") compile("com.mchange:mchange-commons-java:0.2.3.4", "redis.clients:jedis:2.0.0", "net.sf.ehcache:ehcache-core:2.4.3") compile("org.hibernate:hibernate-c3p0:$hibernateVer", "org.hibernate:hibernate-core:$hibernateVer", "org.hibernate:hibernate-entitymanager:$hibernateVer", "org.hibernate:hibernate-ehcache:$hibernateVer", "org.hibernate.common:hibernate-commons-annotations:4.0.5.Final") // Spring4.0.6依赖 compile("org.springframework:spring-aop:$springVersion", "org.springframework:spring-orm:$springVersion", "org.springframework:spring-jdbc:$springVersion", "org.springframework:spring-instrument-tomcat:$springVersion", "org.springframework:spring-instrument:$springVersion", "org.springframework:spring-framework-bom:$springVersion", "org.springframework:spring-expression:$springVersion", "org.springframework:spring-core:$springVersion", "org.springframework:spring-context-support:$springVersion", "org.springframework:spring-context:$springVersion", "org.springframework:spring-beans:$springVersion", "org.springframework:spring-aspects:$springVersion", "org.springframework:spring-test:$springVersion", "org.springframework:spring-tx:$springVersion", "org.springframework:spring-web:$springVersion", "org.springframework:spring-webmvc:$springVersion", "org.springframework:spring-webmvc-portlet:$springVersion") // json相关依赖 compile("com.alibaba:fastjson:1.2.7", "com.jayway.jsonpath:json-path:0.8.1", "net.minidev:json-smart:1.1.1", "org.jsoup:jsoup:1.7.2") compile("org.codehaus.jackson:jackson-core-asl:1.9.2","org.codehaus.jackson:jackson-mapper-asl:1.9.2") compile("org.dom4j:com.springsource.org.dom4j:1.6.1") compile("com.google.guava:guava:17.0") // 测试编译时的依赖 testCompile("org.assertj:assertj-core:1.5.0", "org.hamcrest:hamcrest-core:1.3", "junit:junit:4.11") } // gretty相关配置 gretty { port = 8080 contextPath = "/${project.name}" servletContainer = 'jetty9' // or tomcat7 } // 部署war到tomcat的Task task deploy (dependsOn: war){ copy { from "build/libs" into "F:/software/tomcat7/webapps" // 换成你的tomcat目录 include "*.war" } }
相关文章推荐
- HelloWorld之使用IDEA的Spring Initializer+Gradle构建Spring MVC项目
- IDEA中springboot项目热部署(含maven版本和gradle版本)
- 初来乍道多多关照,用idea构建springboot+gradle+mybatis+thymeleaf项目
- 使用idea+gradle创建springboot项目
- Kotlin的Spring之旅(一):使用IDEA搭建Gradle+Kotlin+Spring项目
- IDEA SpringBoot gradle打项目jar包(转载)
- [SpringBoot学习]-IDEA创建Gradle多Module结构的SpringBoot项目
- idea 下gradle创建springboot 项目
- idea下gradle构建的spring项目dao层xml不识别问题
- IDEA+gradle +SpringBoot 项目,bootrun 无法启动项目
- 在IDEA中导入Gradle构建的SpringBoot Web项目(SpringBoot-02)
- IDEA+gradle+spring+springMVC+hibernate+JPA+SpringData的web项目
- idea+gradle+springboot 多项目
- IDEA下创建Springboot,freemarker,mockserver,Gradle项目
- 使用IDEA+GRADLE创建springboot项目
- IDEA下gradle创建springboot项目
- IDEA SpringBoot gradle打项目jar包
- 使用Gradle构建SpringBoot工程系列:第四篇:项目初始化(编辑build.gradle文件,引入项目基本配置及依赖)
- 在IDEA下跑gradle构建的SpringBoot项目启动报“CreateProcess error=206, 文件名或扩展名太长”