Rename repository (Nexus 3)

2,872 views
Skip to first unread message

max.sc...@agfa.com

unread,
Sep 22, 2017, 6:03:30 AM9/22/17
to Nexus Users
I'd like to rename a repository on my Nexus 3 instance.
So far I was only able to do it by manipulating the orient db:
In config db I updated repository_name on repository and in component db I updated repository_name on bucket.
Tasks and groups related to the repo I updated afterwards using Nexus UI.
I wonder if the reposiotry name can be changed by groovy script via task. Does anybody know?
 

Marco Heilmann

unread,
Nov 3, 2017, 1:32:41 PM11/3/17
to Nexus Users
Hi,

I'm in the same situation as you now. Have you found better a solution for the renaming problem yet?

If not:

Could you explain more detailed how you manipulated the orient db? (I never worked with orient db before so I apologise for my stupid questions)

Did you use the OrientDB console for that purpose or did you configured some files directly?


You wrote:
In config db I updated repository_name on repository and in component db I updated repository_name on bucket.
 
Where/what exactly is "config db"?

Thank you in advance.

Rich Seddon

unread,
Nov 3, 2017, 2:28:43 PM11/3/17
to Nexus Users
There isn't currently a supported way to rename a repository in Nexus 3. Directly manipulating the database tables isn't recommended, the ID's are stored in other places such as in the blob storage properties files.

I can't find a feature request for this.  So I'd encourage you to open one in the "Dev - Nexus" project at https://issues.sonatype.org.

Rich

Kelly Robinson

unread,
Nov 3, 2017, 2:49:44 PM11/3/17
to Rich Seddon, Nexus Users
I can only speak to the 'why' we don't allow this in the system easily now, and it's simply that all external access to the repository in question would be broken with no easy way to notify of the change, since the repository name is directly in the url.

--
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/67d4ce8c-9ec3-4999-b7fd-cc61aaea5265%40glists.sonatype.com.

Marco Heilmann

unread,
Nov 3, 2017, 7:20:41 PM11/3/17
to Nexus Users, rse...@sonatype.com
Hi Kelly,

I can only speak to the 'why' we don't allow this in the system easily now, and it's simply that all external access to the repository in question would be broken with no easy way to notify of the change, since the repository name is directly in the url.

While you are absolutly correct that it would break all external access to the renamed repository, it should still be in the reponsibility of the nexus admin to make these decisions (in my opinion)

I don't think that it is a good strategy to remove simple features, like renaming a repository, just because some users may don't realize the impact.

Even if a nexus admin renames a repository by mistake, he could still just rename it again with the original name and the problem is solved.


max.sc...@agfa.com

unread,
Nov 6, 2017, 4:19:48 AM11/6/17
to Nexus Users
In my case a snapshot repository had grown so big that tasks like the Snapshot Remover took more than a week.
So I decided to replace the repo by an empty one.
In order to keep access to the old stuff I decided to rename the repo and add it to the repo group. So external read access is no issue.
That way all teams deploy now to the new empty repo without configuration change. But still can download all previously available artifacts.

To do so I had to connect to the orient db as described in this article: https://support.sonatype.com/hc/en-us/articles/235816228-Relocating-Blob-Stores
Once connected to "config" db I updated the repository name:
update repository set repository_name='new-name' where repository_name='old-name'
disconnect
and connected the same way to the "component" db:
connect plocal:../sonatype-work/nexus3/db/component admin admin
Review the buckets:
select from bucket
and update:
update bucket set repository_name='new-name' where repository_name='old-name'
exit
Then I replaced in all *.properties files in the blob storage directory the string
@Bucket.repo-name=old-name by @Bucket.repo-name=new-name
Then I started Nexus and in Nexus UI updated repository groups and scheduled tasks and so on which referenced the old name.
Then I created the new repo...
All works fine but please note that my renamed repo is "read-only". Noboday uploads to it anymore.
So I can't tell if that would work.

Would be great if Nexus3 would support renaming like Nexus2 did.

max.sc...@agfa.com

unread,
Nov 6, 2017, 4:42:33 AM11/6/17
to Nexus Users
@Rich: Thanks for the info. I've submitted this request: https://issues.sonatype.org/browse/NEXUS-14748


On Friday, September 22, 2017 at 12:03:30 PM UTC+2, max.sc...@agfa.com wrote:

Sverre Moe

unread,
Apr 15, 2019, 12:00:00 PM4/15/19
to Nexus Users
What will happen when I delete my old maven2 repository? 
Will it delete all assets and components stored in the blod storage?

I thought perhaps creating a new maven2 repository with the desired name/id, and the delete the old.
But if deleting the old repository will cause all assets to be deleted, then my way of rename will not work.

Nexus 3 create the maven repositories as
maven-central
maven-releases
maven-snapshots
maven-public

Since we upgraded from Nexus 2 we got instead
central
releases
snapshots
public

I wanted to use the name "releases" for our yum repository.

Rich Seddon

unread,
Apr 15, 2019, 3:10:50 PM4/15/19
to Nexus Users
What will happen when I delete my old maven2 repository? 
Will it delete all assets and components stored in the blod storage?
 
Yes, all assets and components in the repository's blob storage will be deleted if you delete the repository.

Rich
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages