1. 程式人生 > >使用intellij idea搭建SSM架構的maven專案 超詳細

使用intellij idea搭建SSM架構的maven專案 超詳細

分享一下我老師大神的人工智慧教程吧。零基礎,通俗易懂!風趣幽默!http://www.captainbed.net/

也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!

               

1、安裝好intellij idea編譯器,此處認為已安裝好2017.1.3版本為例

2、新建一個專案,如下圖。


3、會彈出下面一樣的框,選擇maven,勾選選擇模板,找到圖中相應的模板並選中;如果紅色的框內是紅色的文字類似於NO SDK字樣的,則選擇該框後邊的new按鈕,會彈出一個選擇路徑的彈窗,此時找到你的jdk路徑即可。


4、彈出下圖;填好groupID和artifactID之後,點選next。


5、user setting file是指定你的maven配置檔案(也就是你的setting檔案)的路徑,如果你有指定的setting檔案,那麼你可以先勾選後面Override後進行更改;如果你使用預設路徑下的setting檔案,你最好確定該路徑下有此檔案。要是誤此檔案可以去網上下載,此處不再多講。點next。


6、填寫專案名和專案儲存路徑,點選完成。


7、等專案下載完所需要的包和掃描完後,就會生成類似於下圖的目錄。(注:最好不要在專案載入或者掃描的過程中點選滑鼠,這樣容易出現編譯器未響應)。


8、

你會發現,還有很多資料夾和檔案其實並沒有生成,我們可以手動新建這些我們需要的資料夾和檔案。新建完成之後的目錄是這樣的,java裡的是包。新增完成後,類似於下圖的目錄結構。



9、專案的結構已經基本完成了,接下來就是配置檔案了;其實配置檔案才是重點。
首先配置pom.xml檔案,內容如下:
<properties>
    <junit.version>4.12</junit.version>    <spring.version>4.2.6.RELEASE</
spring.version>    <mybatis.version>3.2.8</mybatis.version>    <mybatis.spring.version>1.2.2</mybatis.spring.version>    <mybatis.paginator.version>1.2.15</mybatis.paginator.version>    <mysql.version>5.1.32</mysql.version>    <slf4j.version>1.7.7</slf4j.version>    <logback.version>1.1.7</logback.version>    <jackson.version>2.4.2</jackson.version>    <druid.version>1.0.9</druid.version>    <jstl.version>1.2</jstl.version>    <servlet-api.version>2.5</servlet-api.version>    <jsp-api.version>2.0</jsp-api.version>    <commons-lang3.version>3.3.2</commons-lang3.version>    <commons-io.version>1.3.2</commons-io.version>    <commons-net.version>3.3</commons-net.version>    <commons-logging.version>1.2</commons-logging.version>    <pagehelper.version>3.4.2</pagehelper.version>    <jsqlparser.version>0.9.1</jsqlparser.version>    <commons-fileupload.version>1.3.1</commons-fileupload.version></properties><dependencies>    <!-- Apache工具元件 -->    <dependency>        <groupId>org.apache.commons</groupId>        <artifactId>commons-lang3</artifactId>        <version>${commons-lang3.version}</version>    </dependency>    <dependency>        <groupId>org.apache.commons</groupId>        <artifactId>commons-io</artifactId>        <version>${commons-io.version}</version>    </dependency>    <dependency>        <groupId>commons-net</groupId>        <artifactId>commons-net</artifactId>        <version>${commons-net.version}</version>    </dependency>    <!-- Jackson Json處理工具包 -->    <dependency>        <groupId>com.fasterxml.jackson.core</groupId>        <artifactId>jackson-databind</artifactId>        <version>${jackson.version}</version>    </dependency>    <!-- 單元測試 -->    <dependency>        <groupId>junit</groupId>        <artifactId>junit</artifactId>        <version>${junit.version}</version>        <scope>test</scope>    </dependency>    <!-- 日誌 -->    <dependency>        <groupId>org.slf4j</groupId>        <artifactId>slf4j-api</artifactId>        <version>${slf4j.version}</version>    </dependency>    <dependency>        <groupId>org.slf4j</groupId>        <artifactId>jul-to-slf4j</artifactId>        <version>${slf4j.version}</version>    </dependency>    <dependency>        <groupId>ch.qos.logback</groupId>        <artifactId>logback-core</artifactId>        <version>${logback.version}</version>    </dependency>    <dependency>        <groupId>ch.qos.logback</groupId>        <artifactId>logback-classic</artifactId>        <version>${logback.version}</version>        <exclusions>            <exclusion>                <groupId>org.slf4j</groupId>                <artifactId>slf4j-api</artifactId>            </exclusion>        </exclusions>    </dependency>    <dependency>        <groupId>commons-logging</groupId>        <artifactId>commons-logging</artifactId>        <version>${commons-logging.version}</version>    </dependency>    <!-- Mybatis -->    <dependency>        <groupId>org.mybatis</groupId>        <artifactId>mybatis</artifactId>        <version>${mybatis.version}</version>    </dependency>    <dependency>        <groupId>org.mybatis</groupId>        <artifactId>mybatis-spring</artifactId>        <version>${mybatis.spring.version}</version>    </dependency>    <dependency>        <groupId>com.github.miemiedev</groupId>        <artifactId>mybatis-paginator</artifactId>        <version>${mybatis.paginator.version}</version>    </dependency>    <!-- 分頁 -->    <dependency>        <groupId>com.github.pagehelper</groupId>        <artifactId>pagehelper</artifactId>        <version>${pagehelper.version}</version>    </dependency>    <!-- MySql -->    <dependency>        <groupId>mysql</groupId>        <artifactId>mysql-connector-java</artifactId>        <version>${mysql.version}</version>    </dependency>    <!-- 連線池 -->    <dependency>        <groupId>com.alibaba</groupId>        <artifactId>druid</artifactId>        <version>${druid.version}</version>    </dependency>    <!-- Spring -->    <dependency>        <groupId>org.springframework</groupId>        <artifactId>spring-context</artifactId>        <version>${spring.version}</version>    </dependency>    <dependency>        <groupId>org.springframework</groupId>        <artifactId>spring-beans</artifactId>        <version>${spring.version}</version>    </dependency>    <dependency>        <groupId>org.springframework</groupId>        <artifactId>spring-webmvc</artifactId>        <version>${spring.version}</version>    </dependency>    <dependency>        <groupId>org.springframework</groupId>        <artifactId>spring-jdbc</artifactId>        <version>${spring.version}</version>    </dependency>    <dependency>        <groupId>org.springframework</groupId>        <artifactId>spring-aspects</artifactId>        <version>${spring.version}</version>    </dependency>    <dependency>        <groupId>org.springframework</groupId>        <artifactId>spring-context-support</artifactId>        <version>${spring.version}</version>    </dependency>    <!-- JSP相關 -->    <dependency>        <groupId>jstl</groupId>        <artifactId>jstl</artifactId>        <version>${jstl.version}</version>    </dependency>    <dependency>        <groupId>javax.servlet</groupId>        <artifactId>servlet-api</artifactId>        <version>${servlet-api.version}</version>        <scope>provided</scope>    </dependency>    <dependency>        <groupId>javax.servlet</groupId>        <artifactId>jsp-api</artifactId>        <version>${jsp-api.version}</version>        <scope>provided</scope>    </dependency>    <!-- 檔案上傳元件 -->    <dependency>        <groupId>commons-fileupload</groupId>        <artifactId>commons-fileupload</artifactId>        <version>${commons-fileupload.version}</version>    </dependency></dependencies><build>    <finalName>${project.artifactId}</finalName>    <defaultGoal>compile</defaultGoal>    <plugins>        <!-- 資原始檔拷貝外掛 -->        <plugin>            <groupId>org.apache.maven.plugins</groupId>            <artifactId>maven-resources-plugin</artifactId>            <version>2.7</version>            <configuration>                <encoding>UTF-8</encoding>            </configuration>        </plugin>        <!-- java編譯外掛 -->        <plugin>            <groupId>org.apache.maven.plugins</groupId>            <artifactId>maven-compiler-plugin</artifactId>            <version>3.2</version>            <configuration>                <source>1.7</source>                <target>1.7</target>                <encoding>UTF-8</encoding>            </configuration>        </plugin>        <!-- 配置Tomcat外掛 -->        <plugin>            <groupId>org.apache.tomcat.maven</groupId>            <artifactId>tomcat7-maven-plugin</artifactId>            <version>2.2</version>            <configuration>                <port>8080</port>                <path>/</path>            </configuration>        </plugin>        <plugin>            <groupId>org.mybatis.generator</groupId>            <artifactId>mybatis-generator-maven-plugin</artifactId>            <version>1.3.2</version>            <configuration>                <!--配置檔案的位置-->      <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>                <verbose>true</verbose>                <overwrite>true</overwrite>            </configuration>            <executions>                <execution>                    <id>Generate MyBatis Artifacts</id>                    <goals>                        <goal>generate</goal>                    </goals>                </execution>            </executions>            <dependencies>                <dependency>                    <groupId>org.mybatis.generator</groupId>                    <artifactId>mybatis-generator-core</artifactId>                    <version>1.3.2</version>                </dependency>            </dependencies>        </plugin>    </plugins>    <resources>        <resource>            <directory>src/main/resources</directory>            <includes>                <include>**/*.xml</include>                <include>**/*.properties</include>                <include>**/*.ini</include>            </includes>            <filtering>false</filtering>        </resource>        <resource>            <directory>src/main/java</direc

給我老師的人工智慧教程打call!http://www.captainbed.net/

這裡寫圖片描述 你好! 這是你第一次使用 **Markdown編輯器** 所展示的歡迎頁。如果你想學習如何使用Markdown編輯器, 可以仔細閱讀這篇文章,瞭解一下Markdown的基本語法知識。

新的改變

我們對Markdown編輯器進行了一些功能拓展與語法支援,除了標準的Markdown編輯器功能,我們增加了如下幾點新功能,幫助你用它寫部落格:

  1. 全新的介面設計 ,將會帶來全新的寫作體驗;
  2. 在創作中心設定你喜愛的程式碼高亮樣式,Markdown 將程式碼片顯示選擇的高亮樣式 進行展示;
  3. 增加了 圖片拖拽 功能,你可以將本地的圖片直接拖拽到編輯區域直接展示;
  4. 全新的 KaTeX數學公式 語法;
  5. 增加了支援甘特圖的mermaid語法1 功能;
  6. 增加了 多螢幕編輯 Markdown文章功能;
  7. 增加了 焦點寫作模式、預覽模式、簡潔寫作模式、左右區域同步滾輪設定 等功能,功能按鈕位於編輯區域與預覽區域中間;
  8. 增加了 檢查列表 功能。

功能快捷鍵

撤銷:Ctrl/Command + Z
重做:Ctrl/Command + Y
加粗:Ctrl/Command + B
斜體:Ctrl/Command + I
標題:Ctrl/Command + Shift + H
無序列表:Ctrl/Command + Shift + U
有序列表:Ctrl/Command + Shift + O
檢查列表:Ctrl/Command + Shift + C
插入程式碼:Ctrl/Command + Shift + K
插入連結:Ctrl/Command + Shift + L
插入圖片:Ctrl/Command + Shift + G

合理的建立標題,有助於目錄的生成

直接輸入1次#,並按下space後,將生成1級標題。
輸入2次#,並按下space後,將生成2級標題。
以此類推,我們支援6級標題。有助於使用TOC語法後生成一個完美的目錄。

如何改變文字的樣式

強調文字 強調文字

加粗文字 加粗文字

標記文字

刪除文字

引用文字

H2O is是液體。

210 運算結果是 1024.

插入連結與圖片

連結: link.

圖片: Alt

帶尺寸的圖片: Alt

當然,我們為了讓使用者更加便捷,我們增加了圖片拖拽功能。

如何插入一段漂亮的程式碼片

部落格設定頁面,選擇一款你喜歡的程式碼片高亮樣式,下面展示同樣高亮的 程式碼片.

// An highlighted block var foo = 'bar'; 

生成一個適合你的列表

  • 專案
    • 專案
      • 專案
  1. 專案1
  2. 專案2
  3. 專案3
  • 計劃任務
  • 完成任務

建立一個表格

一個簡單的表格是這麼建立的:

專案 Value
電腦 $1600
手機 $12
導管 $1

設定內容居中、居左、居右

使用:---------:居中
使用:----------居左
使用----------:居右

第一列 第二列 第三列
第一列文字居中 第二列文字居右 第三列文字居左

SmartyPants

SmartyPants將ASCII標點字元轉換為“智慧”印刷標點HTML實體。例如:

TYPE ASCII HTML
Single backticks 'Isn't this fun?' ‘Isn’t this fun?’
Quotes "Isn't this fun?" “Isn’t this fun?”
Dashes -- is en-dash, --- is em-dash – is en-dash, — is em-dash

建立一個自定義列表

Markdown
Text-to- HTML conversion tool
Authors
John
Luke

如何建立一個註腳

一個具有註腳的文字。2

註釋也是必不可少的

Markdown將文字轉換為 HTML

KaTeX數學公式

您可以使用渲染LaTeX數學表示式 KaTeX:

Gamma公式展示 Γ ( n ) = ( n 1 ) ! n N \Gamma(n) = (n-1)!\quad\forall n\in\mathbb N 是通過尤拉積分

Γ ( z ) = 0 t z 1 e t d t &ThinSpace; . \Gamma(z) = \int_0^\infty t^{z-1}e^{-t}dt\,.

你可以找到更多關於的資訊 LaTeX 數學表示式here.

新的甘特圖功能,豐富你的文章

gantt
        dateFormat  YYYY-MM-DD
        title Adding GANTT diagram functionality to mermaid
        section 現有任務
        已完成               :done,    des1, 2014-01-06,2014-01-08
        進行中               :active,  des2, 2014-01-09, 3d
        計劃一               :         des3, after des2, 5d
        計劃二               :         des4, after des3, 5d
  • 關於 甘特圖 語法,參考 這兒,

UML 圖表

可以使用UML圖表進行渲染。 Mermaid. 例如下面產生的一個序列圖::

這將產生一個流程圖。:

  • 關於 Mermaid 語法,參考 這兒,

FLowchart流程圖

我們依舊會支援flowchart的流程圖:

  • 關於 Flowchart流程圖 語法,參考 這兒.

匯出與匯入

匯出

如果你想嘗試使用此編輯器, 你可以在此篇文章任意編輯。當你完成了一篇文章的寫作, 在上方工具欄找到 文章匯出 ,生成一個.md檔案或者.html檔案進行本地儲存。

匯入

如果你想載入一篇你寫過的.md檔案或者.html檔案,在上方工具欄可以選擇匯入功能進行對應副檔名的檔案匯入,
繼續你的創作。


  1. mermaid語法說明 ↩︎

  2. 註腳的解釋 ↩︎