• Spring+SpringMVC+Mybatis+Shiro环境搭建之IDEA下搭建Maven项目


      运行IntelliJ IDEA 2016.3.2(64)编译器新建项目

     

      在弹出的窗体中选择maven,然后勾选要建的maven模板--这里选webApp

      然后填入相应的maven项目组信息(GroupID是项目组织唯一的标识符,实际对应JAVA的包的结构,是main目录里java的目录结构)

      选择和填写自己的maven本地仓库路径和配置文件(如果遇到maven下载jar慢的问题,可以参考我以前写的博客(解决maven下载jar慢的问题(如何更换Maven下载源)):http://www.cnblogs.com/libingbin/p/5949483.html)

      填写项目名称以及项目生成路径,然后在下方检查填写是否正确(填写project name和module name, module name默认和project name 一样的,但是如果这个项目只有这一个module,不改无所谓的,如果有很多的module,那就修改一下。在maven管理的project下面,可以有很多个module的子项目)。点“Finish”以后,maven会自动创建需要的一些配置信息以及目录结构

       在maven的官方链接单独查找jar包来配置pom.xml,登录官方链接http://mvnrepository.com/ (如果官方异常,也可以用国人建的镜像:http://maven.outofmemory.cn/)示例查找 :junit

    点击查找结果(可以看到最新版以及使用人数最多的版本,自己选择--配置文件里面的jar包版本最好选择同一个版本避免版本冲突)

    选择第一个进入网页,里面可以看到maven的配置pom.xml文件写法,点击代码直接复制(自动复制);然后将复制的代码拷贝到pom.xml文件中去即可,maven会自动下载所需要的jar包

     

     

      1 <?xml version="1.0" encoding="UTF-8"?>
      2 <project xmlns="http://maven.apache.org/POM/4.0.0"
      3          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      4          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      5     <modelVersion>4.0.0</modelVersion>
      6 
      7     <groupId>com.bingbinli.ssm</groupId>
      8     <artifactId>ssm-parent</artifactId>
      9     <version>1.0-SNAPSHOT</version>
     10     <packaging>war</packaging>
     11     <name>ssm-parent Maven Webapp</name>
     12     <url>http://maven.apache.org</url>
     13 
     14     <!--参数-->
     15     
     16     <!-- 集中定义依赖版本号 -->
     17     <properties>
     18         <junit.version>4.12</junit.version>
     19         <spring.version>4.1.3.RELEASE</spring.version>
     20         <mybatis.version>3.2.8</mybatis.version>
     21         <mybatis.spring.version>1.2.2</mybatis.spring.version>
     22         <mybatis.paginator.version>1.2.15</mybatis.paginator.version>
     23         <mysql.version>5.1.32</mysql.version>
     24         <slf4j.version>1.6.4</slf4j.version>
     25         <jackson.version>2.4.2</jackson.version>
     26         <druid.version>1.0.9</druid.version>
     27         <httpclient.version>4.3.5</httpclient.version>
     28         <jstl.version>1.2</jstl.version>
     29         <servlet-api.version>2.5</servlet-api.version>
     30         <jsp-api.version>2.0</jsp-api.version>
     31         <joda-time.version>2.5</joda-time.version>
     32         <commons-lang3.version>3.3.2</commons-lang3.version>
     33         <commons-io.version>1.3.2</commons-io.version>
     34         <commons-net.version>3.3</commons-net.version>
     35         <pagehelper.version>3.4.2-fix</pagehelper.version>
     36         <jsqlparser.version>0.9.1</jsqlparser.version>
     37         <commons-fileupload.version>1.3.1</commons-fileupload.version>
     38         <jedis.version>2.7.2</jedis.version>
     39         <solrj.version>4.10.3</solrj.version>
     40     </properties>
     41     <dependencyManagement>
     42         <dependencies>
     43             <!-- 时间操作组件 -->
     44             <dependency>
     45                 <groupId>joda-time</groupId>
     46                 <artifactId>joda-time</artifactId>
     47                 <version>${joda-time.version}</version>
     48             </dependency>
     49             <!-- Apache工具组件 -->
     50             <dependency>
     51                 <groupId>org.apache.commons</groupId>
     52                 <artifactId>commons-lang3</artifactId>
     53                 <version>${commons-lang3.version}</version>
     54             </dependency>
     55             <dependency>
     56                 <groupId>org.apache.commons</groupId>
     57                 <artifactId>commons-io</artifactId>
     58                 <version>${commons-io.version}</version>
     59             </dependency>
     60             <dependency>
     61                 <groupId>commons-net</groupId>
     62                 <artifactId>commons-net</artifactId>
     63                 <version>${commons-net.version}</version>
     64             </dependency>
     65             <!-- Jackson Json处理工具包 -->
     66             <dependency>
     67                 <groupId>com.fasterxml.jackson.core</groupId>
     68                 <artifactId>jackson-databind</artifactId>
     69                 <version>${jackson.version}</version>
     70             </dependency>
     71             <!-- httpclient -->
     72             <dependency>
     73                 <groupId>org.apache.httpcomponents</groupId>
     74                 <artifactId>httpclient</artifactId>
     75                 <version>${httpclient.version}</version>
     76             </dependency>
     77             <!-- 单元测试 -->
     78             <dependency>
     79                 <groupId>junit</groupId>
     80                 <artifactId>junit</artifactId>
     81                 <version>${junit.version}</version>
     82                 <scope>test</scope>
     83             </dependency>
     84             <!-- 日志处理 -->
     85             <dependency>
     86                 <groupId>org.slf4j</groupId>
     87                 <artifactId>slf4j-log4j12</artifactId>
     88                 <version>${slf4j.version}</version>
     89             </dependency>
     90             <!-- Mybatis -->
     91             <dependency>
     92                 <groupId>org.mybatis</groupId>
     93                 <artifactId>mybatis</artifactId>
     94                 <version>${mybatis.version}</version>
     95             </dependency>
     96             <dependency>
     97                 <groupId>org.mybatis</groupId>
     98                 <artifactId>mybatis-spring</artifactId>
     99                 <version>${mybatis.spring.version}</version>
    100             </dependency>
    101             <dependency>
    102                 <groupId>com.github.miemiedev</groupId>
    103                 <artifactId>mybatis-paginator</artifactId>
    104                 <version>${mybatis.paginator.version}</version>
    105             </dependency>
    106             <dependency>
    107                 <groupId>com.github.pagehelper</groupId>
    108                 <artifactId>pagehelper</artifactId>
    109                 <version>${pagehelper.version}</version>
    110             </dependency>
    111             <!-- MySql -->
    112             <dependency>
    113                 <groupId>mysql</groupId>
    114                 <artifactId>mysql-connector-java</artifactId>
    115                 <version>${mysql.version}</version>
    116             </dependency>
    117             <!-- 连接池 -->
    118             <dependency>
    119                 <groupId>com.alibaba</groupId>
    120                 <artifactId>druid</artifactId>
    121                 <version>${druid.version}</version>
    122             </dependency>
    123             <!-- Spring -->
    124             <dependency>
    125                 <groupId>org.springframework</groupId>
    126                 <artifactId>spring-context</artifactId>
    127                 <version>${spring.version}</version>
    128             </dependency>
    129             <dependency>
    130                 <groupId>org.springframework</groupId>
    131                 <artifactId>spring-beans</artifactId>
    132                 <version>${spring.version}</version>
    133             </dependency>
    134             <dependency>
    135                 <groupId>org.springframework</groupId>
    136                 <artifactId>spring-webmvc</artifactId>
    137                 <version>${spring.version}</version>
    138             </dependency>
    139             <dependency>
    140                 <groupId>org.springframework</groupId>
    141                 <artifactId>spring-jdbc</artifactId>
    142                 <version>${spring.version}</version>
    143             </dependency>
    144             <dependency>
    145                 <groupId>org.springframework</groupId>
    146                 <artifactId>spring-aspects</artifactId>
    147                 <version>${spring.version}</version>
    148             </dependency>
    149             <!-- JSP相关 -->
    150             <dependency>
    151                 <groupId>jstl</groupId>
    152                 <artifactId>jstl</artifactId>
    153                 <version>${jstl.version}</version>
    154             </dependency>
    155             <dependency>
    156                 <groupId>javax.servlet</groupId>
    157                 <artifactId>servlet-api</artifactId>
    158                 <version>${servlet-api.version}</version>
    159                 <scope>provided</scope>
    160             </dependency>
    161             <dependency>
    162                 <groupId>javax.servlet</groupId>
    163                 <artifactId>jsp-api</artifactId>
    164                 <version>${jsp-api.version}</version>
    165                 <scope>provided</scope>
    166             </dependency>
    167             <!-- 文件上传组件 -->
    168             <dependency>
    169                 <groupId>commons-fileupload</groupId>
    170                 <artifactId>commons-fileupload</artifactId>
    171                 <version>${commons-fileupload.version}</version>
    172             </dependency>
    173             <!-- Redis客户端 -->
    174             <dependency>
    175                 <groupId>redis.clients</groupId>
    176                 <artifactId>jedis</artifactId>
    177                 <version>${jedis.version}</version>
    178             </dependency>
    179             <!-- solr客户端 -->
    180             <dependency>
    181                 <groupId>org.apache.solr</groupId>
    182                 <artifactId>solr-solrj</artifactId>
    183                 <version>${solrj.version}</version>
    184             </dependency>
    185         </dependencies>
    186     </dependencyManagement>
    187 
    188     <build>
    189         <finalName>${project.artifactId}</finalName>
    190         <plugins>
    191             <!-- 资源文件拷贝插件 -->
    192             <plugin>
    193                 <groupId>org.apache.maven.plugins</groupId>
    194                 <artifactId>maven-resources-plugin</artifactId>
    195                 <version>2.7</version>
    196                 <configuration>
    197                     <encoding>UTF-8</encoding>
    198                 </configuration>
    199             </plugin>
    200             <!-- java编译插件 -->
    201             <plugin>
    202                 <groupId>org.apache.maven.plugins</groupId>
    203                 <artifactId>maven-compiler-plugin</artifactId>
    204                 <version>3.2</version>
    205                 <configuration>
    206                     <source>1.7</source>
    207                     <target>1.7</target>
    208                     <encoding>UTF-8</encoding>
    209                 </configuration>
    210             </plugin>
    211         </plugins>
    212         <pluginManagement>
    213             <plugins>
    214                 <!-- 配置Tomcat插件 -->
    215                 <plugin>
    216                     <groupId>org.apache.tomcat.maven</groupId>
    217                     <artifactId>tomcat7-maven-plugin</artifactId>
    218                     <version>2.2</version>
    219                 </plugin>
    220             </plugins>
    221         </pluginManagement>
    222     </build>
    223 
    224 
    225 </project>

     

    <!-- Start -->

     

    获知及时信息,请关注我的个人微信订阅号:0与1的那点事

     

     

     

     

    <!-- End -->

     

     

     

    本文为博主原创文章,转载请注明出处!

     

    http://www.cnblogs.com/libingbin/

     

    感谢您的阅读。

  • 相关阅读:
    获取窗口相对位置小工具
    关于抽奖概率的问题
    乔布斯的成功秘方:坚持思考两个问题
    清理svn生成的相关文件的小工具
    photoshop cs6 简体中文正式版下载
    .NET下office操作利器NPOI
    sql 取各组中的最大值
    c# winform 获取当前程序运行根目录
    C# Winform DataGridView使用总结 转
    c#安装数据库并自动修改Web.config类
  • 原文地址:https://www.cnblogs.com/libingbin/p/6357444.html
Copyright © 2020-2023  润新知