I have a nexus repo (v2.1.2) where I deploy osgi bundles created with the maven-bundle-plugin. By default, the nexus index doesn't include packages of type bundle, so if i do a search for a bundle, I only get a reference to the pom, not the bundle (jar).
However, following this entry, I managed to make it work correctly. Here is what I added to /usr/local/sonatype-work/nexus/conf/packaging2extension-mapping.properties
bundle=jar
If after the change I do a rebuild index as suggested in the article, now the index contains the bundles. However, my problem is that when i redeploy a new snapshot of one of the bundles, it disappears from the index. The only way to get it back is by recreating the index one more time. Obviously at this point the whole workflow is unusable: i can't manually recreate the index after every deploy.
Is this a known issue? a bug? a misconfiguration?
Any ideas how to fix it?
I'm using the REST api to do queries so losing the artifacts from the index is pretty bad
It is a bug
There was a ticket opened for it
https://issues.sonatype.org/browse/NEXUS-5525
Related
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.
I had a task to delete old SNAPSHOT artefacts which are under many folders/directories.
We can't go and delete each and every artefact manually so I would like to go with restAPI.
For clear info:
https://artifactory.com/artifactory/maven-local/com/aa/bbb/cccc/dddd/XYZ-SNAPSHOT/abc.jar
https://artifactory.com/artifactory/maven-local/com/aa/bbb/cccc/dddd/XYZ-SNAPSHOT/xyz.jar
https://artifactory.com/artifactory/maven-local/com/aa/bbb/cccc/eeee/XYZ-SNAPSHOT/pqr.jar
https://artifactory.com/artifactory/maven-local/com/aa/bbb/dddd/eeee/XYZ-SNAPSHOT/lmn.jar
Above 4 examples have different directories.
My script needs to go each and every directory and have to verify for XYZ-SNAPSHOT, if it found then we can make a url and delete through CURL.
How can we achieve this? Or is there any other way to do it?
You should probably want to use Artifactory Query Language (AQL) which is the easiest way to find artifacts and modules according to patterns. You can find bunch of examples in the page. Moreover, to perform the deletion easily and even automate the process in the future, I advise using JFrog CLI. You can also read this interesting blog about similar use case.
Also, there is the 'Max Unique Snapshots' field in your local Maven repository settings. You can use that for Artifactory to keep a specified number of unique snapshots per artifact.
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
Nexus index lists pom, zip, test.jar, sources.jar and docs.zip for my snapshot but doesn't list the jar artifact.
Nexus view of storage shows the jar
Maven users pulling deps from this instance regularly down the jar
Is there a way to get it to show in the search and index with a download link or is the default artifact unlisted on purpose (I guess because I should always access it via pom).
You can, it works for me :
I don't see the snapshot jars in the browse index tab, but I see them in browse storage tab, and I can also see them in my web browser, seeing something like this :
https://repository.apache.org/content/groups/snapshots/commons-beanutils/commons-beanutils/1.8.4-SNAPSHOT/
I use :
Sonatype Nexus™ Open Source Edition, Version: 1.9.2
Samuel and I discussed the issue in the other answer. It seems this is working as designed probably due to the transient nature of snapshots.
You can find the snapshot jars (or default artifacts) via the full url and by browsing the storage but they do not show up in the index or the web UI search.
We deploy to Artifactory an artifact that has a [filename] name that gets a time stamp applied to it by Artifactory. Later in a different trunk, its build attempts to download that artifact using the same name under which it got deployed earlier. However, because of the time stamp that Artifactory applied to the file name, this subsequent build fails with a "Unable to download the artifact from any repository" error. Other than turning of Artifactory time stamping, is there a solution to this problem? Our belief was that Artifactory would be smart enough to know at least to return the latest time stamped artifact when requested.
Normally this would be a comment but since I'm lacking the rep for this I do this as answer:
For sure Artifactory should be able to handle this. Why do you think the timestamp is the problem? This is normal for snapshots and f.e. the maven-metadata.xml should indicate which is the last version.
Do you use a version range for the artifact?
its build attempts to download that artifact using the same name under which it got deployed earlier.
Do I get you right: The artifact that you describe to be deployed to Artifactory in its (own) build wants to use itself? Could you post relevant parts of your POM?
I got similar issue recently after I changed repository configuration from storing non-unique snapshots to unique snapshots. (See here)
When both unique snapshot and non-unique snapshot of the same version of an artifact exists, there will be problem to download it.
For example, in a repository if under folder /com/mycompany/test/foo/1.0.0-SNAPSHOT/ there are foo-1.0.0-SNAPSHOT.pom and foo-1.0.0-20130329-231102-1.pom, then downloading com.mycompany.test:foo:1.0.0-SNAPSHOT:pom will get error. You have to delete either the file with SNAPSHOT in name or all the files with time stamp in name.
For my case, my repository switched from storing non-unique snapshots to unique snapshots, so I should delete the *-SNAPSHOT files. I wrote a Ruby script to scan all recent deployed artifacts and try to delete the same version non-unique snapshot (-SNAPSHOT) file if any. It uses Artifactory's REST API. Here is the source: https://gist.github.com/aleung/5260512