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>

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

相关推荐
Skilce7 分钟前
ZrLog 高可用部署
运维·服务器·数据库·阿里云·maven
golang学习记8 小时前
IDEA 2026.1官宣:AI 建议免费了!
java·ide·intellij-idea
qqty12179 小时前
springboot+mybaties项目中扫描不到@mapper注解的解决方法
java·spring boot·mybatis
灵魂猎手9 小时前
14. MyBatis XML 热更新实战:告别重启烦恼
java·mybatis
福运常在18 小时前
股票数据API(21)如何获取股票指数最新分时交易数据
java·python·maven
两年半的个人练习生^_^18 小时前
dynamic-datasource多数据源使用和源码讲解
java·开发语言·数据库·mybatis
weixin_704266051 天前
SpringBoot全注解开发指南
java·spring boot·mybatis
Riu_Peter1 天前
【技术】Maven 配置 settings.xml 轮询下载
xml·java·maven
bug攻城狮1 天前
四大MyBatis增强框架深度对比与选型指南
架构·mybatis·数据库架构
それども2 天前
Mybatis xml 执行提示 NoSuchPropertyException
xml·mybatis