[英]How to refactor and move sub-packages along with the outermost package?
There is an outermost package and then a number of many sub- and sub-sub packages in an existing open-source project. 在现有的开源项目中,有一个最外层的程序包,然后是许多子程序和子子程序包。
Eg: com.example.android.outer
and then com.example.android.outer.inner1;
例如: com.example.android.outer
,然后com.example.android.outer.inner1;
com.example.android.outer.inner2
... com.example.android.outer.inner2
...
I am trying to move the whole outermost & all its sub-packages down the hierarchy, from that project to another new one. 我试图将整个最外层及其所有子包从该项目移到另一个项目。 There are like few hundred files and more than 50 sub and sub-sub packages. 大约有几百个文件,超过50个子和子子包。 Following are the issues that I am encountering: 以下是我遇到的问题:
1) If I am refactoring(or copying) the outermost package, only the files which are in outermost package are getting moved. 1)如果我要重构(或复制)最外层软件包,则仅移动最外层软件包中的文件。
2) If I am just copying the files, then there are issues with the .R
import. 2)如果我只是复制文件,则.R
导入存在问题。 The R file that was generated in the previous project remains( import com.example.android.outer.R; ) and gives errors in the new project. 先前项目中生成的R文件将保留(import com.example.android.outer.R;),并在新项目中给出错误。 Since I have 100's of files, manually removing the import line from each of them it is a pain. 由于我有100多个文件,因此从每个文件中手动删除导入行是很痛苦的。
How can I refactor the package and its sub and sub-sub ... packages down the hierarchy at once? 如何立即在层次结构中重构软件包及其子和sub-sub ...软件包? I tried to search but could find any help. 我尝试搜索,但可以找到任何帮助。 Thanks in advance. 提前致谢。
Move (refactor) the packages one by one. 一次移动(重构)软件包。 It is a one-time task, you can do it in less than one hour, just go ahead with that. 这是一项一次性的任务,您可以在不到一个小时的时间内完成它,只需继续进行即可。
Honestly, Eclipse will take care about everything, you don't have to worry. 老实说,Eclipse会处理所有事情,您不必担心。 You would waste more time with finding and fixing bugs if you are copying and trying to fix it manually, compared to the time you spend on manually moving packages. 与手动移动软件包相比,如果您要手动复制和修复它,则将浪费更多的时间查找和修复错误。
Last but not least, you'll lose your source control history with copying. 最后但并非最不重要的一点是,您将失去复制的源代码管理历史记录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.