8

I'm trying to create an archetype from an existing project using mvn archetype:create-from-project but I'm getting

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

I am behind a firewall so I followed this post https://stackoverflow.com/a/25912982/358794 and then executed:

$ 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

I still get the same PKIX path build failure but just for 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

If I clear a dependency as a test of setting up my trustStore, mv archetype-catalog archetype-catalog_backup and rerun it does connect to the repo and redownloads archetype-catalog but still gets hung up on 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] ------------------------------------------------------------------------

Trying to download just archetype-packaging yields the same error

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

Any ideas on how to get a BUILD SUCCESS? I'm able to right click on each file in the browser and save into the local repository but when I try to execute goal mvn archetype:create-from-project maven still tries to download the archetype-packaging

Community
  • 1
  • 1
jeff
  • 3,618
  • 9
  • 48
  • 101
  • Can you try sending a curl request to see the difference between two responses e.g: curl -v -k -x https://proxyhost:proxyport -L https: //repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-packaging/3.0.0/archetype-packaging-3.0.0.pom and curl -v -k -x https://proxyhost:proxyport -L https: //repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-catalog/3.0.0/archetype-catalog-3.0.0.pom – htulsiani Mar 10 '17 at 13:50
  • A simple workaround would be simply to use the http version of the repo you are trying to download from within the repository section of settings.xml, or your pom, (something the like: http://repo.maven.apache.org/maven2) or is it not acceptable? – Adonis Mar 11 '17 at 17:42
  • I actually solved it by following http://stackoverflow.com/a/25912472/358794 and adding the repository in my settings.xml. Got it working about 2 hours after posting bounty :( Who wants it? – jeff Mar 13 '17 at 11:26
  • I guess you can still answer your own question no? – Adonis Mar 13 '17 at 12:45

1 Answers1

6

The answer provided here, adding the new maven repository in my settings.xml finally solved the issue Problems using Maven and SSL behind proxy

Earlier, I kept focusing on trying to generate the cert and including it in my trustStore but that never solved the issue.

I still needed to specify my proxy in the settings.xml as well

Community
  • 1
  • 1
jeff
  • 3,618
  • 9
  • 48
  • 101