file-new-project-maven-“maven-archetype-webapp”-next
groupId:输入cn.kgc
artifactId:工程名
我们添加一个属性值,如图中亮的所示,点右边的加号,name=archetypeCatalog value=internal。
这里我们选择使用IDEA自带的maven,下面的两个分别是你的maven配置文件和你的仓库地址,我记得idea的maven一开始是没有setting.xml的,所以你要去maven的目录里面拷一份setting.xml到你的仓库中。idea的maven在安装路径的conf文件夹下,即\conf\setting.xml拷贝到你的用户文件夹下的mymaven文件夹下.
user settings file:找到maven安装目录下的setting.xml
local repository:下载的jar包保存路径
为了之后能够快速的下载依赖包,我们要加一个官方库的镜像,因为maven的官方仓库在国外,太慢了。
我们在你的mymaven文件夹下的setting.xml中添加如下代码:
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
具体如下:
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
</mirrors>
新建工程树:
exception:为自定义异常处理类目录
myinterceptor:拦截器目录
mappers:mapper文件目录,可以不建,mapper文件放在dao目录下
在创建maven项目时注意jdk版本的选择,idea中不支持jdk1.6以下的版本,最好用jdk1.8