我是靠谱客的博主 复杂画笔,最近开发中收集的这篇文章主要介绍maven 创建及使用,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

maven下载地址:http://maven.apache.org/download.cgi;

创建maven工程,在maven包下创建resposity资源包;

在classpath中设置maven 路径 C:apache-maven-3.5.4 (maven存放路径)  cmd中 mvn -version;

打开eclipse window的preferences  user settings 路径为: C:apache-maven-3.5.4confsettings.xml

local Repository地址:C:apache-maven-3.5.4resposity  

在 pom.xml 中导入maven工程:

  1. <!-- 依赖包集合 -->    
  2.     <dependencies>    
  3.         <!--junit3.0使用编程方式运行,junit4.0使用注解方式运行 -->    
  4.         <dependency>    
  5.             <groupId>junit</groupId>    
  6.             <artifactId>junit</artifactId>    
  7.             <version>4.11</version>    
  8.             <!--使用范围 -->    
  9.             <scope>test</scope>    
  10.         </dependency>    
  11.         <!-- pageHelper分页依赖包 -->    
  12.         <dependency>    
  13.             <groupId>com.github.pagehelper</groupId>    
  14.             <artifactId>pagehelper</artifactId>    
  15.             <version>4.0.1</version>    
  16.         </dependency>    
  17.         <!--json依赖包 -->    
  18.         <dependency>    
  19.             <groupId>net.sf.json-lib</groupId>    
  20.             <artifactId>json-lib-ext-spring</artifactId>    
  21.             <version>1.0.2</version>    
  22.         </dependency>    
  23.             
  24.         <!--1.志相关依赖 -->    
  25.         <!--slf4j规范接口 -->    
  26.         <dependency>    
  27.             <groupId>org.slf4j</groupId>    
  28.             <artifactId>slf4j-api</artifactId>    
  29.             <version>1.7.12</version>    
  30.         </dependency>    
  31.         <!--logback日志-->    
  32.         <dependency>    
  33.             <groupId>ch.qos.logback</groupId>    
  34.             <artifactId>logback-core</artifactId>    
  35.             <version>1.1.1</version>    
  36.         </dependency>    
  37.         <!--实现slf4j接口并整合-->    
  38.         <dependency>    
  39.             <groupId>ch.qos.logback</groupId>    
  40.             <artifactId>logback-classic</artifactId>    
  41.             <version>1.1.1</version>    
  42.         </dependency>    
  43.         <!--2. 数据库相关依赖-->    
  44.         <dependency>    
  45.             <groupId>mysql</groupId>    
  46.             <artifactId>mysql-connector-java</artifactId>    
  47.             <version>5.1.35</version>    
  48.             <scope>runtime</scope>    
  49.         </dependency>    
  50.        <!-- 阿里druid数据源,优化数据库操作 -->    
  51.         <dependency>    
  52.             <groupId>com.alibaba</groupId>    
  53.             <artifactId>druid</artifactId>    
  54.             <version>1.0.16</version>    
  55.         </dependency>    
  56.         <!--3. DAO框架:Mybatis依赖-->    
  57.         <!--mybatis依赖-->    
  58.         <dependency>    
  59.             <groupId>org.mybatis</groupId>    
  60.             <artifactId>mybatis</artifactId>    
  61.             <version>3.3.0</version>    
  62.         </dependency>    
  63.         <!--spring只针对ibatis做了依赖,所以mybatis自身实现的spring整合依赖-->    
  64.         <dependency>    
  65.             <groupId>org.mybatis</groupId>    
  66.             <artifactId>mybatis-spring</artifactId>    
  67.             <version>1.2.3</version>    
  68.         </dependency>    
  69.         <!--Servlet web相关依赖-->    
  70.         <!--jsp相关依赖 -->    
  71.         <dependency>    
  72.             <groupId>taglibs</groupId>    
  73.             <artifactId>standard</artifactId>    
  74.             <version>1.1.2</version>    
  75.         </dependency>    
  76.         <dependency>    
  77.             <groupId>jstl</groupId>    
  78.             <artifactId>jstl</artifactId>    
  79.             <version>1.2</version>    
  80.         </dependency>    
  81.         <!--jackson相关依赖 -->    
  82.         <dependency>    
  83.             <groupId>com.fasterxml.jackson.core</groupId>    
  84.             <artifactId>jackson-databind</artifactId>    
  85.             <version>2.5.4</version>    
  86.         </dependency>    
  87.         <dependency>    
  88.             <groupId>javax.servlet</groupId>    
  89.             <artifactId>javax.servlet-api</artifactId>    
  90.             <version>3.1.0</version>    
  91.         </dependency>    
  92.         <!--4. spring依赖-->    
  93.         <!--1)spring核心依赖-->    
  94.         <dependency>    
  95.             <groupId>org.springframework</groupId>    
  96.             <artifactId>spring-core</artifactId>    
  97.             <version>4.1.7.RELEASE</version>    
  98.         </dependency>    
  99.         <!--spring ioc依赖 -->    
  100.         <dependency>    
  101.             <groupId>org.springframework</groupId>    
  102.             <artifactId>spring-beans</artifactId>    
  103.             <version>4.1.7.RELEASE</version>    
  104.         </dependency>    
  105.         <!--spring 扩展依赖 -->    
  106.         <dependency>    
  107.             <groupId>org.springframework</groupId>    
  108.             <artifactId>spring-context</artifactId>    
  109.             <version>4.1.7.RELEASE</version>    
  110.         </dependency>    
  111.         <!--2)spring dao层依赖-->    
  112.         <dependency>    
  113.             <groupId>org.springframework</groupId>    
  114.             <artifactId>spring-jdbc</artifactId>    
  115.             <version>4.1.7.RELEASE</version>    
  116.         </dependency>    
  117.         <dependency>    
  118.             <groupId>org.springframework</groupId>    
  119.             <artifactId>spring-tx</artifactId>    
  120.             <version>4.1.7.RELEASE</version>    
  121.         </dependency>    
  122.         <!--3)spring web相关依赖 -->    
  123.         <dependency>    
  124.             <groupId>org.springframework</groupId>    
  125.             <artifactId>spring-web</artifactId>    
  126.             <version>4.1.7.RELEASE</version>    
  127.         </dependency>    
  128.         <dependency>    
  129.             <groupId>org.springframework</groupId>    
  130.             <artifactId>spring-webmvc</artifactId>    
  131.             <version>4.1.7.RELEASE</version>    
  132.         </dependency>    
  133.         <!--4) spring test相关依赖 -->    
  134.         <dependency>    
  135.             <groupId>org.springframework</groupId>    
  136.             <artifactId>spring-test</artifactId>    
  137.             <version>4.1.7.RELEASE</version>    
  138.         </dependency>    
  139.     </dependencies>    
  140.   <build>  
  141.     <finalName>seckill</finalName>  
  142.   </build>  
  143. </project>  

转载于:https://www.cnblogs.com/lishun/p/9301754.html

最后

以上就是复杂画笔为你收集整理的maven 创建及使用的全部内容,希望文章能够帮你解决maven 创建及使用所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(33)

评论列表共有 0 条评论

立即
投稿
返回
顶部