[英]Eclipse renaming function on projects with dependencies
I have two eclipse project. 我有两个eclipse项目。 The second one depends on the first one. 第二个取决于第一个。 When I try to rename a java class of the first project (using the rename function on the java file on the project explorer) it correctly do the refactor of that project but it doesn't changes anything on the project that depends on it. 当我尝试重命名第一个项目的java类(使用项目浏览器上的java文件上的重命名函数)时,它正确地执行该项目的重构,但它不会改变依赖于它的项目上的任何内容。
Is there a way in eclipse to tell the renaming function to act even on the projects that are linked to the refactored one? 在eclipse中是否有一种方法可以告诉重命名函数甚至可以对链接到重构函数的项目执行操作? Thanks for help. 感谢帮助。
My Eclipse version is Juno. 我的Eclipse版本是Juno。
Update: 更新:
Forgot to mention that the projects are linked to an SVN repository. 忘了提到项目链接到SVN存储库。 Maybe it could be relevant. 也许它可能是相关的。
Update 2: 更新2:
I add more details after mliebelt request of clarification. 我在mliebelt请求澄清后添加更多细节。
My Eclipse version is Juno, Eclipse Java EE IDE for Web Developers, build id: 20120614-1722. 我的Eclipse版本是Juno,Eclipse Java EE IDE for Web Developers,build id:20120614-1722。
I've installed some plugins: subclipse, JRebel, m2e, Eclipse Web Tool Platform. 我已经安装了一些插件:subclipse,JRebel,m2e,Eclipse Web Tool Platform。
The second project is linked to the first one as a project dependency in eclipse. 第二个项目与第一个项目相关联,作为eclipse中的项目依赖项。 I have added the first project in the project tab of Java Build Path. 我在Java Build Path的项目选项卡中添加了第一个项目。 Everything seems to work fine, even the renaming function. 一切似乎都很好,甚至是重命名功能。
Then, I tried to put the two project in two different SVN repositories. 然后,我尝试将这两个项目放在两个不同的SVN存储库中。 I created two repositories on the SVN server and I installed on my machine the client tortoiseSVN and the eclipse plugin subclipse. 我在SVN服务器上创建了两个存储库,我在我的机器上安装了客户端tortoiseSVN和eclipse插件subclipse。 Since I didn't succeeded in importing the projects on the server directly from eclipse, I copied the projects' folders in a different location and I removed the projects from eclipse. 由于我没有成功直接从eclipse导入服务器上的项目,我将项目的文件夹复制到不同的位置,我从eclipse中删除了项目。 I used tortoiseSVN to import the projects, each one on a repository with the same name of the project, and than I imported the project back to eclipse. 我使用tortoiseSVN来导入项目,每个项目都在一个具有相同项目名称的存储库中,而不是我将项目导回到eclipse。 To do that I used the eclipse "import existent project into workspace" function with the "copy project into workspace" option selected. 为此,我使用了eclipse“将现有项目导入工作区”功能,并选择了“将项目复制到工作区”选项。 Everything seems to work but not the renaming function. 一切似乎都有效,但不是重命名功能。
It does work (for me), so here is what I have done to reproduce the behavior. 它确实有用(对我来说),所以这就是我为重现行为所做的工作。 I hope that this helps to find the error. 我希望这有助于找到错误。
Test2
is dependent on a class in Test
. 确保Test2
中的类依赖于Test
的类。 Preview
option available. 为该方法输入一个新名称,然后才能使用“ Preview
选项。 Ensure that Update references
is checked. 确保选中“ Update references
。 Preview
to see which classes will be changed by the refactoring. 按下按钮Preview
以查看重构将更改哪些类。 As you can see, it works for me. 如你所见,它对我有用。 Please check what is different in your context: 请检查您的上下文中的不同之处:
I then added the two projects to a (local) repository (I use the plugin Subversive, it that matters), and have retried the refactoring, and it works the same way. 然后我将这两个项目添加到(本地)存储库(我使用插件Subversive,这很重要),并重新尝试重构,它的工作方式相同。 What is that "it does not work if the projects are in SVN"? 什么是“如果项目是在SVN中它不起作用”? The projects have to be in Eclipse, refactoring cannot be done on the Subversion repository directly. 项目必须在Eclipse中,不能直接在Subversion存储库上进行重构。
I have made another attempt to reproduce the error, but could not. 我再次尝试重现错误,但不能。 Here is what has worked for me (no screenshots included): 这是对我有用的(没有包含屏幕截图):
Team > Share Project...> SVN > select the repository location > Finish
使用Team > Share Project...> SVN > select the repository location > Finish
将项目添加到不同的Subversion存储库Team > Share Project...> SVN > select the repository location > Finish
SVN Repository Exploring perspective
. 转到SVN Repository Exploring perspective
。 SVN Repositories
your repository locations, and select for each project from the menu Checkout...
. 在SVN Repositories
视图中打开您的存储库位置,并从菜单Checkout...
选择每个项目。 The problem in my workflow, described in Update2, was that, when I imported back the projects to eclipse, I used "import existent project into workspace" function. 我在Update2中描述的工作流中的问题是,当我将项目导回到eclipse时,我使用了“将现有项目导入工作区”功能。
I had to use SVN Checkout Projects from SVN instead, choosing the repositories I previously created. 我不得不使用SVN的SVN Checkout Projects ,选择我之前创建的存储库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.