Artifactory - Problems with overit-central and This item is not cached - caching

We've been experiencing problems with our overit-central repository on Artifactory. Some elements appear as "not-cached" and while trying to retrieve them from a build, we're encountering an "element not found" error. That same element does exist in the overit-central repo, but somehow our Artifactory instance doesn't seem to find it or cache it. (The problem doesn't happen with all the elements of the repo, and we don't know why. Some of them are actually cached)
We've already run a re-index of said repository but still the "This item is not cached" continues to appear.
We tried creating a new remote repository hooked to the same url and running some maven re-indexes from Artifactory, but it didn't help.
How do we force the caching of the elements from Artifactory? The documentation in the JFrog support page mentions it, but doesn't explain how to do it.
Thank you in advance
Regards

A remote repository in Artifactory is a mirror of the endpoint you have configured. It doesn't download the artifacts by default and this is the reason it says "Artifact is not cached". It is the intended behavior and it lets you know that you have never downloaded this artifact.
In order to cache an artifact, you have to simply download it from the remote endpoint. This can be done in two ways:
From the UI - Right click --> download
Using the API "curl -uUSERNAME:PASSWORD http://ARTIFACTORY_URL:PORT/artifactory/REMOTE_REPOSITORY/PATH_TO_ARTIFACT
Once the artifact is downloaded, it means that it is cached and you will be able to see it in the "name-of-the-remote-repository-cache" repository which shows the downloaded cached artifacts.

Related

Maven returns "401 Unauthorized" when attempting to download Apache SOLRJ artifact

I'm having issues when I build my project using Maven and it attempts to download an artifact from my privately hosted Artifactory repository. I have a large number of artifacts used by my project that are stored in this Artifactory instance. It downloads many of them fine during the build process, but when it gets to the org.apache.solr SOLRJ artifact download, it fails with a "401 Unauthorized" error.
I know my configurations in my Maven project POM file and my local Maven settings file are correct (repo ID matches, username and password entered, etc.) because it successfully downloads the first half of the artifacts referenced in my project and only fails when it gets to the SOLRJ artifact. In addition, when I navigate to the repo in a browser window, I can freely navigate the tree and view other artifacts without providing credentials, but when I try to click on the link for the org.apache.solr folder, it prompts me for credentials and none of my known credentials work, even though I know the username and password are correct. So it seems the issue is isolated to this one artifact.
I have copied the org.apache.solr contents from another local repository to attempt to get it to skip downloading the file, but it is still trying to download even though it would appear the version is correct and matches.
I am confused why, when navigating the repo in the browser, this one folder in the repo would be prompting for authentication when no other artifacts are behaving the same way, and why none of my username/passwords entered (including the administrator username/password) are being recognized and accepted.
Any help is greatly appreciated to either a) point me in the right direction to make that artifact behave like the others and not require a username/password, or b) get my build to recognize that I've already got the files in the local repository so it doesn't need to download them again.

Nexus 3.1.0-04 OSS - no artifacts/assets seen in repository/components

I am playing around with Nexus oss 3.1.0-04 OSS. I created a new maven style repository called test and it is proxying from http://repo1.maven.org/maven2/org/apache/maven; After setting this up, I tried to view the contents of test repository but there is nothing seen. I get a "no component found in repository". Why is this? What is that am missing? If I type the URL http://repo1.maven.org/maven2/org/apache/maven on a browser am able to see all its contents.
By default, the local proxy is empty. The best way to get components in is to build a maven project. Of course, make sure your maven settings are configured to point to Nexus - https://books.sonatype.com/nexus-book/reference3/maven.html#maven-sect-single-group).
I should also add, Nexus 3 provides a task for this: Publish Maven indexes
- Maven indexes can be used to download an index of available components to your repo, allowing users connecting to it to use the index to discover components. The task publishes the index for all or a specific Maven repository, hosted, group or proxy. This task will not populate the Browse UI, we intentionally did this so you only see what components and assets are available locally. More on the task here: https://books.sonatype.com/nexus-book/reference3/admin.html

Adding remote repository in artifactory

I had jcenter repository in my artifactory under remote repositories. Since some of the artifacts were missing such as qpid, I decided to delete jcenter and add it back. When I deleted the jcenter repository and added it back it didn't download any artifacts.
The repository tree structure looks like this
Before removing the jcenter repository it was like this.
Why it is not able to import any artifact? I can see the URL which is associated with it(http://jcenter.bintray.com/) has so many artifacts.
A remote repository in Artifactory serves as a caching proxy. This means that it downloads artifacts from the remote URL and cache them in Artifactory,
When you deleted the JCenter repository from Artifactory you deleted all cached artifacts.
After recreating the repository, your cache is empty. This is why, when browsing jcenter-cache, you see no artifacts. You can use the remote browsing capability in order to see which artifacts are available in the remote URL, but not currently caches
To re-populate the cache, you will need to download artifacts from the remote repository. Usually the best way to do it, is running your builds which are using this repository.
If the problem is that artifacts are not resolved at all from the remote repository, try the following:
Make sure the repository is configured correctly in Artifactory. Use the "Test" button to make sure that the URL is correct and you can reach the remote URL.
Check that your build tool is properly configured to use the repository you configured. One way of checking this, is by monitoring the Artifactory request log looking for requests from your build tool.
Deleting a repository is not a good practice when you are missing some dependencies. A better approach would be checking if they are available in the remote URL and downloading them into the cache. Artifactory has the option to perform a remote search in Bintray which can help you when looking for artifacts in JCenter.

Apache Archiva not caching?

I've just set up Archiva and I'm testing it. I'm trying to get mysql-connector-java and I'm expecting it to not find it in the internal repository, download it from the central repository and then cache it.
When I check <archiva>/data/repositories/internal, however, it's empty. Also Browse in the admin pages is empty and Search won't return anything.
I'm assuming this means that it's not storing the artifact and that it will get it from the central repo again next time. I'm also assuming I'm not getting something so some help would be great.
My bad - I was using the wrong URL for the repository. I had http://myrepo:8080/archiva and it needed http://myrepo:8080/archiva/repository/internal so it was going to central repo directly. Works fine now.

Nexus - proxy repositories with no indexes?

I'm trying to add a proxy to a public repository (specifically camel-extra). However, I get the following error in my Nexus logs:
Cannot fetch remote index for repository camel-extra
and then further down:
The remoteURL we requested does not exists on remote server (remoteUrl="http://camel-extra.googlecode.com/svn/maven2/releases/.index/nexus-maven-repository-index.properties")
I've ensured that 'Download Remote Indexes' is 'True', repaired the index, updated the index, all to no avail. Browsing to the provided URL shows that the artifacts are there.
So if a repository doesn't have this file, is it not proxy-able through Nexus?
TIA,
Roy
UPDATE
Thanks for the answers everyone - was able to pull the artifacts without the index. Thanks again!
Repositories without indexes published will be still proxy-able thru Nexus (or any other MRM). Index is only a "topping" providing useful extras like searching the whole remote content, etc.
The index does not participate in proxy-ing at all, hence the lack of it on remote does not affect main functionality of Nexus at all: to proxy artifacts from remote repository.
From the nexus documentation, it appears that downloading an index is configurable.
The default for new proxy repositories
is enabled, but all of the default
repositories included in Nexus have
this option disabled.
You should disable the Downloading of Remote Index.
Yes, it is proxyable. Just try to download an artifact which is hosted in that repository. The indexes only affect searching and the index published in turn by Nexus.

Resources