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>

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

相关推荐
♡喜欢做梦21 分钟前
MyBatis操作数据库(入门)
java·数据库·mybatis
ArabySide1 小时前
【Spring Boot】基于MyBatis的条件分页
java·spring boot·后端·mybatis
我命由我123451 小时前
Java 开发 - 简单消息队列实现、主题消息队列实现
java·开发语言·后端·算法·java-ee·消息队列·intellij-idea
王者之座9 小时前
java+maven配置yguard的一次实验
java·spring boot·maven
百***618710 小时前
springboot整合mybatis-plus(保姆教学) 及搭建项目
spring boot·后端·mybatis
红石榴花生油13 小时前
Docker + Nginx 部署 Java 项目(JAR 包 + WAR 包)实战笔记
java·tomcat·maven
烤麻辣烫14 小时前
23种设计模式(新手)-5里氏替换原则
java·学习·设计模式·intellij-idea·里氏替换原则
414丶小哥15 小时前
Jetbrains系列工具 Idea Websotrm中使用Claude Code
java·ide·intellij-idea·claudecode
chxii15 小时前
MyBatis 动态 SQL,通过 XML (如 <if>、<foreach> 等)实现灵活的 SQL 拼接。
xml·sql·mybatis
brucelee18616 小时前
在 Linux Ubuntu 24.04 安装 IntelliJ IDEA
linux·ubuntu·intellij-idea