Can't download jar files using maven - maven

I've been using Maven for few years now, installing it on different machines and OS's and never had problem with it. Ten days ago i installed in on new Windows 7 machine and since than
i can't find the reason why it can't download jar file's from remote repo's.
I am able to download jar file by typing URL in browser but when i run mvn install in console it start to download the jar, wait some time and then i am getting error message:
"...Could not transfer artifact org.primefaces:primefaces:jar:5.0 from/to central (http://repo.maven.apache.org/maven2):
GET request of: org/primefaces/primefaces/5.0/primefaces-5.0.jar from central failed:
Read timed out ... java.net.SocketTimeoutException: Read timed out".
I read all articles here, tried everything but without success.
Can anyone help?

Primefaces artefacts are not in Maven Central. You need to setup a supplemental repository to get those artifacts. I would suggest to start using a repository manager.

Related

I have a problem with Maven 3.8.4 that not allowed to authorize our private repo on Apache Archiva

I have installed Maven 3.8.4 with homebrew on Macbook M1 CPU recently and I have ~/.m2/settings.xml properly containing the Apache Archiva user name and password.
when I executed mvn help:effective-settings -DshowPasswords=true command I can see the correct xml content. But when I run mvn clean package I get something like that
Failed to read artifact descriptor for company.webshop:webshop-common:jar:21.11.12:
Could not transfer artifact company.webshop:webshop-common:pom:21.11.12
from/to company (https://repo.company.com/repository/internal/):
authorization failed for https://repo.company.com/repository/internal/company/webshop/webshop-
common/21.11.12/webshop-common-21.11.12.pom,
status: 403 Forbidden -> [Help 1]
when I try to access https://repo.company.com/repository/internal/ address from my browser I can login and see the artifacts properly as well. More than that other team members don't live any problem.
I also removed maven and reinstalled but nothing changed.
any idea?
I noticed that after removing the folders (under the .m2 folder) related to our private repo, and re-run the maven after a fresh instalment it's working properly.
Maven was not downloading the artifacts I guess, since there is a folder of that version number and only showing the content of old files which says something like "not authorized to the repo." and was miss leading

Maven 2 works but Maven 3 gives authentication error with same settings and server

I'm setting up a new archiva server and a new project. Right now I have a very simple pom and nothing really that interesting on the server.
When I 'mvn compile -U' using maven2 from the command line I'm able to access my archiva server and download a plugin as part of the build. However, when I switch to maven3 (same settings.xml) I get an error when I 'mvn compile -U':
Plugin org.codehaus.mojo:exec-maven-plugin:1.4.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:exec-maven-plugin:jar:1.4.0: Could not transfer artifact org.codehaus.mojo:exec-maven-plugin:pom:1.4.0 from/to central-proxy (http://archiva.myserver.com/repository/internal): Not authorized , ReasonPhrase:Unauthorized.
I don't see anything interesting in the debug info when I build with the '-X' flag, and I don't see anything on the server log files either.
Right now I'm using only the username and password fields in my settings.xml. From the documention, I should be able to just use those fields - privateKey is optional.
Anyone else have problems when switching between maven2 and maven3 with the same settings?
After spending a day or two trying to figure this out, it looked to me as if maven3 was not sending my credentials. So instead of using the username and password fields I embedded my credentials in the urls to my repositories, such as:
<url>http://username:password#archiva.mydomain.com/repository/internal/</url>
This works. I no longer it an unauthorized error from the server.

Maven build error on maven install

I imported a maven project onto my eclipse. I clicked on Run As->Maven Install. But I got the following build error. Please help
plugin org.apache.maven.plugins:maven-jar-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar 2.3.2:Could not transfer artifact org.apache.maven.plugins:maven-jar-plugin:pom: 2.3.2 from/to central(http://repo1.maven.org/maven2):Error transferring file: repo1.maven.org: Unknown host repo1.maven.org
I checked /m2/repository. But could not find anything related.
Somehow it is not able to download the required artifacts from the Maven Central repo.
A suggestion please check your network connectivity, are you behind any firewall or try to change your proxysettings.
Otherwise in the worst case try to download required artifacts manually and put them in .m2/repository (as per ur local system) and try to install again.
http://search.maven.org/#browse|672389075
It should work.
Thanks

Maven - unable to download dependencies behind Proxy Error Code - 307 Temporary Redirect

I am using Maven to run a Java project. My issue is that I am not able to download the dependencies. It is giving the following error
[ERROR] Plugin org.apache.maven.plugins:maven-surefire-plugin:2.7.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-surefire-plugin:jar:2.7.1: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from/to central (http://repo1.maven.org/maven2): Failed to transfer http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.7.1/maven-surefire-plugin-2.7.1.pom. Error code 307, Temporary Redirect -> [Help 1]
The settings.xml is properly configured with the proxy details (since I am behind a proxy) Still, I am not able to access the maven repo to download.
UPDATE: Thanks a lot landal79.I revisited this issue after some time. Still this issue gives me a nightmare.
Currently, I am not able to create any Maven Project. I am 100% sure this is due to a proxy issue. But not able to
nail it down to where exactly the issue.
When I try creating a project selecting an archetype, I am not able to create a maven project. I am getting the below error
"Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE from any of the configured repositories.
Could not resolve artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:RELEASE
Failed to resolve version for org.apache.maven.archetypes:maven-archetype-
quickstart:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-quickstart/maven-metadata.xml in local (C:\Users\rrr.m2\repository)
Failed to resolve version for org.apache.maven.archetypes:maven-archetype-quickstart:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-quickstart/maven-metadata.xml in local (C:\Users\rrr.m2\repository)"
I try creating this project through Eclipse. The settings.xml point to the right proxy ( cross checked with the Network connections dialog (window ->General->NetworkConenction Dialog). But the issue still persists.
So what I did was installed standalone Maven and create a maven project from command prompt. To my surprise,I am not able to download the archetypes in Maven Repo though other plugins are getting downloaded (Surefire plugin and JUNit jar for example)
Is there any work around to resolve the archetype download issue?
I tried your solution, but the issue still persists. When I create a simple maven project (without using any archetypes) I am getting "Unable to build Project " Error
PS: The proxy settings are defined in settings.xml and they are correct. Also, the eclipse proxy settings are correct (Since I am able to install plugins from Eclipse MarketPlace)
Eclipse experts - please help me resolve this issue. Thanks a lot in advance for help.
Thanks

Service unavailable error while building using Maven

I am a newbie to Maven.
First time I run the mvn clean install command and it gave me the below error:
[ERROR] Non-resolvable parent POM: Could not transfer artifact
com.sybase365.mobiliser:mobiliser-parent:pom:4.6.0-RC02 from/to repo
(http://orinoco.sybase.com/nexus/content/groups/public-devel): Failed
to transfer file:
http://orinoco.sybase.com/nexus/content/groups/public-devel/com/sybase365/mobiliser/mobiliser-parent/4.6.0-RC02/mobiliser-parent-4.6.0-RC02.pom.
Return code is: 503, ReasonPhrase:Service Temporarily Unavailable. and
'parent.relativePath' points at wrong local POM # line 3, column 11 ->
How do I resolve this error?
Your remote repository is inaccessible. See explanation for error 503 in here.
I think i found the reason it gives 503. In my case this was a proxy issues inspite of excluding hosts that belong to a certain domain.
Remove the proxy from manage jenkins -> manage plugin -> advanced and try again
Could be, also I find this error happens all the time when the repo is available and downloading the file manually from the nexus GUI works. For some reason maven looks in the wrong repository location. If it happens for one jar and its pom you can down load the file by hand.
If maven ever hits a temporary HTTP problem it stores a lastUpdated file that you need to delete or it will not try to download the file again for a while.
sudo updatedb && locate lastUpdated | xargs rm
Or scrabble around in explorer in /Users/username/.m2/repository to find the files if you use windoze
Another thing that can mess with repo access is the proxy that maven uses. Check the contents of ~/.m2/settings.xml or create this file and setup what ever HTTP proxies or lack there of that you need to access the repos you have configured in poms.

Resources