** 程序相关目录(如安装目录,部署目录) 不要使用中文路径 **
项目使用Maven构建, 使用Spring Boot框架, 使用lombok
安装插件:
1. Java Extension Pack
2. Language Support for Java
3. Maven for Java
4. Spring Boot Extension
配置VSCode:
1. 下载lombok.jar https://projectlombok.org/download
2. 进入vscode settings.json
3. -javaagent:\"/Volumes/store/lib/lombok.jar\" 加入 java.jdt.ls.vmargs
4. "org.eclipse.jdt.core.prefs": {
"org.eclipse.jdt.core.compiler.processAnnotations": "disabled",
"org.eclipse.jdt.apt.aptEnabled": false
}
pom.xml:
1. <m2e.apt.activation>disabled</m2e.apt.activation> 加入到properties
2. <dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.2</version>
<scope>provided</scope>
</dependency>
mvn 默认会使用1.6编译项目, 如果使用更新版本JDK的特性, 会报
diamond operator is not supported in -source 1.6
.
全局设置:
${MAVEN_HOME}/conf/setting.xml, <profiles>标签下
<profile>
<id>jdk1.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>
项目设置:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
Lombok Does not work with IntelliJ EAP 2020.3 Build 203.4203.26
mvn install -Dmaven.test.skip=true
mvn install -DskipTests