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>

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

相关推荐
weixin_4614085816 小时前
Mybatis-flex小记
java·开发语言·mybatis
それども16 小时前
IDEA接入Claude完整流程
java·ai·intellij-idea
SQL-First布道者1 天前
⚡Spring JDBC 完整体系 · 第 10 集 · 手搓 `BaseCondition`
java·spring boot·后端·spring·mybatis·spring jdbc
南城以南溫暖如初1471 天前
社交裂变商城系统设计与实战开发指南
java·spring boot·mysql·vue·mybatis
南城以南溫暖如初1471 天前
分享返现商城系统开发实战:技术架构与运营经验指南
java·spring boot·mysql·架构·vue·mybatis
南城以南溫暖如初1471 天前
社群电商实战指南:从零搭建高转化社区的技术架构
java·spring boot·mysql·系统架构·vue·mybatis
南城以南溫暖如初1471 天前
会员返利商城系统开发实战:架构设计与实现指南
java·spring boot·mysql·vue·mybatis
Arvin6271 天前
SonarQube 扫描 Maven 项目编译错误
java·maven·sonar
page_qiu1 天前
jekins 完整部署详细流程(集成 SVN 源码管理 + Maven 打包 + Jar 程序自动部署)
svn·maven·jar
煎饼皮皮侠2 天前
【设计】设计一个web版的数据库管理平台后端(之五) --借鉴mybatis
数据库·mybatis