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

Gradle中SSL错误排查:-Djavax.net.debug=ssl参数未生效怎么办?

How to Properly Enable SSL Debug Logs for Gradle Maven Dependency Resolution

Got it, let's tackle why your -Djavax.net.debug=ssl parameter isn't generating any SSL output when Gradle resolves Maven dependencies. The key issue here is how you're passing JVM arguments to Gradle's runtime—since Gradle spins up its own JVM instance, just tacking the parameter onto your command might not be picked up correctly. Here are the reliable ways to fix this:

1. Pass the Argument Directly via Command Line

When running Gradle (or the Gradle wrapper), you need to ensure the JVM flag is passed to Gradle's own JVM. Use this syntax:

# For standard Gradle
gradle compileJava -Djavax.net.debug=ssl,handshake,verbose

# For Gradle Wrapper (Linux/macOS)
./gradlew compileJava -Djavax.net.debug=ssl,handshake,verbose

# For Gradle Wrapper (Windows)
gradlew.bat compileJava -Djavax.net.debug=ssl,handshake,verbose

I recommend using ssl,handshake,verbose instead of just ssl—it narrows down the logs to handshake details (which is most useful for dependency resolution SSL issues) without flooding you with too much noise. If you need even more detail, swap it for ssl,all.

2. Persist the Setting in gradle.properties

If you don't want to type the parameter every time, add it to your project's gradle.properties file (create it in the project root if it doesn't exist):

org.gradle.jvmargs=-Djavax.net.debug=ssl,handshake,verbose

This ensures the SSL debug flag is applied every time you run Gradle for this project.

3. Check for Conflicting Configurations

If you still don't see SSL logs, verify that no other configuration is overriding the JVM args:

  • IDE Run Configurations: If you're using IntelliJ or Eclipse, check the Gradle run configuration's "VM options" field—any values here will override command line or gradle.properties settings.
  • Environment Variables: Ensure there's no ORG_GRADLE_JVMARGS environment variable set that's replacing your custom flags.

4. Verify the Logs Are Triggered

Remember: SSL logs only show up when Gradle actually resolves dependencies. Running tasks like clean won't trigger dependency resolution—run a task that requires downloading/validating dependencies, like compileJava, build, or just dependencies.

If you follow these steps, you should see detailed SSL handshake logs in your console, which will help you pinpoint issues like invalid certificates, unsupported protocols, or truststore problems.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 06:43:01