Eclipse Rename Function for Dependent Projects

I have two eclipse projects. The second depends on the first. When I try to rename the java class of the first project (using the rename function in the java file in the project explorer), it correctly refactores this project, but it does not change anything in the project, which depends on it.

Is there any way in eclipse to say that the rename function works even on projects related to refactoring? Thanks for the help.

My version of Eclipse is Juno.

Update:
I forgot to mention that the projects are related to the SVN repository. Maybe this may be relevant.

Update 2:
I add additional data after mliebelt's request for clarification.
My version of Eclipse is Juno, the Eclipse Java EE IDE for web developers, build ID: 20120614-1722.

I installed some plugins: subclipse, JRebel, m2e, Eclipse Web Tool Platform.
The second project is associated with the first as the dependence of the project on the eclipse. I added the first project in the Java Build Path project tab. Everything seems to be working fine, even the rename function.

Then I tried to put two projects in two different SVN repositories. I created two repositories on the SVN server, and I installed the tortoiseSVN client and the eclipse plugin subtitle on my machine. Since I was unable to import projects on the server directly from eclipse, I copied the project folders elsewhere and I deleted the projects from eclipse. I used tortoiseSVN to import projects, each of which was in the repository with the same project name, and I imported the project back into eclipse. To do this, I used the eclipse function "import an existing project into the workspace" with the option "copy project to workspace" selected. Everything seems to work, but not the rename function.

+4
source share
2 answers

This works (for me), so here is what I did to reproduce the behavior. Hope this helps find a bug.

  • Create two projects and make the second dependent on the first. Java Build Path for <code> Test2 </code>
  • Create the source code so that it can be reorganized. Make sure the class in Test2 dependent on the class in Test .
  • Select the method you want to rename from the context menu. Enter a new name for the method there, only then the Preview parameter is available. Make sure Update references checked. Rename a method clarification dialog
  • Click the Preview button to find out which classes will be refactored. enter image description here

As you can see, this works for me. Check what is different in your context:

  • Identify the dependence of different
  • Use another refactoring (which may contain an error)
  • ...?

Then I added two projects to the (local) repository (I use the Underwater plug-in module, it matters), and repeated the refactoring, and it works the same. What does it mean that "it does not work if the projects are in SVN"? Projects must be in Eclipse, refactoring cannot be done directly in the Subversion repository.


I tried to reproduce the error but could not. Here is what worked for me (without screenshots):

  • Installed Java EE from Eclipse (Indigo Version)
  • Installed Subclipse 1.8 from the Eclipse Marketplace.
  • Defined 2 projects still.
  • Added projects to different Subversion repositories using Team > Share Project...> SVN > select the repository location > Finish
  • Then I deleted 2 projects and created them inside the workspace by following these steps:
    • Go to the SVN Repository Exploring perspective .
    • Open the location of your repository in the SVN Repositories view and select Checkout... for each project in the menu.
    • Projects will be restored taking into account the workspace, and the relationship between them will not be lost.
  • After that, I can rename the method as shown above.
+1
source

The problem in my workflow described in Update2 was that when I imported the projects into eclipse, I used the function "import an existing project into the workspace".

I had to use SVN Checkout Projects from SVN , selecting previously created repositories.

enter image description here

0
source

Source: https://habr.com/ru/post/1469251/


All Articles