Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在Eclipse中创建Maven项目时出现证书路径错误_Java_Eclipse_Maven_Certificate - Fatal编程技术网

Java 在Eclipse中创建Maven项目时出现证书路径错误

Java 在Eclipse中创建Maven项目时出现证书路径错误,java,eclipse,maven,certificate,Java,Eclipse,Maven,Certificate,我试图在EclipseOxygen中创建一个Maven项目,但结果出现了错误。以下是我所做的步骤: 选择文件->新建->Maven项目 在弹出窗口中,选中“创建简单项目(跳过原型选择)”,并选中“使用默认工作区位置”(将位置字段留空) 单击下一步 输入“com.xyz”表示“组Id”,“test”表示“工件Id”,“0.0.1-SNAPSHOT”表示“版本”,输入“jar”表示“打包” 将其余字段留空,单击Finish 创建项目时出错。在工作区日志中,我可以看到以下内容: Could n

我试图在EclipseOxygen中创建一个Maven项目,但结果出现了错误。以下是我所做的步骤:

  • 选择文件->新建->Maven项目
  • 在弹出窗口中,选中“创建简单项目(跳过原型选择)”,并选中“使用默认工作区位置”(将位置字段留空)
  • 单击下一步
  • 输入“com.xyz”表示“组Id”,“test”表示“工件Id”,“0.0.1-SNAPSHOT”表示“版本”,输入“jar”表示“打包”
  • 将其余字段留空,单击Finish
  • 创建项目时出错。在工作区日志中,我可以看到以下内容:

        Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
    
    当我打开新创建的pom.xml时,我可以看到一个错误:

    Multiple annotations found at this line:
    - CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be 
     resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1: ArtifactResolutionException: Failure to transfer 
     org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be 
     reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-
     compiler-plugin:pom:3.1 from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: 
     sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (execution: default-
     testCompile, phase: test-compile)
    - Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from https://repo.maven.apache.org/maven2 was cached in the local 
     repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact 
     org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (execution: default-compile, 
     phase: compile)
    
    下面是我之前在settings.xml中的内容,它包含代理设置,因为我在防火墙后面

        <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                                  https://maven.apache.org/xsd/settings-1.0.0.xsd">
        <localRepository/>
        <interactiveMode/>
        <usePluginRegistry/>
        <offline/>
        <pluginGroups/>
        <servers/>
        <mirrors/>
        <proxies>
                <proxy>
                        <id>example-proxy</id>
                        <active>true</active>
                        <protocol>http</protocol>
                        <host>xx.xx.xx.xx</host>
                        <port>80</port>
                        <username>xxxxxxxx</username>
                        <password>xxxxxxxx</password>
                        <nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
                </proxy>
        </proxies>
        <profiles/>
        <activeProfiles/>
    </settings>
    
    那么如何解决此认证路径错误?

    以下是与您的问题类似的线程,您正在尝试连接到https远程存储库-“”。
    大多数情况下,支持HTTPS连接的证书未包含在cacerts文件中。

    谢谢。我在那里使用了答案,在settings.xml中更改为http maven repository,它可以工作。欢迎您:)并感谢您接受答案:)如果您想包含证书,这非常简单。
    sun.security.validator.ValidatorException: PKIX path building failed: 
     sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target