How to retrieve from Maven repositories that require access credentials? - maven

I need to retrieve data from Maven repositories, that require access credentials. I know these access credentials.
The company possessing these repositories suggests to set up a corporate Maven repository and then proxy their repositories. This sounds somehow complicated for me.
Can I set up retrieval without modifying the corporate Maven directory, just from my local using known access credentials?

Did you try to define these repos in your settings.xml?
You define these repos as "servers". There, you can define the credentials for these servers as well...

Related

Setting up proxy in Nexus Repo Manager for Github hosted Maven Repo

I am working on adding a proxy for Github Hosted maven repo. I have created the proxy and gave the remote storage url value as github url.
Anyone aware of how we can set up credentials for Nexus repo manager to talk to Github Repo. I am new to this stuff, so any help would be highly appreciated. I am guessing we might need to setup some generic user in github and created authentication token and use those for nexus to talk to Github?
Thanks in advance.

Maven Nexus V3 wont work with artifactory as a remote repo. How can I get around this issue?

So I currently am trying to get artifacts from repo.osegeo.org, which is a Nexus V3. I am having issues getting the artifacts to populate into my virtual repo that i created which holds the remote osegeo repo, libs release, libs snapshot and also my local repos. I have tried following the work around that is stated in this link below:
https://community.sonatype.com/t/maven-nexus-v3-remote-repository-integration-with-artifactory/2149
But I still have trouble actually getting the artifacts in my repo. Any ideas on what to do?
I suggest checking the following:
Connectivity - Is Artifactory able to reach the Nexus repository and vice versa?
The URL which is configured and if it is configured correctly.
Enable Bypass HEAD requests on the remote repository - Nexus can block HEAD requests and by default, Artifactory will create HEAD requests first before the GET requests to check if the artifact exists before attempting to resolve it.
If the Nexus repository requires authentication - Do not forget to put username and password under the advanced tab.
If there is also a reverse proxy in front of Nexus, you can try to bypass it and check if this works, if it does, the problem is probably the RP.
Check if the Maven client is configured correctly to work against the virtual repository (You didn't mention if you are able to publish or fetch from the local repository).

Set up offline maven repository for Jenkins, while 3rd party atrifacts cannot be reached

I work with an external company on a large project with hundreds of their own artifacts and plugins. Every developer can download them from remote repository only with per-user personal VPN.
I want to set up an intranet Nexus repository that mirrors remote repository for use with Jenkins. Problem is that there is no chance to have a VPN account for Nexus (neither Jenkins). So while every developer has these artifacts in a local repository, we need to manually update Jenkins' m2 repostiory, which is troublesome.
We've came to few ideas, bot none of these sound great:
Manually rsync my local repository to Jenkins' local repository
Mount Jenkins' local repository with sshfs to my .m2/repository so it gets updated on builds I do (so I don't have a real local repository on my disk, it's mounted)
Set up Nexus, create a user nexus on my machine and let him use my VPN connection as a proxy to remote repository (it creates a loop: my maven - Nexus - my VPN - remote)
How would you recommend to set up Nexus for Jenkins in that situation?
Ultimately you would save the external company a lot of traffic and money if you can proxy their Nexus repo with your own Nexus repo. This should provide enough reasons to set up a VPN user for Nexus. It can be very limited and have only access to the Nexus instance there and even be secured with a specific account in Nexus as well.
Every other workaround will ultimately be a hack. Worst case I would set up Nexus in your company and get it to access the external network with your user account, but a reasonable organization would understand the benefits of setting this up properly.
And if you are both using Nexus Professional you could use Smart Proxy for even better trusted connections and immediate updates of available components.

What are the best practices for creating a Nexus private repository group for proxy repositories requiring authentication

One of the Maven repositories I want to proxy through my Nexus repository is private, i.e., it requires a username/password for access. So, I set up a proxy repository the usual way and entered my credentials under the authentication settings. So far, so good.
Now, normally I would add the new repository to the public repository group. But, as I understand it, this will allow anyone with access to my repository to access this private repository through mine, without authentication. Is this correct?
Can I solve this issue by creating a private repository group containing the new repository? I would then have to make a new repository target privilege in order to restrict access to the new private group, right?
I think the next step would be to create a new <profile> and <repository> in my settings.xml, as well as a corresponding <mirror>. And, finally, I'll need to exclude the new repository URL pattern from my default <mirror> (e.g., <mirrorOf>*,!thirdparty,!private</mirror>).
Am I on the right track? Making this harder than it needs to be? Or missing something?
Your suspicion is correct if you do not restrict access to the proxy repository you set up and added to the public group.
However if you restrict access to the proxy repo with username and password its artifacts will be available in the public group. But only to users that connect to it with credentials that have sufficient access to your proxy repository. The public group aggregates not just the content but also takes the security settings of the repositories it aggregates into account.
If you follow that approach all you need to do is have your users that should be allowed to access the proxy repo content connect to Nexus with credentials you give out and control access to. Anonymous users will not have access to the artifacts when connecting to the public group as anonymous.
Your approach would work too but it is a lot more work for all the users since you control it outside of Nexus rather than right there..

Free artifactory or nexus service url without password, for using in intellij idea

Intelliji Idea shiped with 3 free online repository in settings -> maven -> artifactory or nexus service url
http://oss.sonatype.org/service/local/
http://repo.jfrog.org/artifactory/api/
https://repository.jboss.org/nexus/service/local/
all this repos are unavialable (404 error or password protected).
Can you give more free artifactory or nexus service url without password protect?
IDEA has no settings for password on repo URL.
The service URLs are used for attaching remote libraries to a module by running class search queries using the REST APIs available at those URLs and downloading the found librarie from the remote Artifactory.
The REST URLs aren't meant to be directly browsable.
Maybe this explains it better: http://blogs.jetbrains.com/idea/2010/08/getting-external-libraries-easily/
IDEA uses the REST services to get listings of all the repositories available on each host. All three work for me on my machine which is on a network without an HTTP proxy. Is it possible you are on a network with a proxy?
Those urls appear to be pointed at the REST resources of each system, they aren't repositories, not sure what the intellij guys were attempting to do.
If you need a repo to host your own stuff in for free, see here: http://nexus.sonatype.org/oss-repository-hosting.html
If you are trying to access the repositories on Nexus, then you can find them by browsing http://oss.sonatype.org or https://repository.jboss.org/nexus/
Sonatype's service URL now only supports https, so if you're not finding expected artifacts, try updating your Intellij Idea Maven > Repositories setting to https://oss.sonatype.org/service/local/

Resources