How to rename a package in Eclipse with Subversive correctly?

11,227

Solution 1

When you read the Subversive documentation on Refactoring, you do have this warning:

While refactoring, the structure of the versioned folder is changed, so if it's not up-to-date the conflict while committing is inevitable.
So the user must be sure, that he has updated the resource being refactored to the repository location revision.
Remember that the folder is considered to be not up-to-date even if only its revision number on the repository is changed.

It should work from Eclipse, but you need an up-to-date resource.

Solution 2

Niko's right. Here's what I do when I want to rename a file within a project in Subclipse (subversion for Eclipse):

  1. go to SVN Repositories, and "Rename/Move" the resource.
  2. in the project perspective, right-click the recently renamed file and click "Team", "Update to Head". The previously name file will disappear from the view but don't worry.
  3. Right-click "Team", "Synchronize with Repository", and it will take you to the Synchronize perspective.
  4. Right-click the properly named resoure and select "Update". that's it

Solution 3

you should rename/move the package first within svn (rightclick in svn explorer). then you update all the classes (you will get an error for each class that you can rightclick and solve)

Share:
11,227
guerda
Author by

guerda

Updated on June 21, 2022

Comments

  • guerda
    guerda almost 2 years

    I recently found some problems when I tried to rename a package in a Java project with Eclipse. I use Subversive for SVN integration.

    If I rename a package via Refactor -> Rename, the commit fails.

    I have to rename it in a somewhat strange way:

    1. Create the new package as a new empty folder
    2. Select all classes to rename
    3. right click -> Team -> Switch
    4. Enter new path.

    After the commit, the rename is done, but very ugly.

    How to do this on a nicer way?

    • Aaron Digulla
      Aaron Digulla over 14 years
      Refactor -> Rename should work. What error message do you get during commit?
    • guerda
      guerda over 14 years
      It said that the files are already in SVN.
    • Jeff Axelrod
      Jeff Axelrod over 12 years
      See this post.
  • guerda
    guerda over 14 years
    It's nice, if it should work but the error occured, even if I'm sure, the working copy was up-to-date.