idea+gradle+ssm框架搭建过程
来源:互联网 发布:80端口如何开通 编辑:程序博客网 时间:2024/06/06 18:02
能看到这篇博客的肯定已经了解了相关知识,照着弄吧
项目创建完毕之后,项目的父子从属关系存在于父级项目的settings.gradle这个文件中
一、创建父级项目
1、左上角-->file-->new project
2、输入项目三坐标,version不用管
3、注意选择自己的gradle组件
4、项目创建完毕如下,我们称之为父容器
二、创建项目模块
2.1、common
1、右键父容器-->new module
2、输入ArtifactId,其他默认
3、项目创建完毕结构如下,可以看到父容器中settings.xml已经引入了子模块common
2.2、按照上述步骤,依次创建entity、dao、service这几个模块
2.3、创建controller模块,注意,这个模块是一个web工程
1、右键父容器-->new module
2、输入ArtifactId,其他默认
3、项目创建完毕结构如下
三、jar包依赖
1、这个依赖要放在父级项目的build.gradle文件中
group 'com.jk'
version '1.0-SNAPSHOT'
//添加所有项目的共享配置
subprojects {
//添加插件
apply plugin: 'java'
//编码环境jdk版本
sourceCompatibility = 1.7
//编译时jdk版本
targetCompatibility = 1.7
//仓库的配置
repositories {
//配置私服
maven {url "http://192.168.31.200:8081/nexus/content/groups/public/"}
//maven中央仓库
mavenCentral()
}
//配置外部属性
ext {
spring_version = "4.1.6.RELEASE"
}
//依赖的配置
dependencies {
// 和Maven类似,gradle导入依赖包也可以定义其作用的生命周期:
// compile:编译时必须。
// runtime:运行时必须,包括编译时。
// testCompile:测试编译时必须。
// testRuntime:测试运行时必须,包括编译时。
// 注:此外配置依赖包,还可以模块化配置、导入list、配置是否传递等。
//单元测试
testCompile group: 'junit', name: 'junit', version: '4.12'
//servlet依赖
compile "javax.servlet:servlet-api:3.0-alpha-1"
compile "javax:javaee-api:7.0"
//jstl标签库
compile "taglibs:standard:1.1.2"
compile "javax.servlet:jstl:1.2"
//公共资源包
compile "commons-logging:commons-logging:1.2"
compile "commons-lang:commons-lang:2.6"
compile "org.apache.commons:commons-collections4:4.0"
compile "commons-beanutils:commons-beanutils:1.8.3"
compile "commons-dbcp:commons-dbcp:1.4"
compile "commons-pool:commons-pool:1.6"
//文件上传
compile "commons-fileupload:commons-fileupload:1.3.1"
compile "commons-io:commons-io:2.4"
//AspectJ(切点表达式)
compile "org.aspectj:aspectjrt:1.7.4"
compile "org.aspectj:aspectjweaver:1.7.4"
//springmvc + Spring Configuration
compile "org.springframework:spring-web:$spring_version"
compile "org.springframework:spring-webmvc:$spring_version"
compile "org.springframework:spring-aop:$spring_version"
compile "org.springframework:spring-aspects:$spring_version"
compile "org.springframework:spring-beans:$spring_version"
compile "org.springframework:spring-context:$spring_version"
compile "org.springframework:spring-context-support:$spring_version"
compile "org.springframework:spring-core:$spring_version"
compile "org.springframework:spring-expression:$spring_version"
compile "org.springframework:spring-jdbc:$spring_version"
compile "org.springframework:spring-messaging:$spring_version"
compile "org.springframework:spring-orm:$spring_version"
compile "org.springframework:spring-tx:$spring_version"
compile "org.springframework:spring-test:$spring_version"
//MyBatis
compile "org.mybatis:mybatis:3.0.5"
//mybatis spring 插件
compile "org.mybatis:mybatis-spring:1.0.1"
//数据库驱动
compile "mysql:mysql-connector-java:5.1.23"
compile "com.jk.oracle:ojdbc14:1.1.14"
//连接池
compile "com.alibaba:druid:1.0.12"
//json
compile "com.google.code.gson:gson:2.2.4"
//log4j
compile "log4j:log4j:1.2.17"
}
}
2、配置各项目之间的依赖
entity依赖于common
dao依赖于entity
service依赖于dao
controller依赖于service
到此,项目之间的依赖关系处理完毕
四、创建包结构
这太简单了,不说了
五、导入配置文件
web.xml
springmvc
application
mybatis
mybatis映射文件
*.properties
六、使用gradle刷新项目,把jar都引入进来
七、部署启动项目
访问结果如下:
看到这个温馨的页面,恭喜你,大功告成!!!
阅读全文
3 0
- idea+gradle+ssm框架搭建过程
- IDEA gradle 搭建SSM框架(Mysql数据库)
- idea搭建ssm框架
- idea搭建ssm框架问题
- 使用idea搭建SSM框架
- 使用IDEA搭建SSM框架
- #**IDEA**搭建**SSM**框架步骤
- 使用IDEA maven搭建SSM框架
- IntelliJ IDEA-搭建SSM框架步骤
- idea搭建SSM框架遇到的问题
- idea maven ssm框架搭建《一》
- IDEA搭建SSM框架 以及环境配置
- MAVEN IDEA SSM框架搭建《二》
- 使用IDEA创建Gradle项目整合SSM框架
- 使用Gradle搭建SSM
- 记录:使用IDEA搭建Maven+SSM的过程
- idea中ssm(spring-spring mvc-mybatis)框架搭建
- 使用intellij idea搭建MAVEN+SSM(Spring+SpringMVC+MyBatis)框架
- 验证码插件 Demo
- MySQL服务无法启动
- 排序算法之冒泡排序
- (7)高通AP10.4开发者指南——WLAN(2.1 主要数据结构)
- 关于集合
- idea+gradle+ssm框架搭建过程
- 使用Filter过滤器,控制不能直接访问JSP文件
- php 设计模式之 单列模式
- C#Web项目中导出数据为Excel
- 定向网页爬取
- Canvas学习笔记(一)线条和圆弧
- linux:ls、ls -l、ls -al区别
- android ScrollView 滚动到顶部
- gcc预处理阶段