如何从多个Maven存储库下载人工制品?

时间:2019-07-03 17:34:02

标签: proxy certificate repository maven-3 maven-plugin

我最近加入了一个新团队,但是在从多个存储库下载人工制品时遇到了问题。我的公司还使用代理服务器。

为我提供了settings.xml文件,但是该文件仅包含 recentcentral 的镜像和存储库设置。

我正在使用Maven 3.6.1版。

       <mirrors>
        <mirror>
            <mirrorOf>external:*</mirrorOf>
            <name>repocentral</name>
            <url>https://companyname/artifactory/repocentral</url>
            <id>artifactory</id>
        </mirror>
        <!-- I added below mirror -->
        <mirror>
            <mirrorOf>external:*</mirrorOf>
            <name>nodejsmirror</name>
            <url>https://companyname/artifactory/nodejsmirror</url>
            <id>nodejs</id>
        </mirror>
    </mirrors>
    <proxies>
        <proxy>
          <id>proxy</id>
          <active>true</active>
          <protocol>http</protocol>
          <host>xxx.xx.xxx.xx</host>
          <port>xxxx</port>
        </proxy>
    </proxies>
    <profiles>
        <profile>
            <id>artifactory</id>
            <repositories>
                <repository>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                    <id>central</id>
                    <name>libs-release</name>
                    <url>https://companyname/artifactory/repocentral</url>
                </repository>
                <!-- I added below repo -->
                <repository>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                    <id>nodejsmirror</id>
                    <name>libs-release</name>
                    <url>https://companyname/artifactory/nodejsmirror</url>
                </repository>
                <repository>
                    <snapshots/>
                    <id>snapshots</id>
                    <name>libs-snapshot</name>
                    <url>https://companyname/artifactory/repocentral</url>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                    <id>central</id>
                    <name>plugins-release</name>
                    <url>https://companyname/artifactory/plugins-release</url>
                </pluginRepository>
                <!-- I added below plugin -->
                <pluginRepository>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                    <id>nodejsmirror</id>
                    <name>plugins-release</name>
                    <url>https://companyname/artifactory/plugins-release</url>
                </pluginRepository>
                <pluginRepository>
                    <snapshots/>
                    <id>snapshots</id>
                    <name>plugins-snapshot</name>
                    <url>https://companyname/artifactory/plugins-snapshot</url>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>artifactory</activeProfile>
    </activeProfiles>

当我尝试从https://companyname/artifactory/repocentral这个位置下载文物时,maven会正确下载文物。

我尝试添加新的存储库和镜像,但是当我尝试从同一域下的其他位置下载文件时,由于以下Sun证书错误而失败:

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.0:install-node-and-npm (install node and npm) on project frontend: Could not download Node.js: Could not download https://companyname/artifactory/nodejsmirror/v8.12.0/node-v8.12.0-darwin-x64.tar.gz: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]

考虑到尝试从 repocentral 下载时可以正常工作,我认为证书是正确和有效的。

我怀疑问题出在./m2/settings.xml中正确声明了我的存储库。

如何配置Maven从多个位置下载?

谢谢

0 个答案:

没有答案