Your Site Title

Build maven 导入maven项目

安装Svn插件

  1. eclipse market在线安装 eclipse -> Help -> Eclipse Marketplace (搜索subclipse)
  2. Install new Software eclipse -> Help -> Install New Software http://subclipse.tigris.org/update_1.10.x/ (subversion 1.8.x) 版本太旧

Svn Checkout

  1. 使用Eclipse svn Checkout 出项目
  2. 右键项目 -> Configure -> convert maven 项目

安装lombok插件

  1. https://projectlombok.org/download 下载lombok.jar包, 放到eclipse根目录
  2. java -jar D:\DEV_ENV\eclipse\lombok.jar
  3. 查看eclipse.ini 如果有lombok配置就证明安装成功

运行

  1. 如果是spring boot 直接循行Application
  2. 如果是java web, 右键项目 -> Project Facets -> (勾选:1 Dynamic web Module 2 java 3 Javascript)

程序相关目录

** 程序相关目录(如安装目录,部署目录) 不要使用中文路径 **

VSCode 导入Maven项目

项目使用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>

设置默认编译JDK

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>

idea中使用lombak

  1. 安装Lombok Plugin 插件
  2. 重启
  3. Setting | Build, Execution, Deployment | Compiler | Annotation Processors 打开Enable annotation processing
  4. Setting | Build, Execution, Deployment | Compiler Shared build process VM options: -Djps.track.ap.dependencies=false User-local build process VM options (overrides Shared options): -Djps.track.ap.dependencies=false

Lombok Does not work with IntelliJ EAP 2020.3 Build 203.4203.26

mvn 跳过测试

mvn install -Dmaven.test.skip=true
mvn install -DskipTests