嗨!
我尝试使用JDK 10.0.1和“spring-boot-starter-test”启动Intellij(ultimate)时遇到了一些麻烦。如果我运行主方法,无论其内容如何,无论是否有任何活动测试,编译后运行前都会收到“Error:java: java.lang.ExceptionInInitializerError”的错误。
总之,这导致了错误。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
现在我假设这与Spring Boot测试不兼容JDK 10有关,虽然我倾向于询问,任何解决方法的想法?
更新2 明确一下,这是我从Intellij收到的唯一输出。
Information:javac 10.0.1 was used to compile java sources
Information:2018-05-14 21:04 - Compilation completed with 1 error and 0 warnings in 2 s 381 ms
Error:java: java.lang.ExceptionInInitializerError
构建、版本和依赖关系在此处
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>10</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>