Windows IDEA 导入java maven项目

Windows
参考https://www.bilibili.com/video/av78474321/

准备

java jdk1.8

  • 安装教程
  • 配置环境变量

https://www.cnblogs.com/mr-wuxiansheng/p/6850437.html

maven apache-maven-3.6.3

  • 建议放在用户权限的位置,有修改内容,保证有权限修改
  • 配置环境变量

https://blog.csdn.net/u010782846/article/details/52775774
https://blog.csdn.net/qq_15872419/article/details/109080929

idea

community导入springboot项目会有问题。建议使用企业版(IU)

git

  1. 安装git
    https://www.cnblogs.com/xueweisuoyong/p/11914045.html
  2. git cmd中添加用户名和email(只用于日志标识)
git config --global user.name "name"
git config --global user.email "name@163.com"

https://www.cnblogs.com/javahr/p/9766371.html

  1. idea配置git

File->Settings->Version Control->Git

  • path to git executable: git安装路径,点text测试出现版本号
C:\Program Files\Git\bin\git.exe

File->Settings->Tools->terminal

  • Shell path:git安装路径
C:\Program Files\Git\git-cmd.exe
  1. idea下克隆项目
    File->New->Project from Version Control…
    ->Repository URL->URL写项目clone的http地址,Diretory创建一个新的目录

maven修改

修改C:\Program Files\apache-maven-3.6.3\conf\settings.xml

  1. 配置jar包存放的repo
  <!-- 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>C:\Users\xx\repository</localRepository>
  1. 配置阿里云镜像,删掉原来的镜像
  <!-- mirrors
   | This is a list of mirrors to be used in downloading artifacts from remote repositories.
   |
   | It works like this: a POM may declare a repository to use in resolving certain artifacts.
   | However, this repository may have problems with heavy traffic at times, so people have mirrored
   | it to several places.
   |
   | That repository definition will have a unique id, so we can create a mirror reference for that
   | repository, to be used as an alternate download site. The mirror site will be the preferred
   | server for that repository.
   |-->
  <mirrors>
	<mirror>      
	  <id>alimaven</id>    
      <name>aliyun maven</name>  
      <url>http://maven.aliyun.com/nexus/content/groups/public</url>    
      <mirrorOf>central</mirrorOf>      
    </mirror> 
	<mirror>      
	  <id>alimaven</id>    
      <name>aliyun maven</name>  
      <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>    
      <mirrorOf>central</mirrorOf>      
    </mirror> 
	<mirror>      
	  <id>alimaven</id>    
      <name>aliyun maven</name>  
      <url>http://central.maven.org/maven2</url>    
      <mirrorOf>central</mirrorOf>      
    </mirror> 
  </mirrors>

配置java环境变量

配置idea

  1. 配置maven:
    位置:File->Settings->Build,Execution,Deployment->Build Tools->Maven
    修改Maven home path:自己的maven的位置
C:/Program Files/apache-maven-3.6.3

修改User settings file:maven的settings.xml的位置

C:\Program Files\apache-maven-3.6.3\conf\settings.xml

修改Local repository:settings.xml填写的repo地址。

C:\Users\xx\repository
  1. 配置jdk
    位置:File->Project Structure->Platform Settings->SDKs
    “+”,选JDK home path,加入1.8

  2. 配置项目jdk
    位置:File->Project Structure->Project Settings->Project
    修改Project SDK:1.8(没有的话检查下java有没有配好环境变量)
    修改Project Language level: 选8

位置:File->Settings->Build,Execution,Deployment->Compiler->Java Compiler
修改Project bytecode version :8

  1. 配置编码
    位置:File->Settings->Editor->File Encodings
    修改Global Encoding、Project Encoding、Default encoding for properties files 都为UTF-8

导入项目

位置:File->New->Project from existing sources->选项目文件夹
选择import……,选maven

缺少maven依赖,执行(下依赖包用热点,不能用yf)

  1. idea:view->tool windows->maven窗口,项目的lifecycle->clean
  2. 执行
mvn install

或者

mvn clean install  -Dcheckstyle.skip=true -Dmaven.javadoc.skip=true -DskipTests -Dmaven.test.failure.ignore=true

生成必要的api-target,此项不需要git push到远程仓库

  1. maven窗口,项目的右键reload project

或离线状态(第7个按钮)下,点最左边第一个按钮,reload all maven projects(解决netconf加载不出keystore的问题)

终极情况
试一下File->Invalidate Caches/Restart 清除缓存重启 还不行就maven -> Reinport

idea快捷键

  1. 获取提示
    ctrl + space

  2. 生成UML类图
    ctrl + shift + alt + u

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值