Skip to content

无法下载jar包 #1

@hailiang-wang

Description

@hailiang-wang

在Mac上,执行mvn install 遇到如下错误

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building sample 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://nexus.chatopera.com/repository/maven-public/com/chatopera/bot/sdk/1.0.1/sdk-1.0.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.024 s
[INFO] Finished at: 2018-11-06T18:15:08+08:00
[INFO] Final Memory: 10M/165M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project sample: Could not resolve dependencies for project com.chatopera.bot:sample:jar:1.0-SNAPSHOT: Failed to collect dependencies at com.chatopera.bot:sdk:jar:1.0.1: Failed to read artifact descriptor for com.chatopera.bot:sdk:jar:1.0.1: Could not transfer artifact com.chatopera.bot:sdk:pom:1.0.1 from/to public (https://nexus.chatopera.com/repository/maven-public): sun.security.validator.ValidatorException: PKIX path building failed:
 sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

解决办法

  1. 安装最新的Java SDK
    下载地址

  2. 查看Java 安装路径
    Mac上的路径为

/Library/Java/JavaVirtualMachines/jdk_xxx.jdk/Contents/Home

xxx为该虚拟机版本,比如目前最新版本为

/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home
  1. 设置JAVA_HOME
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home
export PATH=$PATH:$JAVA_HOME/bin
  1. 测试Java版本
java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
  1. 执行mvn install

image

下载成功

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions