Intellij IDEA2017 创建maven项目
关于基础环境配置这里不做说明,只在idea上新建建maven项目。
本文章仅为学习过程中的记录笔记。
一、新建maven项目
1.1、首先打开idae,点击File–>New–>Project
这里写图片描述
1.2、选择创建maven项目,选好jdk版本,选择webapp模型,然后点Next
这里写图片描述
1.3、设置好包名和项目名
这里写图片描述
1.4、选择好自己配置的maven环境
这里写图片描述
这里写图片描述
1.5、选择Enable Auto-Import生成maven项目
这里写图片描述
1.6、生成完成后项目的目录结构
这里写图片描述
二、配置文件
这是接下来需要添加的目录和文件结构,如图:
这里写图片描述
pom.xml配置
01、先在
1
2
3
4
5
6
7
8
9
10
11
02、然后再添加一下依赖包到
com.alibaba
druid
1.0.12
com.fasterxml.jackson.core
jackson-core
2.8.5
com.fasterxml.jackson.jaxrs
jackson-jaxrs-xml-provider
2.4.1
org.codehaus.jackson
jackson-mapper-asl
1.9.4
com.fasterxml.jackson.core
jackson-databind
2.8.5
com.github.pagehelper
pagehelper
4.0.0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
03、在
1
2
3
4
5
6
7
8
9
10
11
12
13
2.1、在resources里创建数据库配置文件:jdbc.properties
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/vip
jdbc.username=root
jdbc.password=123456
定义初始连接数
initialSize=0
定义最大连接数
maxActive=20
定义最大空闲
maxIdle=20
定义最小空闲
minIdle=1
定义最长等待时间
maxWait=60000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2.2、在resources里创建日志文件:log4j.properties
log4j.rootLogger=INFO,Console,File
定义日志输出目的地为控制台
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.Target=System.out
可以灵活地指定日志输出格式,下面一行是指定具体的格式
log4j.appender.Console.layout = org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=[%c] - %m%n
文件大小到达指定尺寸的时候产生一个新的文件
log4j.appender.File = org.apache.log4j.RollingFileAppender
指定输出目录
log4j.appender.File.File = logs/ssm.log
定义文件最大大小
log4j.appender.File.MaxFileSize = 10MB
输出所以日志,如果换成DEBUG表示输出DEBUG以上级别日志
log4j.appender.File.Threshold = ALL
log4j.appender.File.layout = org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern =[%p] [%d{yyyy-MM-dd HH:mm:ss}][%c]%m%n
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2.3、在resources里创建spring-mvc.xml
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
text/plain;charset=UTF-8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
2.4、在resources里创建spring-mybatis.xml
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd">
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
2.5、在resources里创建mybatis自动生成代码配置文件:generatorConfig.xml
mapping文件生成在了resources文件夹里,idea里跟eclipse不同,如果生成的xml文件不在resources里,项目跑起来会提示找不到XXXmapping.xml文件
"-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
2.6、配置web.xml
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
三、用mybatis-generator插件生成代码
3.1、首先配置启动,点击idea右上角的启动方式
这里写图片描述
这里写图片描述
3.2、在comman line 那栏配置mybatis-generator:generate -e
这里写图片描述
启动之前需要建立java主文件夹,存放java代码
这里写图片描述
。。。。。。。。。
这里写图片描述
。。。。
这里写图片描述
3.3、启动刚刚配置maven插件
这里写图片描述
==执行完后结果图:
这里写图片描述
四、配置tomcat
这里写图片描述
。。。。。。。。。。
这里写图片描述
。。。
这里写图片描述
这里写图片描述
这里写图片描述
本文章仅为学习过程中的记录笔记
作者:Vicent-jie
来源:CSDN
原文:https://blog.csdn.net/qq_25591191/article/details/78745312
版权声明:本文为博主原创文章,转载请附上博文链接!