Sonatype Nexus cannot proxy jcenter.bintray.com - maven

I use sonatype nexus for maven repository proxing.
Our project need to use http://jcenter.bintray.com/ repository.
But if I add jcenter as a proxy to our nexus server, it does not work properly.
it seems a folder includes parent folder structures recursivly. something like the following.
a
b
c
a
b
c
a
b
c
....
Is this possible to proxy jcenter with sonatype nexus?

Have you tried pulling in artifacts through the JCenter remote proxy?
This should work as JCenter is a standard maven repository that's heavily used by all maven clients/repository managers. The issue may only be with the remote repository browsing in the Nexus UI.

As previously mentioned, pulling artifacts worked for me.
As proxy repo I used https://jcenter.bintray.com/
Browsing the repo is not possible, but gradle with the configured nexus successfully pulled out everything necessary.

Related

Nexus repo not accessible through proxy in maven settings

I have a maven project.
when I build using cmd prompt- It downloads the maven repos, only when the proxy is configured in settings.xml file.
But this proxy is blocking the nexus repos. I do have two nexus repos required for this project. and I get build error -- return code:503 reason phrase: service unavailable for nexus repo contents
If I follow the stack overflow answer Nexus Repo gives 503 with Maven but not with browser
and added proxy to nexus instance and mirrored the nexus in my settings file. Still maven repo works and nexus repos or not accessible.
my settings.xml
Any help would be appreciated.
Thanks in advance

Replicate nexus repository in my local server

I work in an organisation and we use nexus repositories. I want a simple approach of how can I replicate few groups from nexus repository in to local server so that maven downloads the dependencies from local server and not from nexus.
If you use local server in the sense of base machine then you use clean install as a maven goal. The build code will be available under .m2/repository folder.
Install Nexus locally, create Proxy Repository for each of the repo or group that you want to have locally. In Proxy Repository you'd need to set up URLs to the remote repos.
Now point Maven to this local Nexus (e.g. with <mirrors> in settings.xml). First time Maven downloads a dependency it will go to Local Nexus which would grab the dependency from the remote one. This file is going to be cached in Local Nexus and further downloads won't hit the Remote Nexus.
PS: don't know why you would do this.

Automatically download missing artifacts if missing in Artifactory

I'm using Jfrog Artifactory to contain artifacts. I'm building with Maven. Is there a way to configure Maven to automatically download missing artifacts, artifacts that are not in the Artifactory repo.
Example:
org.maven.framework-2.5.0 is downloaded from Artifactory since it exists in the Artifactory.
org.maven.anotherframework-2.2.2 doesn't exists in Artifacotry. How to set maven to get from internet?
Is it common to use Artifactory this way?
You should configure Artifactory to fetch missing artifacts from the Internet, not Maven.
Artifactory can (and should) be used as a proxy:
It already comes with set a pre-configured popular remote repositories and you can add new ones.
So, if Maven fails on unresolved dependency, find a repository that has it, add it to Artifactory as remote repository, retry the build. If you can't find any repository that has it, you can upload the jar directly to Artifactory and retry the build.

maven could not resolve dependency via my local nexus repository

I have setup an in-house Sonatype Nexus repository and configure the maven to check my local Nexus instead of getting artifacts directly from public repositories.
http://www.sonatype.com/books/nexus-book/reference/config-sect-intro.html
Our project was able to download the most artifacts except one artifact in Maven central.
Here is the build error:
Failed to execute goal on project shindig-gadgets: Could not resolve dependencies for project org.apache.shindig:shindig-gadgets:jar:3.0.0-SNAPSHOT: Could not find artifact com.ibm.icu:icu4j:jar:4.6 in nexus (http://my_nexus_repository:8081/nexus/content/groups/public) -> [Help 1]
I see that icu4j-4.6.jar does exist in the Maven central repository. On my local nexus repository, it doesn't exist. I see only icu4j-4.6.pom exists on my local nexus repository.
It's not like my nexus repository setting is totally broken. maven project has successfully downloaded numerous jar files from multiple public repositories via my local nexus maven repository except icu4j-4.6.jar.
I don't understand why I'm having a problem with only icu4j-4.6.jar. Would it be incorrectly cached on either my local maven or nexus maven repository?
If it was incorrectly cached, how can I clean the local maven or nexus maven repository?
The similar problem is described at
Missing maven dependency using nexus setup
icu4j-4.6.jar does not show up in the search list. Only icu4j-4.6.pom shows up in the search list. I don't think is Snapshot VS Release issue because icu4j-4.6.jar seems release jar.
Is it possible that the nexus repo just stopped responding for a while? You can try mvn -X (or -d?) to get detailed info about what is going on. You might also try configuring an alternative repo.
Perhaps you haven't enabled remote index downloads from Maven Central. This would explain why only the POM file appears in your local search (The only file which has been downloaded via the proxy repo).
There might be another issue causing the download failure for the jar itself.... I suppose try and solve one problem at a time :-)
Try adding -U to your mvn arguments to force an update of your local repository.
You could also have corrupt meta data in the repo. In which case, delete that artifact from the repo's cache and let it refresh.
If the artifact in question was cached in properly from the proxy repository, using mvn -U will fix the problem
However if you are seeing pom on your nexus ,this usually happens when the artifact from the proxy repository is not cached in properly. The way to fix is
1) Browse to the component in the Proxy Repository.
2) Invalidate the cache for the repository and reindex the Nexus repository.
3) run mvn clean -U

Why does Nexus repository doesn't download the required artifacts when using a group repository?

I use Nexus repository manager and configured the default .../nexus/content/groups/public/ repository and added maven central, codehaus snapshot and an internal respository that I created and have uploaded few artifacts to that.
Then added .../nexus/content/groups/public to mirror in settings.xml. When I do a maven build, maven looks in .../nexus/content/groups/public but does not update org.apache.maven.plugins:maven-site-plugin:pom:2.0-beta-6 and reports that it is not found.
But if I remove the mirror from settings.xml, then it looks in http://repo1.maven.org/maven2/ and it picks up all the artifacts correctly.
I have also changed publish url to true. What do I miss?
If you added the repositories as proxy repositories in Nexus do not forget to add the proxies to the Repository Group which you use as mirror for all Nexus requests (public/snapshot) - assumed you have this kind of configuration.

Resources