gradle加载spring包
2023-09-27 14:23:13 时间
import org.gradle.plugins.ide.eclipse.model.Facet
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'eclipse-wtp'
sourceCompatibility = 1.7 // 设置 JDK 版本
webAppDirName = 'WebContent' // 设置 WebApp 根目录
sourceSets.main.java.srcDir 'src/main/java' // 设置 Java 源码所在目录
// 设置 maven 库地址
repositories {
mavenCentral() // 中央库
}
// 设置依赖
dependencies {
providedCompile 'javax.servlet:servlet-api:2.5' // 编译期
providedRuntime 'javax.servlet:jstl:1.2' // 运行时
compile 'org.springframework:spring-context:4.3.8.RELEASE'
compile group: 'org.springframework', name: 'spring-core', version: '4.3.8.RELEASE'
compile group: 'org.springframework', name: 'spring-beans', version: '4.3.8.RELEASE'
compile group: 'org.springframework', name: 'spring-context', version: '4.3.8.RELEASE'
compile group: 'org.springframework', name: 'spring-context-support', version: '4.3.8.RELEASE'
compile group: 'org.springframework', name: 'spring-web', version: '4.3.8.RELEASE'
compile group: 'org.springframework', name: 'spring-webmvc', version: '4.3.8.RELEASE'
compile group: 'org.springframework', name: 'spring-aop', version: '4.3.8.RELEASE'
compile group: 'org.springframework', name: 'spring-tx', version: '4.3.8.RELEASE'
compile group: 'org.springframework', name: 'spring-jdbc', version: '4.3.8.RELEASE'
compile group: 'org.springframework', name: 'spring-test', version: '4.3.8.RELEASE'
compile group: 'org.springframework.data', name: 'spring-data-jpa', version: '1.11.3.RELEASE'
}
// 设置 Project Facets
eclipse {
wtp {
facet {
facet name: 'jst.web', type: Facet.FacetType.fixed
facet name: 'wst.jsdt.web', type: Facet.FacetType.fixed
facet name: 'jst.java', type: Facet.FacetType.fixed
facet name: 'jst.web', version: '3.1'
facet name: 'jst.java', version: '1.7'
facet name: 'wst.jsdt.web', version: '1.0'
}
}
}
设置spring 版本
dependencies { // 设置依赖 def springVersion='4.3.8.RELEASE' dependencies { providedCompile 'javax.servlet:servlet-api:2.5' // 编译期 providedRuntime 'javax.servlet:jstl:1.2' // 运行时 compile 'org.springframework:spring-context:$springVersion' compile group: 'org.springframework', name: 'spring-core', version:'$springVersion' compile( 'org.springframework:spring-beans: $springVersion', 'org.springframework:spring-context-support:$springVersion', 'org.springframework:spring-web:$springVersion', 'org.springframework:spring-webmvc:$springVersion', 'org.springframework:spring-aop:$springVersion', 'org.springframework:spring-tx:$springVersion', 'org.springframework:spring-jdbc:$springVersion', 'org.springframework:spring-test:$springVersion', 'org.springframework:spring-context:$springVersion' ) compile group: 'org.springframework.data', name: 'spring-data-jpa', version: '1.11.3.RELEASE' } testCompile group: 'junit', name: 'junit', version: '4.11' testCompile group: 'junit', name: 'junit', version: '4.12' }
相关文章
- 一文带你搞懂从动态代理实现到Spring AOP
- SPRING SECURITY JAVA配置:Web Security
- [转] spring的普通类中如何取session和request对像
- Spring MVC源码(一) ----- 启动过程与组件初始化
- 第二章 第二个spring-boot程序
- Spring Boot 配置 HTTPS 详细流程,还有谁不会?
- 京东一面:Spring 为何需要三级缓存解决循环依赖,而不是二级缓存?
- springcloud微服务一:spring boot基础项目搭建及问题处理
- Spring Boot (十三): Spring Boot 小技巧
- spring BeanUtils.copyProperties只拷贝不为null的属性
- spring sts4 如何添加tomcat 服务
- 在Spring应用中创建全局获取ApplicationContext对象
- Spring在代码中获取bean的几种方式
- 从头认识Spring-1.1 什么是依赖注入?为什么须要依赖注入?
- spring成神之路第二十五篇:@Value【用法、数据来源、动态刷新】
- spring InitializingBean接口
- 【微服务~原始真解】Spring Cloud —— 配置绑定和配置属性校验
- [ SSM ] 浅谈 SSM 框架(Spring+SpringMVC+MyBatis)
- 客快物流大数据项目(一百一十六):远程调用 Spring Cloud Feign