IDEA使用maven創建SSM及其依賴的導入


$.說明:

1.IDEA創建maven SSM web項目

2.導入依賴

一.IDEA創建maven SSM項目

對於初入IDEA的人來說此篇博客適用於不會創建maven 項目的人

首先下載IDEA  附上官方網站:https://www.jetbrains.com/idea/download/#section=windows    

在這里不再演示破解IDEA的方法和安裝方法。

    本人用的2018.2.3的版本 首先 創建一個新項目 點擊   Create New Project

 

1.進入新建項目的界面 找到 maven項目

2.有很多創建maven項目的方法,博主不建議新手去勾選這個選項(maven模板)這個地方不勾。

3.找到你安裝的jdk已經有的可以跳過這一步。沒有的 點擊 New找到你安裝jdk的目錄。

4.點擊next

1.這里GruupId 和 ArtfactId 不做多余講解  附上一個鏈接:https://blog.csdn.net/zhangxingyu126/article/details/81013315  

2.版本號默認即可 。

3.next

1. 填寫項目的名稱 和項目所放的路徑   在GruupId 和 ArtfactId 中我填寫的“ceshi” 所以下面自動出現的

可以根據自己的喜歡定義合法的命名。

2.點擊完成。

1.項目名稱

2.源代碼等結構目錄

3.maven填寫依賴的jar包的xml(自動導入依賴的jar包配置寫入其中)

4.選擇畫圈的自動導入jar包(只需要在pom.xml中添加依賴,可以自動下載)

1.點擊這個圖標 彈出(Project Structure)

2.另一種方法 :點擊file >>  Project Structure   同樣彈出

‘3,選擇modules  

4.點擊“+”  下滑

5.選擇 Web 

1可以更換為自己設定的合法的命名。完成點擊  OK。

1.在pom.xml文件中加入如下代碼  jIDEA自動會下載所需要的jar包

附上 maven倉庫地址  ;https://mvnrepository.com/    ( 右下角顯示下載進度條)      

 1 <dependencies>
 2 <!--Spring MVC 及其依賴包-->
 3     <dependency>
 4         <groupId>org.springframework</groupId>
 5         <artifactId>spring-webmvc</artifactId>
 6         <version>5.0.3.RELEASE</version>
 7     </dependency>
 8     <dependency>
 9         <groupId>org.aspectj</groupId>
10         <artifactId>aspectjweaver</artifactId>
11         <version>1.9.2</version>
12     </dependency>
13     <dependency>
14         <groupId>org.springframework</groupId>
15         <artifactId>spring-jdbc</artifactId>
16         <version>5.0.3.RELEASE</version>
17     </dependency>
18     <!-- springmvc 默認使用jstl 標簽 -->
19     <dependency>
20         <groupId>javax.servlet</groupId>
21         <artifactId>jstl</artifactId>
22         <version>1.2</version>
23     </dependency>
24     <!-- mybatis 核心包 -->
25     <dependency>
26         <groupId>org.mybatis</groupId>
27         <artifactId>mybatis</artifactId>
28         <version>3.4.5</version>
29     </dependency>
30 
31     <!-- mybatis 與 spring 的整合包 -->
32     <dependency>
33         <groupId>org.mybatis</groupId>
34         <artifactId>mybatis-spring</artifactId>
35         <version>1.3.2</version>
36     </dependency>
37     <!-- 配置連接mysql 的驅動包 -->
38     <dependency>
39         <groupId>mysql</groupId>
40         <artifactId>mysql-connector-java</artifactId>
41         <version>5.1.6</version>
42     </dependency>
43     <dependency>
44         <groupId>commons-logging</groupId>
45         <artifactId>commons-logging</artifactId>
46         <version>1.1.3</version>
47     </dependency>
48     <!-- https://mvnrepository.com/artifact/log4j/log4j -->
49     <dependency>
50         <groupId>log4j</groupId>
51         <artifactId>log4j</artifactId>
52         <version>1.2.17</version>
53     </dependency>
54     <dependency>
55         <groupId>org.slf4j</groupId>
56         <artifactId>slf4j-log4j12</artifactId>
57         <version>1.7.2</version>
58     </dependency>
59     <dependency>
60         <groupId>javax.servlet</groupId>
61         <artifactId>javax.servlet-api</artifactId>
62         <version>3.1.0</version>
63         <scope>provided</scope>
64     </dependency>
65     <dependency>
66         <groupId>javax.servlet.jsp</groupId>
67         <artifactId>javax.servlet.jsp-api</artifactId>
68         <version>2.3.1</version>
69         <scope>provided</scope>
70     </dependency>
71 
72 </dependencies>

 

 

 $總結

這種創建方式不使用maven模板

IDEA對於快速編寫代碼具有很高的效率,

本文關於GruupId 和 ArtfactId 沒有講明實際作用。

如果不會 maven 和 IDEA 的也可以使用 。

對於創建后的 .idea文件 可在設置中隱藏 。所以我沒有顯示.idea文件

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM