After maven deploy snapshot to nexus get 404 not exists - maven

I use mvn deploy:deploy-file to publish snapshots to nexus.
The snapshot is created with timestamp in the following format xxxx-1.0.0.0-20171206.163242.jar
In addition the maven-metadata.xml file is updated with the name of the last snapshot.
Sometimes there is a race condition between the timestamp of the file name in the metadata and the real file name.
for example the file name is xxxx-1.0.0.0-20171206.163242.jar and in metadata it would be xxxx-1.0.0.0-20171206.163241.jar
I tried to use -DuniqueVersion=false in order to remove the timestamp but it seems that it does nothing and the filenames still contain timestamp
Any idea how to solve this issue?

Related

Artifactory retrieve latest and ignore maven-metadata.xml

I'm trying to retrieve the latest version of a artifact from artifactory, but there is a file "maven-metadata.xml" in the target directory that is always being returned.
Is there a way for the request to exclude the file? My current request looks as follows:
"https://artifactory/api/storage/pathtodirectory?lastModified"
This returns the maven-metadata.xml file, I tried modifying the request to:
"https://artifactory/api/storage/pathtodirectory?lastModified?archiveType!=xml"
But that didn't exclude the file.
You have the option of retrieving the latest artifact which was modified, while also excluding patterns of files, using JFrog CLI.
Here's how you do it:
jfrog rt s repo-name/path/to/directory/ --sort-by modified --sort-order desc --limit 1 --exclusions "*maven-metadata.xml"
Notice that the source path argument ends with a slash (...directory/), to indicate that yuo wish to retrieve the content of the directory folder in Artifactory.
You can modify the source path argument and also the value of the --exclusions option to include wildcards, and also change the value of the --limit option to return the X last modified artifacts.
Once you're satisfied with the output, and you want to download the artifact, simply replace jfrog rt s with jfrog rt dl.

Nexus generates wrong checksum of pom

I use Nexus 2.14.0-01 and have the following problem:
The checksums that are computed by Nexus are different from the checksum that one gets on the command line (for the pom file). Deleting checksum files and recreating them by "Rebuild metadata" creates the same checksum files as before (with the apparently wrong checksum). Even manipulating the pom and then creating the checksum files always recreates the same wrong number.
Does Nexus have a cache for that that I need to empty? How can I convince Nexus to create correct checksum files?

Whan can maven-metadata.xml tell about the time of an upload in Artifactory

In artifactory we have some local repo's.
One of the repo's contains a lot of subfolders.
Each subfolder contains a maven-metadata.xml and a lot of other folders and subfolders.
is the maven-metadata.xml updated very time with the same date as the date of the last updated file in that folder?
I'm searching for an easy way to check when an artifact was last uploaded/updated without checking every file in every subfolder.
The date inside maven-metadata.xml files should be to update if you upload every time that you:
Upload a new artifact version of an existing artifact
Upload a new artifact.
So you can use this date as reference.

How to update file upladed to remote nexus by mistake

I uploaded file using mvn deploy:deploy-file but I uploaded wrong file. How can I update or remove this file if I don't have direct access to nexus?
Ask your Nexus admin to delete it through the UI.
If this is a SNAPSHOT, you also have the option of deploying the same file using the same version number. That way, when others reference 1.2.3-SNAPSHOT, they get the intended version. And eventually the bad SNAPSHOT will probably get deleted through a scheduled job. This is a decent workaround while you contact your Nexus administrator.

How do I download an artifact from an archive in TeamCity 6.5? I can't construct the correct URL

I have a zip archive artifact. I'm interested in downloading a single file from that artifact. I can't upload that file outside of the archive right now. The documentation says you download an archive like this
/repository/download/BUILD_TYPE_ID/BUILD_ID:id/ARTIFACT_PATH
So, my URL for that looks like this (and I need anonymous access, so you see the guest flag). And it works!
/repository/download/bt23/2253:id/mypackage.zip?guest=1
However, I want one single file from that artifact. And the docs are confusing on how to do that. They do not specify what replaces <zip or jar archive>. And I am not constructing the whole buildNumber or buildTypeId values properly.
/repository/archive/<zip or jar archive>/buildTypeId/BUILD_TYPE_ID/buildNumber/BUILD_NUMBER/index.html
I tried using zip and `.zip'. I tried filling in the build values directly, but it's much different from the working archive download URL.
/repository/archive/zip/buildTypeId/bt23/buildNumber/2253/myfile.txt?guest=1
Does anyone have working concrete example of the URL for a single file in an archive?
You need to replace <zip or jar archive> with relative path to your artifact. For example, if you want to retrieve file.txt from package.zip which is uploaded under dist directory in your build artifacts you need to use this url:
http://server/repository/archive/dist/package.zip/buildTypeId/bt23/buildNumber/2253/file.txt?guest=1
BTW, a new, more straightforward URL syntax will be available in TeamCity 7.0:
http://server/repository/download/bt23/2253/dist/package.zip!file.txt?guest=1
Old URLs will be supported too.

Resources