You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

从start.spring.io下载的Maven Java项目在IntelliJ中运行报错求助

Troubleshooting Your Spring Boot + Vaadin Project Run Error with Java 9

Hey there, let's work through this issue you're facing—running a Spring Boot 2.0.0 project (with Web, JPA, Vaadin dependencies) on Java 9 in IntelliJ has been throwing errors, and you've had similar issues with start.spring.io projects before. Here are the most likely fixes:

1. Fix Version Compatibility Gaps

Spring Boot 2.0.0 has experimental, limited support for Java 9—it was primarily built for Java 8. This mismatch often causes module system (JPMS) conflicts or missing compatibility layers.

  • Option 1: Downgrade your Java SDK to 8. This is the most reliable fix since Spring Boot 2.0.x is fully optimized for Java 8.
  • Option 2: Upgrade your Spring Boot version to 2.1.x or later. These releases have much better Java 9 support and resolve many of the early compatibility bugs.

2. Resolve Vaadin-Java 9 Compatibility

Older Vaadin versions paired with Spring Boot 2.0.0 might not handle Java 9's module system correctly.

  • Check your pom.xml for the Vaadin version—upgrade it to a release that explicitly supports Java 9 (Vaadin 10+ should work, but verify the compatibility matrix with your Spring Boot version).
  • If you're using the Spring Boot Vaadin starter, make sure the starter version aligns with both your Spring Boot and Vaadin versions to avoid dependency conflicts.

3. Correct IntelliJ's Project Configuration

IntelliJ sometimes misconfigures Java 9 projects, especially with older Spring Boot versions:

  • Open Project Structure (Ctrl+Alt+Shift+S on Windows/Linux, Cmd+; on Mac):
    • Confirm the Project SDK is set to Java 9.
    • Set the Language Level for your module to 9 (or "9 - Modules, private methods, etc.").
  • Try switching your project dependencies from Module Path to Class Path: Right-click your project → Open Module Settings → Libraries → Select each library → Change from "Module Path" to "Class Path". This bypasses JPMS module issues that early Spring Boot versions don't handle well.

4. Fix Maven Compiler Configuration

Your pom.xml might not be set up to compile for Java 9, leading to runtime mismatches:
Add or update the maven-compiler-plugin in your build plugins section:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>9</source>
                <target>9</target>
                <!-- Optional: Add this if you hit JPA-related module access issues -->
                <compilerArgs>
                    <arg>--add-modules java.xml.bind</arg>
                </compilerArgs>
            </configuration>
        </plugin>
    </plugins>
</build>

The --add-modules java.xml.bind flag fixes common JPA errors since Java 9 moved JAXB to optional modules.

5. Clean Corrupted Maven Dependencies

If you've had issues with other start.spring.io projects before, your local Maven repository might have corrupted or incomplete dependencies:

  • Delete the relevant folders from your local Maven repo (usually ~/.m2/repository/org/springframework and ~/.m2/repository/com/vaadin).
  • Run mvn clean install in your project root to re-download fresh, uncorrupted dependencies.

Give these steps a shot—if you still hit errors, sharing the exact stack trace from IntelliJ would help pinpoint the exact issue faster!

内容的提问来源于stack exchange,提问作者Glement

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 08:08:55