概述
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工程:
- <!-- 依赖包集合 -->
- <dependencies>
- <!--junit3.0使用编程方式运行,junit4.0使用注解方式运行 -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.11</version>
- <!--使用范围 -->
- <scope>test</scope>
- </dependency>
- <!-- pageHelper分页依赖包 -->
- <dependency>
- <groupId>com.github.pagehelper</groupId>
- <artifactId>pagehelper</artifactId>
- <version>4.0.1</version>
- </dependency>
- <!--json依赖包 -->
- <dependency>
- <groupId>net.sf.json-lib</groupId>
- <artifactId>json-lib-ext-spring</artifactId>
- <version>1.0.2</version>
- </dependency>
- <!--1.志相关依赖 -->
- <!--slf4j规范接口 -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.12</version>
- </dependency>
- <!--logback日志-->
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- <version>1.1.1</version>
- </dependency>
- <!--实现slf4j接口并整合-->
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>1.1.1</version>
- </dependency>
- <!--2. 数据库相关依赖-->
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.1.35</version>
- <scope>runtime</scope>
- </dependency>
- <!-- 阿里druid数据源,优化数据库操作 -->
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>druid</artifactId>
- <version>1.0.16</version>
- </dependency>
- <!--3. DAO框架:Mybatis依赖-->
- <!--mybatis依赖-->
- <dependency>
- <groupId>org.mybatis</groupId>
- <artifactId>mybatis</artifactId>
- <version>3.3.0</version>
- </dependency>
- <!--spring只针对ibatis做了依赖,所以mybatis自身实现的spring整合依赖-->
- <dependency>
- <groupId>org.mybatis</groupId>
- <artifactId>mybatis-spring</artifactId>
- <version>1.2.3</version>
- </dependency>
- <!--Servlet web相关依赖-->
- <!--jsp相关依赖 -->
- <dependency>
- <groupId>taglibs</groupId>
- <artifactId>standard</artifactId>
- <version>1.1.2</version>
- </dependency>
- <dependency>
- <groupId>jstl</groupId>
- <artifactId>jstl</artifactId>
- <version>1.2</version>
- </dependency>
- <!--jackson相关依赖 -->
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.5.4</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>3.1.0</version>
- </dependency>
- <!--4. spring依赖-->
- <!--1)spring核心依赖-->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>4.1.7.RELEASE</version>
- </dependency>
- <!--spring ioc依赖 -->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- <version>4.1.7.RELEASE</version>
- </dependency>
- <!--spring 扩展依赖 -->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>4.1.7.RELEASE</version>
- </dependency>
- <!--2)spring dao层依赖-->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-jdbc</artifactId>
- <version>4.1.7.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-tx</artifactId>
- <version>4.1.7.RELEASE</version>
- </dependency>
- <!--3)spring web相关依赖 -->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>4.1.7.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-webmvc</artifactId>
- <version>4.1.7.RELEASE</version>
- </dependency>
- <!--4) spring test相关依赖 -->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <version>4.1.7.RELEASE</version>
- </dependency>
- </dependencies>
- <build>
- <finalName>seckill</finalName>
- </build>
- </project>
转载于:https://www.cnblogs.com/lishun/p/9301754.html
最后
以上就是复杂画笔为你收集整理的maven 创建及使用的全部内容,希望文章能够帮你解决maven 创建及使用所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复