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

IntelliJ打开SBT项目失败:jansi 1.11依赖无法解析及证书错误

Fixing SBT Project Import Error: Missing Jansi 1.11 & PKIX Certificate Issue

Hey there, let's tackle this SBT import issue you're facing head-on. From the error logs you shared, the core problems are two-fold: your setup can't fetch the jansi 1.11 dependency, and the real root cause is a PKIX certificate validation failure when trying to connect to HTTPS repositories like Maven Central. Here's how to fix this step by step:

1. Resolve the PKIX Certificate Trust Issue (Root Cause)

The "PKIX path building failed" error means your JVM doesn't trust the SSL certificates of the repositories you're trying to access. You have two solid options here:

  • Open your browser and navigate to the main Maven Central repository site. Click the lock icon in the address bar, go to certificate details, and export the certificate as a DER-formatted file.
  • Locate the cacerts file in your JDK's security directory (typically C:\Program Files\Java\jdk[your-version]\jre\lib\security\cacerts).
  • Launch Command Prompt as Administrator and run this command to import the certificate:
    keytool -import -alias maven-central -keystore "C:\Program Files\Java\jdk[your-version]\jre\lib\security\cacerts" -file "C:\path\to\your\exported\certificate.cer"
    
    • The default password for the cacerts store is changeit.

Option B: Temporarily Skip SSL Validation (For Debugging Only)

If you need a quick fix to test things out, add VM parameters to your SBT configuration in IntelliJ:

  • Go to File > Settings > Build, Execution, Deployment > Build Tools > sbt
  • In the VM parameters field, add:
    -Dssl.trustAll=true
    
    Important: This disables SSL security checks, so avoid using this in production environments.

2. Adjust SBT Dependencies & Repository Config

Update to a Newer Jansi Version

The 1.11 version of Jansi is quite outdated, and some repositories might no longer host it. Try explicitly declaring a newer, compatible version in your build.sbt:

libraryDependencies += "org.fusesource.jansi" % "jansi" % "1.18"

Verify Repository Setup

Make sure your build.sbt includes Maven Central as a resolver:

resolvers += "Maven Central" at "https://repo1.maven.org/maven2/"

3. Clean Local Caches & Restart

Corrupted local cache files can often cause dependency issues. Let's clear them and retry:

  • Delete the following directories:
    • C:\Users\user_name\.ivy2\local
    • C:\Users\user_name\.sbt\preloaded
  • In IntelliJ, go to File > Invalidate Caches... > Invalidate and Restart
  • After the IDE restarts, re-import your SBT project.

After following these steps, your SBT project should import successfully without the Jansi dependency error.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 04:15:51