本文主要介绍的是程序员在编程前所要做的准备工作
首先idea使用的是idea2021.2.4版本
安装maven 3.6.3 (如果maven版本选择3.8以上版本会出现编译打包不通过的情况) 解压。配置maven环境变量 MAVEN_HOME I:\maven\apache-maven-3.6.3-bin\apache-maven-3.6.3 (选择合适自己的路径配置)
maven.settings.xml配置:
<!-- 本地仓库的位置 -->
<localRepository>I:\repo</localRepository>
<!-- Apache Maven 配置 -->
<pluginGroups/>
<proxies/>
<!-- 私服发布的用户名密码 -->
<servers>
<server>
<id>releases</id>
<username>deployment</username>
<password>He2019</password>
</server>
<server>
<id>snapshots</id>
<username>deployment</username>
<password>He2019</password>
</server>
</servers>
<!-- 阿里云镜像 -->
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<!-- https://maven.aliyun.com/repository/public/ -->
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<!-- 配置: java8, 先从阿里云下载, 没有再去私服下载 -->
<profiles>
<!-- 全局JDK1.8配置 -->
<profile>
<id>jdk1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<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>
<!-- Nexus私服配置: 第三方jar包下载, 比如oracle的jdbc驱动等 -->
<profile>
<id>dev</id>
<repositories>
<repository>
<id>nexus</id>
<url>http://nexus.hepengju.cn:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>Public Repositories</name>
<url>http://nexus.hepengju.cn:8081/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>
<!-- 阿里云配置: 提高国内的jar包下载速度 -->
<profile>
<id>ali</id>
<repositories>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<!-- 激活配置 -->
<activeProfiles>
<activeProfile>jdk1.8</activeProfile>
<activeProfile>dev</activeProfile>
<activeProfile>ali</activeProfile>
</activeProfiles>
idea中全局配置maven
编辑 help下 Custom VM Options: -Xms1024m -Xmx2048m -Dfile.encoding=UTF-8 同时file---settings---Editor---FileEncodings的GlobalEncoding和ProjectEncoding和Default encoding for properties都配置成UTF-8
配置jdk 配置阿里巴巴编码模板: 下载codeformater 插件 阿里巴巴格式化模板文件下载地址 alibaba/p3c
修改格式化快捷键 ; keymap eclipse风格下 reformatcode 改为 alt+s
设置优先从本地仓库读: buildtools maven 下 runner -VM Options -DarchetypeCatalog=internal
设置自动编译: build->compiler 勾选
设置自动换行: 点击File->Setting->Editor->Code Style->Java,默认换行的宽度为120 Wrap on typing更改为Yes ,gengeral下 soft-wrap files: . (全局自动感应换行)
新建文件加上默认的作者和时间: Settings – Editor – File and Code Templates-> class :
#if ({PACKAGE_NAME} && {PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end /**
- 描述:
- ${DESCRIPTION}
- @author ${USER}
- @create {MONTH}-{TIME} */ public class ${NAME} {
}