亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

搭建eclipse+maven+spring mvc項目的示例

發布時間:2021-02-16 09:22:42 來源:億速云 閱讀:426 作者:小新 欄目:編程語言

小編給大家分享一下搭建eclipse+maven+spring mvc項目的示例,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!

環境

操作系統

      windows10

JDK

      jdk1.8.0_192

IDE

      Eclipse IDE for Enterprise Java Developers.

      Version: 2019-06 (4.12.0) Build id: 20190614-1200

目錄結構 

  搭建eclipse+maven+spring mvc項目的示例

  搭建eclipse+maven+spring mvc項目的示例

構建

 1.配置settings.xml

  創建一個settings.xml文件,復制下列代碼到文件中

<?xml version="1.0" encoding="UTF-8"?>
 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
 
 <!-- 本地maven庫路徑 -->
  <localRepository>D:\DxOffice\repository</localRepository>
  
 <!--  中央maven庫 -->
  <mirrors>
   <mirror>
     <id>nexus-aliyun</id>
     <mirrorOf>*</mirrorOf>
     <name>Nexus aliyun</name>
     <url>http://maven.aliyun.com/nexus/content/groups/public</url>
   </mirror>
  </mirrors>
  
 </settings>

  配置

   Window -> Preferences

  搭建eclipse+maven+spring mvc項目的示例

   Maven -> User Settings -> User Settings ->Browse...->Apply and Close

  搭建eclipse+maven+spring mvc項目的示例

 2.創建Maven項目

   File -> New ->Maven Project(/Other...->Maven Project -> Next)

   搭建eclipse+maven+spring mvc項目的示例

   搭建eclipse+maven+spring mvc項目的示例

   Next 

  搭建eclipse+maven+spring mvc項目的示例

  org.apache.maven.archetypes maven-archetype-webapp 1 .0->Next 

 搭建eclipse+maven+spring mvc項目的示例

  Group Id、Artifact Id、Version、Package -> Finish

 搭建eclipse+maven+spring mvc項目的示例

3.修改JRE

  Build Path 

  搭建eclipse+maven+spring mvc項目的示例

  Configure Build Path...

  搭建eclipse+maven+spring mvc項目的示例

  Libraries -> JRE System Library -> Edit

  搭建eclipse+maven+spring mvc項目的示例

  Workspace default JRE ->Finish

  搭建eclipse+maven+spring mvc項目的示例

4.配置pom.xml

  修改<dependencies></dependcies>內代碼如下

<dependencies>
     <dependency>
       <groupId>mysql</groupId>
       <artifactId>mysql-connector-java</artifactId>
       <version>8.0.17</version>
     </dependency>
 
     <!-- https://mvnrepository.com/artifact/javax.servlet.jsp/jsp-api -->
     <dependency>
       <groupId>javax.servlet.jsp</groupId>
       <artifactId>jsp-api</artifactId>
       <version>2.2</version>
       <scope>provided</scope>
     </dependency>
 
     <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
       <version>2.6</version>
     </dependency>
 
     <!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
     <dependency>
       <groupId>commons-fileupload</groupId>
       <artifactId>commons-fileupload</artifactId>
       <version>1.4</version>
     </dependency>
 
     <!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
     <dependency>
       <groupId>com.alibaba</groupId>
       <artifactId>fastjson</artifactId>
       <version>1.2.59</version>
     </dependency>
 
     <dependency>
       <groupId>jstl</groupId>
       <artifactId>jstl</artifactId>
       <version>1.2</version>
     </dependency>
 
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>4.11</version>
       <scope>test</scope>
     </dependency>
 
     <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>javax.servlet-api</artifactId>
       <version>3.1.0</version>
     </dependency>
 
     <dependency>
       <groupId>javax.servlet.jsp</groupId>
       <artifactId>javax.servlet.jsp-api</artifactId>
       <version>2.3.1</version>
     </dependency>
 
     <!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-webmvc</artifactId>
       <version>4.3.11.RELEASE</version>
     </dependency>
     <!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-jdbc</artifactId>
 <version>4.3.11.RELEASE</version> 
</dependency> 
</dependencies>

  <build></build>內添加<plugins></plugins>,代碼如下

<plugins>
       <plugin>
         <groupId>org.eclipse.jetty</groupId>
         <artifactId>jetty-maven-plugin</artifactId>
         <version>9.3.7.v20160115</version>
         <configuration>
           <httpConnector>
             <port>8081</port>
           </httpConnector>
           <webApp>
             <contextPath>/${project.artifactId}</contextPath>
           </webApp>
 
           <contextHandlers>
             <!-- 附件目錄服務 -->
             <contextHandler implementation="org.eclipse.jetty.maven.plugin.JettyWebAppContext">
               <contextPath>/image</contextPath>
               <resourceBase>D:\DxOffice\workspace\image</resourceBase>
             </contextHandler>
           </contextHandlers>
 
           <encoding>UTF-8</encoding>
           <scanIntervalSeconds>10</scanIntervalSeconds>
         </configuration>
 
       </plugin>
       <!-- 要解決靜態文件鎖定問題org\eclipse\jetty\jetty-webapp\ -->
       <!-- org\eclipse\jetty\webapp\webdefault.xml -->
       <!-- <init-param> -->
       <!-- <param-name>useFileMappedBuffer</param-name> -->
       <!-- <param-value>true</param-value> change to false -->
       <!-- </init-param> -->
 
       <plugin>
         <groupId>org.apache.tomcat.maven</groupId>
         <artifactId>tomcat7-maven-plugin</artifactId>
         <version>2.2</version>
         <configuration>
           <path>/${project.artifactId}</path>
           <port>8080</port>
           <uriEncoding>UTF-8</uriEncoding>
           <finalName>${project.artifactId}</finalName>
           <server>tomcat7</server>
         </configuration>
       </plugin>
 
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.7.0</version>
 
         <configuration>
           <source>1.8</source>
           <target>1.8</target>
           <encoding>UTF-8</encoding>
         </configuration>
 
       </plugin>
     </plugins>

5.主目錄結構搭建  

   搭建eclipse+maven+spring mvc項目的示例

  M

   model

  V

   view

  C

   controller

   service

看完了這篇文章,相信你對“搭建eclipse+maven+spring mvc項目的示例”有了一定的了解,如果想了解更多相關知識,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

澳门| 河曲县| 六枝特区| 伊春市| 罗城| 韶关市| 上思县| 福鼎市| 罗山县| 满城县| 麟游县| 奇台县| 梓潼县| 昌宁县| 商水县| 丽江市| 沾益县| 博乐市| 安平县| 四平市| 寻乌县| 宾川县| 镇原县| 安塞县| 城口县| 玉环县| 汤原县| 晋城| 固安县| 扎赉特旗| 怀安县| 双柏县| 永善县| 台州市| 阿城市| 静乐县| 武冈市| 白河县| 河间市| 温州市| 建始县|