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

使用mvnd时如何指定Maven属性?SSL证书问题求助

mvnd执行clean install时SSL证书验证失败问题

错误信息

运行mvnd clean install时出现以下错误:

[ERROR]   The project com.exmpale:my-project:SP-21.053.00_-SNAPSHOT (/home/username/IdeaProjects/my-project/pom.xml) has 1 error
[ERROR]     Non-resolvable import POM: The following artifacts could not be resolved: org.assertj:assertj-bom:pom:3.25.0 (absent): Could not transfer artifact org.assertj:assertj-bom:pom:3.25.0 from/to public (https://nexus-ci.com/repository/public/): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target @ line 5739, column 19 -> [Help 2]

Maven下的解决方法

使用普通Maven时,我通过在项目根目录创建.mvn/jvm.config文件并添加以下内容解决了该问题:

-Dmaven.wagon.http.ssl.ignore.validity.dates=true
-Dmaven.wagon.http.ssl.allowall=true
-Dmaven.wagon.http.ssl.insecure=true

尝试过的无效方法(针对mvnd)

我尝试了以下几种方式添加上述属性,但均未生效:

  • settings.xml配置:
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <localRepository>/home/username/.m2/repository</localRepository>
    <profiles>
        <profile>
            <id>default</id>
            <properties>
                <maven.wagon.http.ssl.allowall>true</maven.wagon.http.ssl.allowall>
                <maven.wagon.http.ssl.insecure>true</maven.wagon.http.ssl.insecure>
                <maven.wagon.http.ssl.ignore.validity.dates>true</maven.wagon.http.ssl.ignore.validity.dates>
            </properties>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
    </profiles>
    <!-- other tags are omitted -->
</settings>
  • 项目根目录.mvn/maven.config文件:
-Dmaven.wagon.http.ssl.ignore.validity.dates=true
-Dmaven.wagon.http.ssl.allowall=true
-Dmaven.wagon.http.ssl.insecure=true
  • .mvnd.properties中的jvmArgs属性:
mvnd.jvmArgs=-Dmaven.wagon.http.ssl.ignore.validity.dates=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.insecure=true
  • 终端直接传参:
mvnd clean install -Dmaven.wagon.http.ssl.ignore.validity.dates=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.insecure=true

环境版本信息

Maven版本

Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)
Maven home: /opt/apache-maven-3.8.8
Java version: 1.8.0_282, vendor: AdoptOpenJDK, runtime: /usr/lib/jvm/jdk8u282-b08/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.7.1-amd64", arch: "amd64", family: "unix"

mvnd版本

Apache Maven Daemon (mvnd) 1.0.2 linux-amd64 native client (cccc1ec8a5b741c62b29f9fb04d37b1678a029bb)
Terminal: org.jline.terminal.impl.PosixSysTerminal with pty org.jline.terminal.impl.jni.linux.LinuxNativePty
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: /home/username/maven-mvnd-1.0.2-linux-amd64/mvn
Java version: 1.8.0_282, vendor: AdoptOpenJDK, runtime: /usr/lib/jvm/jdk8u282-b08/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.7.1-amd64", arch: "amd64", family: "unix"

请求指导

请告知如何在mvnd中正确指定这些Maven属性以解决SSL证书验证失败的问题。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 03:35:57