当前位置:网站首页>IDEA tools commonly used configuration

IDEA tools commonly used configuration

2022-08-09 21:19:00 Presumptuous youth ゛つ

1、IDEACreate empty project and Module

在实际的开发中,A project may consist of multiple projects.

IDEA中的 p r o j e c t \textcolor{red}{project} project类似于eclipse中的一个workspace, 类似一个文件夹 \textcolor{red}{类似一个文件夹} 类似一个文件夹.

IDEA中的 m o d u l e \textcolor{red}{module} module则类似于eclipse中的project, A concrete code project \textcolor{red}{A concrete code project} A concrete code project.

一般,可以创建一个empty的project,然后在project中创建各种module.

在这里插入图片描述

在这里插入图片描述

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ehnQp7Ij-1658564700846)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220629234001420.png)]

1 )创建 m o d u l e 代码项目 \textcolor{red}{1)创建module代码项目} 1)创建module代码项目

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-XE6kU1Mh-1658564700846)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220629234206558.png)]

2 )方式二:创建 m o d u l e \textcolor{red}{2)方式二:创建module} 2)方式二:创建module

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-nln3vdMW-1658564700847)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220629235631612.png)]

3 )删除 m o d u l e : \textcolor{red}{3)删除module:} 3)删除module

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-lShqpVhn-1658564700847)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220629235717461.png)]

4 )Make the project a directory,其中包括多个 m o d u l e 【It is more common in creating microservices】 \textcolor{red}{4)Make the project a directory,其中包括多个module【It is more common in creating microservices】} 4)Make the project a directory,其中包括多个module【It is more common in creating microservices】

把项目中的src删除,只保留xxx.iml文件,在创建module, Need to pay attention to the location information of the catalog file \textcolor{red}{Need to pay attention to the location information of the catalog file} Need to pay attention to the location information of the catalog file

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-sW0m0yXf-1658564700848)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220630001438914.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-hO6mwquj-1658564700848)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220630001521724.png)]

2、IDEA快捷键

快捷键说明
ctr + /单行注释
ctr + shift + /多行注释
alt + shift + down键向下移动行(该行代码)
alt + shift + up 键向上移动行(该行代码)
Alt + insert生成代码(get set toString等方法) 生成返回变量 记得 N u m L k \textcolor{red}{记得NumLk} 记得NumLk
ctr + d向下复制一行(The line content is copied to the next line)
ctr + o重写方法
shift + 上下键选中多行
ctr + X删除行
ctr + P方法参数提示
ctr + alt + L格式化代码( Q Q 快捷键冲突 \textcolor{red}{QQ快捷键冲突} QQ快捷键冲突

3、IDEA模板 - Templates

代码模板 \textcolor{red}{代码模板} 代码模板:Refers to the configuration of some commonly used code letter abbreviations,When entering abbreviations,IDEA自动提示,补全代码.

内置模板 \textcolor{red}{内置模板} 内置模板:IDEA自带的模板

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-29lepJQo-1658564700849)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220630102550448.png)]

1)Description of common templates

模板说明效果
psvm / main生成main方法public void static main(String []args){ }
sout生成输出语句System.out.println();
fori生成for循环for(int i =0 i < ; i++){ }
list.for生成集合list的for循环
i f n \textcolor{red}{ifn} ifn判断是否为nullif (args == null) { }
. v a r \textcolor{red}{.var} .var生成变量名

2)自定义模板

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-gBNJ2cmz-1658564700849)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220630103441126.png)]

3、maven的安装和配置

mavenIt is an installation-free program,解压就可以使用, 需要使用 m a v e n 的指令,则需要配置 m a v e n 的环境变量 \textcolor{red}{需要使用maven的指令,则需要配置maven的环境变量} 需要使用maven的指令,则需要配置maven的环境变量,maven本身使用Java开发,也依赖JDK的环境变量.

下载 m a v e n ,解压 m a v e n ,配置 m a v e n \textcolor{red}{下载maven,解压maven,配置maven} 下载maven,解压maven,配置maven

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4rbulPVT-1658564700849)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220630174451822.png)]

之后把MAVEN_HOME配置到path中 :%MAVEN_HOME%\bin

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-S5YlkFP1-1658564700850)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220630174741854.png)]

测试maven:cmd 输入 mvn -version

测试是否有maven的版本号

3.1)maven的目录结构介绍

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-sUOC3YJF-1658564700850)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220630175756841.png)]

在 c o n f 的 s e t t i n g . x m l 配置镜像信息(下载 j a r 包快) \textcolor{red}{在conf的setting.xml配置镜像信息(下载jar包快)} confsetting.xml配置镜像信息(下载jar包快)

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-G2KSZujn-1658564700851)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220630175527724.png)]

本地仓库的作用 \textcolor{red}{本地仓库的作用} 本地仓库的作用

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OlyF6XWr-1658564700851)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220630180258054.png)]

配置阿里云的镜像 \textcolor{red}{配置阿里云的镜像} 配置阿里云的镜像

<mirrors>	
    <mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>        
    </mirror>
  </mirrors>

3.2)IDEA中配置maven

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-gi6FNZOG-1658564700852)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220630180721633.png)]

3.3)什么是groupid和artifactId?怎么理解?

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-JwslxDxE-1658564700852)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220630181228337.png)]

(1)groupid和artifactId被统称为坐标,In order to ensure the uniqueness of the project proposed

groupid一般分为多段,The first segment is the domain,The second paragraph is the company name,如org.apache

(2)artifactIdDefines which current project is in leaseID

4、IDEA连接数据库

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-RVIdWjJz-1658564700852)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220630190719382.png)]

I D E A 连接数据库错误: [ 08001 ] C o u l d n o t c r e a t e c o n n e c t i o n t o d a t a b a s e s e r v e r . \textcolor{red}{IDEA连接数据库错误:[08001] Could not create connection to database server.} IDEA连接数据库错误:[08001]Couldnotcreateconnectiontodatabaseserver.

把mysql-connect-java的jar包改成8版本的即可

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-KXNncBPM-1658564700853)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220630223735323.png)]

5、IDEA代码分栏

在这里插入图片描述

原网站

版权声明
本文为[Presumptuous youth ゛つ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/221/202208091753228996.html