Maven无法在同一个仓库中转移许多工件中的一个

时间:2017-03-06 15:17:22

标签: maven ssl certificate

我尝试使用mvn archetype:create-from-project从现有项目创建原型,但我正在

Could not transfer artifact org.apache.maven.archetype:archetype-packaging:pom:3.0.0 
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

我在防火墙后面,所以我按照这篇文章https://stackoverflow.com/a/25912982/358794然后执行了:

$ mvn archetype:create-from-project -Djavax.net.ssl.keyStore=trustCARoot.jks
 -Djavax.net.ssl.keyStorePassword=password  
 -Djavax.net.ssl.keyStoreType=JKS
 -Djavax.net.ssl.trustStore=trustCARoot.jks  
 -Djavax.net.ssl.trustStorePassword=password  
 -Djavax.net.ssl.trustStoreType=JKS

我仍然得到相同的PKIX路径构建失败,但仅适用于archetype-packaging

[INFO] Setting default groupId: com.domain.rozycki
[INFO] Setting default artifactId: SkillsApp
[INFO] Setting default version: 0.0.1-SNAPSHOT
[INFO] Setting default package: com.domain.skillsapp
[INFO] Scanning for projects...
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-packaging/3.0.0/archetype-packaging-3.0.0.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Unresolveable build extension: Plugin org.apache.maven.archetype:archetype-packaging:3.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.m
aven.archetype:archetype-packaging:jar:3.0.0 @
[ERROR] Unknown packaging: maven-archetype @ line 8, column 14
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project com.gdeb.rozycki:SkillsApp-archetype:0.0.1-SNAPSHOT (C:\Users\jrozycki\Development\Archetype\SkillsApp\target\generated-sources\archetype\pom.xml) has 2 errors
[ERROR]     Unresolveable build extension: Plugin org.apache.maven.archetype:archetype-packaging:3.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apac
he.maven.archetype:archetype-packaging:jar:3.0.0: Could not transfer artifact org.apache.maven.archetype:archetype-packaging:pom:3.0.0 from/to central (https://repo.maven.apache.org/maven2): sun.secur
ity.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 2]
[ERROR]     Unknown packaging: maven-archetype @ line 8, column 14
[ERROR]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

enter image description here

如果我清除依赖项作为设置我的trustStore的测试,mv archetype-catalog archetype-catalog_backup并重新运行它确实连接到repo并重新下载archetype-catalog但仍然挂起archetype-packaging

Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-catalog/3.0.0/archetype-catalog-3.0.0.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-catalog/3.0.0/archetype-catalog-3.0.0.pom (2 KB at 2.5 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-catalog/3.0.0/archetype-catalog-3.0.0.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-catalog/3.0.0/archetype-catalog-3.0.0.jar (19 KB at 70.1 KB/sec)
[INFO] Setting default groupId: com.domain.rozycki
[INFO] Setting default artifactId: SkillsApp
[INFO] Setting default version: 0.0.1-SNAPSHOT
[INFO] Setting default package: com.domain.skillsapp
[INFO] Scanning for projects...
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-packaging/3.0.0/archetype-packaging-3.0.0.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Unresolveable build extension: Plugin org.apache.maven.archetype:archetype-packaging:3.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.m
aven.archetype:archetype-packaging:jar:3.0.0 @
[ERROR] Unknown packaging: maven-archetype @ line 8, column 14
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project com.gdeb.rozycki:SkillsApp-archetype:0.0.1-SNAPSHOT (C:\Users\jrozycki\Development\Archetype\SkillsApp\target\generated-sources\archetype\pom.xml) has 2 errors
[ERROR]     Unresolveable build extension: Plugin org.apache.maven.archetype:archetype-packaging:3.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apac
he.maven.archetype:archetype-packaging:jar:3.0.0: Could not transfer artifact org.apache.maven.archetype:archetype-packaging:pom:3.0.0 from/to central (https://repo.maven.apache.org/maven2): sun.secur
ity.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 2]
[ERROR]     Unknown packaging: maven-archetype @ line 8, column 14
[ERROR]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

尝试仅下载archetype-packaging会产生相同的错误

mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get \
    -DrepoUrl=https://repo.maven.apache.org/maven2 \
    -Dartifact=org.apache.maven.archetype:archetype-packaging:3.0.0
    -Djavax.net.ssl.keyStore=trustCARoot.jks -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.keyStoreType=JKS  -Djavax.net.ssl.trustStore=trustCARoot.jks  -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.trustStoreType=JKS

关于如何获得BUILD成功的任何想法?我能够右键单击浏览器中的每个文件并保存到本地存储库,但是当我尝试执行目标mvn archetype:create-from-project时,maven仍尝试下载archetype-packaging

1 个答案:

答案 0 :(得分:6)

这里提供的答案是,在我的settings.xml中添加新的maven存储库,最终解决了问题Problems using Maven and SSL behind proxy

早些时候,我一直专注于尝试生成证书并将其包含在我的trustStore中,但从未解决过这个问题。

我仍然需要在settings.xml中指定我的代理