Cannot access repo.spring.io - Getting unauthorized - spring-io

I'm working on a gradle based spring boot project which downloads some dependencies from 'repo.spring.io'. The application used to work fine a while back but now I'm seeing an error in the download dependencies stage.
When the application goes on to download https://repo.spring.io/libs-milestone/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar, I receive an error with HTTP response code 401(Unauthorized).
I'm not sure if there has been some recent change at repo.spring.io end as this used to work on my application before without any issues.
This is the exact error that I get for reference --
What went wrong:
19:44:19 A problem occurred configuring project ':account_settings-service'.
19:44:19 > Could not resolve all files for configuration ':account_settings-service:classpath'.
19:44:19 > Could not download commons-logging.jar (commons-logging:commons-logging:1.1.3)
19:44:19 > Could not get resource 'https://repo.spring.io/libs-milestone/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar'.
19:44:19 > Could not HEAD 'https://repo.spring.io/libs-milestone/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar'. Received status code 401 from server: Unauthorized
Kindly help if anyone has any idea about this or has observed a similar issue.
Thanks in Advance!

As per this answer to this question, the Spring team are putting the kibbosh on freeloaders using their repository as a public distribution channel.
It looks like you'll need to adjust your {build thingy} so that it does not attempt to download from https://repo.spring.io/libs-milestone/
In the case of commons-logging:commons-logging:1.1.3 being an Apache project, 'Maven Central' (aka https://repo.maven.apache.org/maven2/, being an Apache repository) hosts https://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.1.3/ without restrictions.

moving to spring-boot it required a pluginRepositories entry with spring-releases repo in the pom, to get the plugin, but then hit this same 401 error.
Adding maven-central pluginRepository fixed it.
final entry in pom is:
<pluginRepositories>
<pluginRepository>
<id>mavencentral</id>
<url>https://repo.maven.apache.org/maven2</url>
</pluginRepository>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>

Related

OSE v3 connection timeout to maven repo while building maven project

we are getting connection timeout error while building maven project.some can please help us on this issue.same project is working on osev2.
When you had this kind of problems, check out which repositories contains the requested artifact. In this case as you can see in the link below, 3 repositories contains it. Add one of to your repositories/pluginRepositories section of your pom.xml.
Since this is a plugin you should add it as plugin repository.
<pluginRepositories>
....
<pluginRepository>
<id>central</id>
<name>maven central</name>
<url>http://central.maven.org/maven2/</url>
</pluginRepository>
</pluginRepositories>
Also 2.5 is a fairly old version, there is a newer 3.0.2 version (I would recommend changing it to this).
https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5

No versions could be resolved for groupid.artifactid

I'm having an error while listing the Mavaen Repository Artifacts in my Jenkins server configuration. Error is given below.
No versions could be resolved for groupid.artifactid rtis.rtis_2.11
But my Nexus server contains the available rtis versions correctly. My point is how I can retrieve those versions available in Nexus server to my Jenkins server?
Available versions in Nexus server
Any help would be greatly appreciated.
Thank You.
As I figured out, automatically upadating mavan-metadata.xml file is the solution. In order to update the file, create a task sheduler for rebuild metadata with a cron job.
Go to Administration -> Scheduled Tasks in Nexus Repo. For more info, please refer to the image given below.
Jenkins is not finding nexus repository to resolve the artifact.
Verify these settings are correct in Maven POM:
<repositories>
<repository>
<id>project</id>
<url>https://yourreposerver/nexus/content/groups/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>project</id>
<url>https://yourreposerver/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
Also, Jenkins plugin help page, will give you more information on what kind of settings you might be missing while setting up your job.
You have to specify the type in the dependency to be downloaded. By default in Maven it is 'jar'. However in your case it it 'tgz' so you have to specify that provided that is possible in the Jenkins user interface. I can not see that option but it should be there.
The other potential problem is that is was flagged as not found in the local repository Jenkins is using. Then you would have to either delete the metadata or force an update of it. On the Maven commandline this would be done with -U however in your UI I am not sure.

Maven and Spring Boot - non resolvable parent pom - repo.spring.io (Unknown host)

I am trying to build my project but I get this:
Non-resolvable parent POM: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.3.0.M3 from/to spring-snapshots (http://repo.spring.io/snapshot): repo.spring.io and 'parent.relativePath' points at no local POM # line 16, column 10: Unknown host repo.spring.io -> [Help 2]
Here is how I specify the parent of my pom.xml:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.M3</version>
<relativePath></relativePath>
</parent>
The is empty so that it forces maven to look for the parent in the remote repository. However, it says that repo.spring.io is an unknown host.
Here is how I define the repositories in my pom.xml:
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
Any ideas?
Obviously it's a problem with your internet connection. Check, if you can reach http://repo.spring.io with your browser. If yes, check if you need to configure a proxy server. If no, you should contact your internet provider.
Here is the documentation, how you configure a proxy server for Maven: https://maven.apache.org/guides/mini/guide-proxies.html
For anyone stumbling upon this question, I'll post the solution to a similar problem (same error message except for the uknown host part).
Since January 15, 2020 maven central no longer supports HTTP, in favour of HTTPS.
Consequently, spring repositories switched to HTTPS as well
The solution is therefore to change the urls from http://repo.spring.io/milestone to https://repo.spring.io/milestone.
The issue is with your project which is not able to complete maven build.
Steps to follow :
Right Click Application and RunAs maven install.
If you get any error while reaching the repos online try giving the proxies in settings.xml under your .m2 directory.Check this link for setting proxies for maven build.
Once done , try doing a Update Project by Right Click Project , Maven->Update Maven Project and select codebase and do check the Force Update of Snapshot/Release check box.
This will update your maven build and will surely remove your errors with pom.xml
Project->maven->Update Project->tick all checkboxes expect offline and error is solved soon.
Rigth button on your project -> Maven -> Update
In my case the problem was with the java version mismatch of pom.xml (java 1.8) and environment variables JAVA_HOME/JDK_HOME (java 1.7). After pointing environment variables JAVA_HOME & JDK_HOME to Java 1.8, the issue got resolved.
If all above stuffs not works. try this.
If you are using IntelliJ. Check below setting:
May be ~/.m2/settings.xml is restricting to connect to internet.
If you're using docker-machine (docker on Windows or OSX).
Currently docker-machine has a bug that it loses internet connection if you switch between wifi networks or wifi and cable.
Make sure you restart your docker-machine
usually: docker-machine restart default
Just a remind: I tried to work with idea and imported maven, and encountered the same problem, I have tried all the solutions and they didnt work. Finally, I found out it was because of the root access... I opened idea with administrator access and all things work just fine, hope you not as silly as i am...
This worked for me!
Try navigating to the Maven tab and then click on install.
After finishing, again try to resolve dependencies.
If you are using docker service and you have switched to other network. You need to restart docker service.
service docker restart
This solved my problem in docker.
Just right click on pom.xml > maven > update maven project > check the force update of Snapshots/Releases
After the error "Non-resolvable parent POM: Could not transfer artifact etc.",
I found out that I indeed had to configure a proxy server.
However, in spite of restarts etc., the error only disappeared after doing:
mvn dependency:purge-local-repository
Guess this has to do with re-resolving dependencies:
Apache documentation about purging local repository dependencies
I was facing the same issue. The reason was the Internet connection. It was resolved when I changed ISP.
Downgrade your version
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version><change this version></version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
Build and undo the version, Build.
2.1.6.RELEASE to 1.3.3.RELEASE Build
Undo
1.3.3 to 2.1.6 Build (in my case problem solved)
It helped us.
As people already mentioned, it could be internet problems or proxy configuration.
I found this question when I was searching about the same problem. In my case, it was proxy configuration.Answers posted here didn't solve my issue, because every link suggest a configuration that shows the username and passoword and I can't use it.
I was searching about it elsewere and I found a configuration to be made on settings.xml, I needed to make some changes. Here is the final code:
<profiles>
<profile>
<id>MavenRepository</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>MavenRepository</activeProfile>
</activeProfiles>
I hope be useful.
In the pom.xml (after loading effective pom.xml in eclipse), you may see it "http://repo.maven.apache.org/maven2" under central repository instead of "https://repo.maven.apache.org/maven2". Fix it

Apache Archiva 2.2.0 Network Proxy does not appear to be working

I have been trying to set up an Enterprise repository for our company using Archiva. While the installation was quite simple, I am now stuck at issue where the Archiva could not reach out to the Central Repository via our corporate proxy.
I did the following to setup the Proxy (Screen shots below)
Added a Network Proxy via the Apache UI.
Updated the ProxyConnector.
Updated the configuration for Central repository
I still see the Remote Check fails.
Any insights?
I did double check the Proxy configuration and also used the same configuration with nexus SonaType and it works fine there.
I also made sure the NetworkProxy is in the archiva.xml file.
Updated: 06/16/2015
I updated the configuration to use https://repo.maven.apache.org/maven2 and also tried to use https and https for our network proxy.
Another thing I've noticed is that the Proxy Connector settings show "Network proxy : None" even though it is configured. (screen shots below)
Apache Archiva 2.2.1 release IMHO has various bugs/issues regarding the UI. Check /conf/archiva.xml if the settings presented by the UI resemble/match the settings in that config file.
I encountered that the Web-Interface does not show any warnings/errors, but still the config is not updated.
Furthermore the UI shows wrong values for correctly configured settings. The popup "Proxy connector settings" is one example. It will always show "Network Proxy: none", even if one is correctly configured. Vote for the bug --> https://issues.apache.org/jira/browse/MRM-1920
ensure you configure network proxy protocol to http or https.
You must also use https://repo.maven.apache.org/maven2 (note the https)
I've had the same problem and installed 2.2.1-SNAPSHOT.
Although the visual bug still seems to be there (clicking the button in Proxy Connectors shows Network proxy: none) the proxy is being used and the repository is working fine.
I have managed to have it working by including this XML in the POM:
<distributionManagement>
<repository>
<id>internal</id>
<url>http://localhost:8080/archiva/repository/internal/</url>
</repository>
</distributionManagement>
<repositories>
<repository>
<id>internal</id>
<name>Archiva Managed Internal Repository</name>
<url>http://localhost:8080/archiva/repository/internal</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

Deploying Java Application to Heroku Results in jackson-mapper-asl Maven Error

The exact maven error message when deploying to heroku is:
No versions available for org.codehaus.jackson:jackson-mapper-asl:jar:[1.9,1.9.9] within specified range
I believe the issue is related to this answer and this Jackson repository maven-metadata.xml bug.
The following entry in the maven deploy log indicates that jackson-mapper-asl 1.9.9 is being downloaded from a heroku maven repository:
Downloaded: http://s3pository.heroku.com/jvm/org/codehaus/jackson/jackson-mapper-asl/1.9.9/jackson-mapper-asl-1.9.9.pom (2 KB at 12.3 KB/sec)
The heroku versions of the jackson maven-metadata.xml files are using incorrect version numbers - causing the maven error when using version ranges.
Is there a way, at deployment, to tell heroku to use a different maven repository for this dependency? Better yet, is there a way to get the heroku jackson-mapper-asl maven-metadata.xml file fixed?
Could this suffice as a workaround? You could just take the repository configuration section and point to somewhere else or supplying the file yourself as you would do with custom items.
Anyway, you can do it. Defining a regular repository in pom.xml, here the central one:
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
Defining a repository in pom.xml that is pointing to a local "repo" item, which exists only within the application deployment:
<repositories>
<!--other repositories if any-->
<repository>
<id>project.local</id>
<name>project</name>
<url>file:${project.basedir}/repo</url>
</repository>
</repositories>
You should contact Heroku support about this in any case.
Follow Up I contacted Heroku support (super helpful, BTW) and they discovered the Heroku Maven cache was invalid for more than just Jackson. Heroku support kicked off an update process that helped resolve the problem but did not fix it completely. To get this issue completely resolved I had to add an explicit dependency to jackson-mapper-asl 1.9.9 in my pom.xml before I could deploy my app to Heroku.

Resources