Updated the last modified of an uploaded asset

141 views
Skip to first unread message

Jason Pell

unread,
Apr 12, 2018, 10:03:34 AM4/12/18
to Nexus Users
I am migrating from nexus 2, I tried to use the nexus 2 -> 3 migration tooling but I found it takes forever and I can't afford to have the repo down for that long.  I have found that I can use curl to upload the contents of the old sonatype-work directory and that works quite nicely. However the Last Modified time in the UI and the header when downloading the resource does not correspond to the original source file time (and I never expected it to)

However, what I was wondering is if there is any way I can modify the last modified date for each asset to match the file system date of the original file after its uploaded.  This is a once off, so I am happy to do this via a oriendb script or a groovy script or whatever.  I tried updating the content[last_modified] attribute of an asset in the oriendb console, but it does not impact the UI or the last modified header when I download the file.  (Even after a restart)

I also tried updating the last_updated field of the component class for the parent component of the asset.

Am I on the right track in the slightest or is this a really bad idea? 

Also can someone please point me to the source code of the migration tooling, as I would like to dig around in there to see if there is anything I might be able to use.  I really don't care if its a hack, as its a once off for me and then I will be dumping nexus 2 repo and moving on with nexus 3.

I have downloaded the nexus-public repo, but I have so far not managed to find the migration code.




Brian Fox

unread,
Apr 12, 2018, 10:18:07 AM4/12/18
to Jason Pell, Nexus Users
The Nexus 2 repo is fully functional while you're doing the migration. If you didn't know that, does it change the rest of your approach?

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/e9f6bf12-412b-40ee-ac4d-01f1dd31ad67%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.

jason...@gmail.com

unread,
Apr 12, 2018, 4:56:57 PM4/12/18
to Brian Fox, Nexus Users
I will certainly reconsider the migration tool, but I really do prefer to use the curl script, as it is faster and I have more control over it.

But having said that...

Does the nexus 2 -> 3 migration maintain the last modified time stamps?


Brian Fox

unread,
Apr 12, 2018, 5:07:23 PM4/12/18
to Jason Pell, Nexus Users
On Thu, Apr 12, 2018 at 4:56 PM, <jason...@gmail.com> wrote:
I will certainly reconsider the migration tool, but I really do prefer to use the curl script, as it is faster and I have more control over it.

But having said that...

Does the nexus 2 -> 3 migration maintain the last modified time stamps?



Yes, and it will continue to sync changes until you are ready to make the cutover. A ton of engineering went into this and it has been successfully used by many users/customers.
Reply all
Reply to author
Forward
0 new messages