IDEA版SSM入门到实战(Maven+MyBatis+Spring+SpringMVC) -Maven使用前准备

一.Maven准备

注意:IDEA2019.1.x 最高支持Maven的3.6.0

  • 下载地址:http://maven.apache.org/
  • Maven底层使用Java语言编写的,所以需要配置JAVA_HOME环境变量及Path
  • 将Maven解压非中文无空格目录下
  • 配置MAVEN_HOME 环境变量及Path
  • 新建系统变量MAVEN_HOME,添加变量值maven根目录
  • 编辑系统变量Path,添加变量值%MAVEN_HOME%\bin
  • 输入【cmd】,进入命令行窗口,输入**【mvn -v】** ,检查Maven环境是否搭建成功

二.Maven基本配置

  • Maven配置文件位置:maven根目录/conf/settings.xml

  • 设置本地仓库【默认:C:/用户家目录/.m2/repository】

    xml 复制代码
    <!-- localRepository
       | The path to the local repository maven will use to store artifacts.
       |
       | Default: ${user.home}/.m2/repository
      <localRepository>/path/to/local/repo</localRepository>
      -->
      <localRepository>E:\SG_220106\LocalRepository</localRepository>
  • 设置阿里云镜像服务器

    xml 复制代码
    <mirrors>
        <!-- mirror
         | Specifies a repository mirror site to use instead of a given repository. The repository that
         | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
         | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
         |
        <mirror>
          <id>mirrorId</id>
          <mirrorOf>repositoryId</mirrorOf>
          <name>Human Readable Name for this Mirror.</name>
          <url>http://my.repository.com/repo/path</url>
        </mirror>
         -->
    	 <mirror>
            <id>nexus-aliyun</id>
            <mirrorOf>central</mirrorOf>
            <name>Nexus aliyun</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public</url>
        </mirror>
      </mirrors>
  • 设置使用JDK版本【1.8|JDK8】

    xml 复制代码
    <profiles>
    <profile>
          <id>jdk-1.8</id>
          <activation>
            <activeByDefault>true</activeByDefault>
            <jdk>1.8</jdk>
          </activation>
          <properties>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
            <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
          </properties>
        </profile>
      </profiles>

基本工作准备好后,下一章是怎么应用。

相关推荐
chinesegf1 天前
[特殊字符] 常用 Maven 命令
java·spring boot·maven
小松の博客1 天前
Mybatis 注解开发
java·tomcat·mybatis
杰克尼1 天前
Springcloud_day01
spring boot·spring·mybatis
知兀1 天前
IDEA的Code Style配置(使用google的Java Code Stytle)
java·ide·intellij-idea
不平衡的叉叉树1 天前
Mybatis常用动态SQL标签
java·mybatis
小马爱打代码1 天前
MyBatis:注解开发全攻略 - 从 XML 迁移到混合模式最佳实践
mybatis
Craaaayon1 天前
如何选择两种缓存更新策略(写缓存+异步写库;写数据库+异步更新缓存)
java·数据库·redis·后端·缓存·mybatis
合作小小程序员小小店2 天前
web网页开发,在线%台球俱乐部管理%系统,基于Idea,html,css,jQuery,jsp,java,ssm,mysql。
java·前端·jdk·intellij-idea·jquery·web
richxu202510012 天前
Java开发环境搭建之 10.使用IDEA创建和管理Mysql数据库
java·ide·intellij-idea
7澄12 天前
Java 集合框架:List 体系与实现类深度解析
java·开发语言·vector·intellij-idea·集合·arraylist·linkedlist