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

任务':bootRun'执行失败:Java进程非零退出值1求助

Troubleshooting bootRun Non-Zero Exit Code 1 Failure

Hey there, I know how frustrating it is when you’ve tried all the usual fixes—reinstalling Java, Gradle, digging through similar issues—and still hit that non-zero exit code 1 error with bootRun. Let’s break down targeted steps to get to the root of this:

  • First, grab the full error details
    Exit code 1 is just a generic "something went wrong" signal—we need the actual stack trace or error messages that show up right before this line. Run the command with verbose logging to unlock more context:

    gradlew bootRun --info
    

    Or for hyper-detailed output:

    gradlew bootRun --debug
    

    If you already have a full stack trace, sharing that would make pinpointing the issue way easier.

  • Check for common startup blockers

    • Port conflicts: Spring Boot defaults to port 8080—on Windows, run this to see if another process is hogging it:
      netstat -ano | findstr :8080
      
      If it’s occupied, kill the process or tweak the port in your application.properties/application.yml.
    • Configuration file typos: Missing colons in YAML, invalid property names, or misspelled values are super common culprits. Double-check every line, especially if you recently edited your configs.
    • Java version mismatch: You’re using JDK 9.0.4—make sure it lines up with your Spring Boot version’s requirements:
      • Spring Boot 2.x supports Java 8-17
      • Spring Boot 3.x requires Java 17+
        If your project is on Spring Boot 3.x, JDK 9 will definitely cause startup failures.
  • Wipe caches and rebuild from scratch
    Cached files often cause weird, hard-to-track issues. Try these steps:

    1. Delete the build folder in your project root
    2. Delete the .gradle folder in your project root
    3. Clear Gradle’s global cache (Windows path: C:\Users\YourUsername\.gradle\caches)
    4. Run a clean, cache-free build:
      gradlew clean build --no-build-cache
      

    Then give bootRun another shot.

  • Test running the built JAR directly
    Sometimes the bootRun task hides more detailed errors. Build the JAR first:

    gradlew build
    

    Then run it with Java directly:

    java -jar build/libs/your-application-name.jar
    

    This often surfaces clearer messages about missing dependencies, classpath issues, or runtime failures.

  • Verify Gradle and Spring Boot plugin compatibility
    Make sure your Gradle version aligns with the Spring Boot plugin version in your build.gradle:

    • Spring Boot 2.7.x works best with Gradle 7.x
    • Spring Boot 3.x requires Gradle 8.x
      A mismatch here can trigger silent startup failures that only show up as exit code 1.

If you can share more details—like the full stack trace, your build.gradle content, or your Spring Boot version—I can help narrow this down even further!

内容的提问来源于stack exchange,提问作者Antonio De la Torre

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.20 09:02:31