I tried to do mvn install on my Maven project. But I get the error:
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:3.1.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:3.1.0: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:3.1.0 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/3.1.0/maven-clean-plugin-3.1.0.pom ProxyInfo{host='MYCOMPANYPROXYHOST', userName='null', port=8080, type='https', nonProxyHosts='null'}: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
I get an error telling me that Maven couldn't find the certificate, I searched almost every website to find a solution.
What I have tried :
I changed the Maven settings file, my settings.xml file is like below:
<proxies>
<proxy>
<active>true</active>
<protocol>https</protocol>
<host>MY_COMPANY_HOST</host>
<port>8080</port>
<username>MY_USERNAME</username>
<password>MY_PASSWORD</password>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>MY_COMPANY_HOST</host>
<port>8080</port>
<username>MY_USERNAME</username>
<password>MY_PASSWORD</password>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
</proxies>
I went to https://repo.maven.apache.org/maven2 and downloaded the certificate, then I added it to the cacerts, with the command:
keytool -import -alias example -keystore .\cacerts -file example.cer
Details :
The cacerts file is in %JAVA_HOME%\lib\security.
I could obviously go to https://repo.maven.apache.org/maven2 on my Web Browser, since I've downloaded the certificate.
I am on Windows 10, 64 bits
EDIT:
The command mvn -version show gives:
Picked up JAVA_TOOL_OPTIONS: -Djava.vendor="Sun Microsystems inc."
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Users\MYUSER\Desktop\Code\apache-maven-3.6.3\bin\..
Java version: 1.8.0_73, vendor: Sun Microsystems inc., runtime: C:\Users\MYUSER\Desktop\TEST\05-Environnement_dev\Tools\Java\jdk-8u73-windows-x64\jre
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
EDIT 2:
I tried to use Eclipse, instead of the Maven command. And I could verify this:
When I change the username or the password I get the error Failed to authenticate with proxy, and modifying the proxy host changes the error message. I can now guarantee that the proxy settings are correct.
(This step actually has cost me half an hour with the IT service, because I failed to authenticate with the proxy multiple times).
Try adding -Djavax.net.ssl.trustStoreType=WINDOWS-ROOT to the maven JVM options so it uses the root certificates from Windows
Related
I am trying to deploy maven artifact to central repository through Travis but I am facing below error:
[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.7:deploy (injected-nexus-deploy) on project Test-plugin: Execution injected-nexus-deploy of goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.7:deploy failed: Nexus connection problem to URL [https://oss.sonatype.org/ ]: 401 - Unauthorized -> [Help 1]
I have set correct username and password for sonatype account, still I am getting the same error.
Below are the files uploaded:
.travis.yml
settings.xml
Looks like your settings.xml in the .m2 folder in your home directory is not having proper authorization properties set for maven to look
I am enclosing a sample XML for your reference ..
https://maven.apache.org/settings.html
<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"> ... <servers>
<server>
<id>server001</id>
<username>my_login</username>
<password>my_password</password>
<privateKey>${user.home}/.ssh/id_dsa</privateKey>
<passphrase>some_passphrase</passphrase>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration></configuration>
</server> </servers> ... </settings>
Here is the troubleshooting guide if you are getting 404
https://support.sonatype.com/hc/en-us/articles/213464518-Troubleshooting-Artifact-Download-Failures
From the docs
SNAPSHOT look-ups, or version ranges, or unversioned dependencies (typically plugins) will trigger metadata look-up. If the version referenced by the maven-metadata.xml is not there you will get a 404.
This can usually be fixed by running rebuild metadata on the affected artifact.
I am trying to fully automate a build and, most importantly, a release using maven in travis-ci. The way I am attempting to do it it to supply the username and password commandline as properties and have them substituted in the settings.xml file. Then, when running the build, I override the location of settings.xml to be a file I checked in. Everything needed to build and release needs to be checked into the repo. It doesn't look like maven is doing the property substitution though.
Example:
settings.xml
<?xml version='1.0' encoding='UTF-8'?>
<settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'
xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<servers>
<server>
<id>sonatype-nexus-snapshots</id>
<username>${SONATYPE_USERNAME}</username>
<password>${SONATYPE_PASSWORD}</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>${SONATYPE_USERNAME}</username>
<password>${SONATYPE_PASSWORD}</password>
</server>
</servers>
</settings>
build command:
mvn --settings $PWD/settings.xml -e -X -B release:prepare release:perform "-DSONATYPE_USERNAME=YYIaF/A4" "-DSONATYPE_PASSWORD=kowLPBgK+/kRiC+O96YZT1ibvxrdcKc" -Dgpg.passphrase=passphrase
These are not the actual credentials but I included the fact they have some funky characters incase that matters.
error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project foo-parent: Failed to deploy artifacts: Could not transfer artifact com.baz:foo-parent:pom:3.0.3 from/to sonatype-nexus-staging (https://oss.sonatype.org/service/local/staging/deploy/maven2/): Failed to transfer file: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/baz/foo-parent/3.0.3/foo-3.0.3.pom. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
but if I do this the official way (.m2/settings.xml) - all is good.
Since the objective is to fully automate a release from travis-ci, if there is just a direct way to do that, I am all ears.
I am unable to build the project using Apache-maven 3.2.2 and As i am new to the maven i am not able to find the issue. Please provide some solutions to resolve it.
And the error as follows:
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR] Unresolveable build extension: Plugin
org.apache.maven.wagon:wagon-ftp:1.0-beta-2 or one of its dependencies could
not be resolved: Failed to read artifact descriptor for
org.apache.maven.wagon:wagon-ftp:jar:1.0-beta-2: Could not transfer artifact
org.apache.maven.wagon:wagon-ftp:pom:1.0-beta-2 from/to central
(http://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host
repo.maven.apache.org -> [Help 2]
and my maven version as follows:
C:\Users\xyz>mvn -version
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T19:21:42+05:30)
Maven home: D:\software\Maven\apache-maven-3.2.2-bin\apache-maven-3.2.2
Java version: 1.7.0_01, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jdk1.7.0_01\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows nt (unknown)", version: "6.2", arch: "x86", family: "windows"
The problem is with your maven path , you have to give bin as your maven path
In your pom.xml, try to find this dependency.
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0-beta-2</version>
</dependency>
and you can change it with the following artifact;
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>2.10</version>
</dependency>
if it does not work, the problem is with your internet settings, as Tunaki said.
I've searched and searched to no luck resolving this issue. Can someone please advice me on what I can do to resolve this?
running the following command in my working project workspace
mvn compile
Produces the following error.
[ERROR] Failed to execute goal on project acme: Could not resolve
dependencies for
project com.acmecorp.acme:acme:war:GUI 5.0: Failed to collect dependencies at
org.springframework:spring-core:jar:4.0.2.RELEASE: Failed to read artifact descriptor
for org.springframework:spring-core:jar:4.0.2.RELEASE: Could not transfer
artifact org.springframework:spring-core:pom:4.0.2.RELEASE 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 -> [Help 1]
Yes i've checked my proxy in the settings.xml file in the .m2 folder. Here is what it looks like.
<proxies>
<proxy>
<active>true</active>
<protocol>https</protocol>
<username>USER</username>
<password>PASS</password>
<host>proxy.host.com</host>
<port>80</port>
</proxy>
<proxy>
<active>true</active>
<protocol>http</protocol>
<username>USER</username>
<password>PASS</password>
<host>proxy.host.com</host>
<port>80</port>
</proxy>
</proxies>
Any suggestions would be greatly appreciated.
OS Windows 7
You need to get ssl certificate of maven repo server and copy that into your local jre/lib/security folder.
Steps:
1. Download this Java program https://confluence.atlassian.com/download/attachments/180292346/InstallCert.java
Compile
Run with command line parameter maven repo server
Copy the generated ssl to your local JRE/lib/security
For detailed steps pl follow this post:
http://www.mkyong.com/webservices/jax-ws/suncertpathbuilderexception-unable-to-find-valid-certification-path-to-requested-target/
I have installed Maven 3.0.5 on my windows 8 64 bit machine by the following steps:
Downloaded apache-maven-3.0.5.bin.zip and the archive is stored in C:\Program Files\Apache Software Foundation. I changed the environment variables as follows:
M2_HOME with value C:\Program Files\Apache Software Foundation\apache-maven-3.0.5
M2 with value %M2_HOME%\bin
JAVE_HOME with value C:\Program Files\Java\jdk1.8.0_25
PATH with value %M2%;%JAVA_HOME%\bin
after this when i type mvn --version i get
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 19:21:
28+0530)
Maven home: C:\Program Files\Apache Software Foundation\apache-maven-3.0.5
Java version: 1.8.0_25, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_25\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 8", version: "6.2", arch: "amd64", family: "dos"
I have downloaded JDK and JRE in the folders under
C:\Program Files\Java\jdk1.8.0_25
C:\Program Files\Java\jre1.8.0_25
Now for Karma to install I downloaded the Web-Karma-Master zip and the archive is placed under
C:\Program Files\Web-Karma-master\Web-Karma-master
Now when I type mvn clean install in this directory I get the following:
..
...
...
[INFO] karma-mr .......................................... SKIPPED
[INFO] karma-storm ....................................... SKIPPED
[INFO] karma-web-services ................................ SKIPPED
[INFO] web-services-rdf .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24.285s
[INFO] Finished at: Wed Oct 29 13:21:14 IST 2014
[INFO] Final Memory: 8M/109M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.codehaus.mojo:exec-maven-plugin:1.1
or one of its dependencie s could not be resolved: Failed
to read artifact descriptor for org.codehaus.mojo:
exec-maven-plugin:jar:1.1: Could not transfer artifact
org.codehaus.mojo:exec-maven-plugin:pom:1.1 from/to central
Connection to http://repo.maven.apache.org refused:
Connection timed out: connect -> [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/PluginResolutionException.
Please help. I have done all the above in the same order as mentioned. But I am not able to resolve this problem.
Archana.
Create a file settings.xml in .m2 folder of your HOME directory. Add the following:
<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
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<proxies>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>your.org</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>*.your.org</nonProxyHosts>
</proxy>
</proxies>
</settings>
Remove <username> and <password> tags if your proxy server does not need authentication.
You can look for the values for these in your browser settings.
Also refer to proxies section of maven settings reference.