Authentication failes with 401 while intelij maven downloading specific pom from nexus but is opened from url - maven

getting below error while running mvn install on intelij project:
"Could not transfer artifact ... from... public < nexus repository url which define in setting.xml correctly under mirror with correct id configuration and server etc >
Authentication failed for <.pom inside previous url that mentioned > 401 Unauthorized"
I can login to mirror url that provide in settings.xml with the username/pass provided under server definition and access that .pom etc.
any idea what I am missing inside intelij to get it fixed?

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

Handling Artifactory Maven Repository URL reidrect

Via the jfrog artifactory version: 4.14.0 dashboard, when adding a remote maven repository, the repository is browsable at one url but the downloads are on a different url.
Example:
https://nexus.pentaho.org/service/rest/repository/browse/omni/pentaho-library/libfonts/5.0.1-stable/
Download a file from that service DOES NOT resolve to
https://nexus.pentaho.org/service/rest/repository/browse/omni/pentaho-library/libfonts/5.0.1-stable/libfonts-5.0.1-stable.jar
It leads to
https://nexus.pentaho.org/repository/omni/pentaho-library/libfonts/5.0.1-stable/libfonts-5.0.1-stable.jar
Convert:
https://nexus.pentaho.org/service/rest/repository/browse/omni/
to
https://nexus.pentaho.org/repository/omni/
Looked into user plugins such as this
https://github.com/jfrog/artifactory-user-plugins/blob/master/download/modifyNuGetDownload/modifyNuGetDownload.groovy but these change the path after the base url, not the repository url itself
Is there a way to supply a custom repository url for downloading files?

Forbidden (404?) to download yarn artifact using Artifactory and Github

I have an issue with Jfrog Artifactory and Yarn. I'm not able to download an artifact when I run mvn clean install ...
I have added an artifact yarnpkg-releases inside my Artifactory.
It refers to https://github.com/yarnpkg/yarn/releases/download/.
This URL on its own returns a 404. I don't know if this is a problem?
My maven install tries to download https://my-url/artifactory/yarnpkg-releases/v0.28.4/yarn-v0.28.4.tar.gz and it returns a 404:forbidden. (Yes not 404 not found or 403 forbidden).
In my mindset, this URL will resolve to https://github.com/yarnpkg/yarn/releases/download/v0.28.4/yarn-v0.28.4.tar.gz which returns the right tar.gz.
I have a .yarn file in which I configure the URL to my registry and I ignore SSL. What can cause this issue?
Also with a curl (using user:passwd) I got the same error.
I have the same set up for a node artifact. The node artifact points to this URL
When I try curl -uuser:passwd -O "https://my-url/artifactory/nodejs-dist/v0.1.104/node-v0.1.104.tar.gz" it works so I don't understand why this is not working for my yarn artifact.
I think the issue is with your URL.
Actual artifactory is available in the below location
https://codeload.github.com/yarnpkg/yarn/tar.gz/v0.28.3/yarn-0.28.3.tar.gz

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 Github repository + Artifactory

I'm have a artifactory running in a server here, and my settings.xml are configured to use it has a mirror.
But, one dep I use is in a github page, and seems like artifactory doesnt get it, because it throws me "UNABLE TO DOWNLOAD blah..".
I try to add the repo in Artifactory remote repositories, click in test, and it shows me a
Connection failed: Error 403: Forbidden
I am using the correct URL (I think): http://gwtbootstrap.github.com/maven/snapshots
Got any help?
Thanks in advance
I think the URL should be:
https://github.com/gwtbootstrap/maven/tree/gh-pages/snapshots

Resources