一、框架搭建前期环境准备
- jdk8.0下载地址:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
- apache-maven-3.5.0-alpha-1下载地址:https://archive.apache.org/dist/maven/maven-3/3.5.0/binaries/中安装,然后要进行仓库和阿里镜像的配置参考https://blog.csdn.net/weixin_42035152/article/details/80035373;
- apache-tomcat-7.0.90;下载地址:https://tomcat.apache.org/download-70.cgi中标题为Core:下载,,前两个为mac系统的下载;
- mysql-5.6.41-macos10.13-x86_64,下载地址:https://dev.mysql.com/downloads/mysql/5.7.html,可以选择版本进行下载这里安装完毕以后,都需要配置环境变量,这里就不再进行说明了,可以参考其他的博客进行配置;
- 开发工具去官网下载:https://www.jetbrains.com/idea/download/#section=mac
二、搭建框架
- 打开intellij idea.出现如下的界面,这时候我们先对Maven的地址进行配置一下吧,点击Configure我们选择preference;
这时候会直接跳转到Maven配置界面如下图所示,这是我们主要配置三个地方,Maven home directory请选择你maven的安装路径,User setting file这是我们前面提到的仓库和阿里镜像的配置文件,Local repository是配置仓库的地址配置完毕我们选择apply然后Ok;
- 然后点击下一步,我们看到下面的界面 ,GroupID是项目组织唯一的标识符, 比如我的项目叫test001 那么GroupID应该是 com.lixiaoming.test001 域名.公司名.项目名,ArtifactID就是项目的唯一的标识符, 一般是 项目名-xxx 比如test001-model
- 继续下一步,如下图显示项目名称和你的项目本地地址。
点击完成,项目结构算是搭建起来了
三、搭建目录结构
四.文件配置内容
首先我们要在pox.xml中引进我们需要的jar包,在地址:http://mvnrepository.com/里面搜素自己需要的jar包,因为要进行下载会有点慢,需要耐心等待一下,这时我们配置SSM其他的文件。
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet.jsp/javax.servlet.jsp-api -->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
</dependency>
<!-- https://mvnrepository.com/artifact/taglibs/standard -->
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-dbcp/commons-dbcp -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-aop -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>5.1.3.RELEASE</version>
</depende