Issue
I tried creating a Maven project with the command:
mvn archetype:generate
Unfortunately, it didn't work, so I searched on the net. Thanks to stackoverflow, I understood that the error had to do with the proxy of my company, so I've created a settings.xml file in :
${user.home}/.m2/settings.xml
Here is the settings.xml file :
<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">
<proxies>
<proxy>
<id>my_id</id>
<active>true</active>
<protocol>http</protocol>
<host>my_host</host>
<port>my_port</port>
<nonProxyHosts>localhost|127.0.0.1|*.my_company.com</nonProxyHosts>
</proxy>
</proxies>
</settings>
the proxy tag was given by a coworker, it should be correct.
However, I still have an error, here is the error message:
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.5: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
***
Some warnings here
***
[WARNING] Failure to transfer org.apache.maven.plugins/maven-metadata.xml 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 metadata org.apache.maven.plugins/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Access denied to: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
[WARNING] Failure to transfer org.codehaus.mojo/maven-metadata.xml 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 metadata org.codehaus.mojo/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Access denied to: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.285 s
[INFO] Finished at: 2019-04-09T16:05:17+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\ho.hince\.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException
C:\Users\ho.hince\Desktop\Spring\test>mvn archetype: generate
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.132 s
[INFO] Finished at: 2019-04-09T16:09:58+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\ho.hince\Desktop\Spring\test). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
I wondered if the host or the port number was wrong, so I've tried to change it multiple times to see what would happen.
When I change the port number to a random port, I still have the same error, but the process slow down considerably.
I've searched the solution on this website and on other site for hours, but still can't find a solution.
I am sincerely sorry, if I made a mistake in this question, but I've spent half an hour to make it and made sure to follow instructions.
Thank you in advance. :)
Solution
I found a solution, I changed the settings.xml server tag.
I changed it to an Nexus url, so that, I download the jars of my company.
I needed to import certificates in JAVA, if you have the same problem with SSL certificate.
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
You can find an answer in this video:
https://www.youtube.com/watch?v=z3tAp3m5YBo
Answered By - Hamza Ince