在 Eclipse 中,如何在不搞砸项目的情况下将所有源文件移动到不同的文件夹?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/610096/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
In Eclipse, how can I move all my source files to a different folder without screwing up the project?
提问by Iain
I have created my ActionScript source files in a folder on a Mac (I normally use Windows), and somehow managed to make an Eclipse/FDT project that can see them.
我在 Mac(我通常使用 Windows)的文件夹中创建了我的 ActionScript 源文件,并以某种方式设法制作了一个可以看到它们的 Eclipse/FDT 项目。
I now need to move them into a svn checkout of an existing project to get them under source control.
我现在需要将它们移动到现有项目的 svn checkout 中,以使它们处于源代码控制之下。
I just can't work out how you do this without losing all references in the project.
如果不丢失项目中的所有引用,我就无法弄清楚您是如何做到这一点的。
I'm new to Eclipse and don't really understand any of the terminology (e.g. workspace). Does Eclipse have project files or are they all hidden? Can the project file be moved?
我是 Eclipse 的新手,并不真正理解任何术语(例如工作区)。Eclipse 有项目文件还是全部隐藏?项目文件可以移动吗?
Help me stackoverflow, you're my only hope.
帮助我 stackoverflow,你是我唯一的希望。
Update: From the FDT Flash Explorer window I can only seem to be able to move files/folders within projects that exist. Should I create a new project in the place I want first?
更新:从 FDT Flash Explorer 窗口中,我似乎只能移动现有项目中的文件/文件夹。我应该先在我想要的地方创建一个新项目吗?
Should I move them from within Eclipse or from the file system? Do I need to setup a new workspace afterwards?
我应该从 Eclipse 中还是从文件系统中移动它们?之后我需要设置一个新的工作区吗?
回答by rogeriopvl
The project folder has 2 hidden files: .project and .classpath that have all the info of the project. You just need to copy those files along with your project files.
项目文件夹有 2 个隐藏文件:.project 和 .classpath,它们包含项目的所有信息。您只需要将这些文件与您的项目文件一起复制。
For instance, you have a project folder in workspace/myproject/, and you want to add it to a checkout svn folder, you just need to copy the complete folder content to the checkout and then add all the files to the svn (including the project hidden ones) and finally commit.
例如,您在workspace/myproject/中有一个项目文件夹,并且您想将其添加到checkout svn文件夹中,您只需要将完整的文件夹内容复制到checkout,然后将所有文件添加到svn(包括项目隐藏的)并最终提交。
From now on, when you checkout from that svn, you will have the eclipse project files, so all you need to do is create new project, and select the option that says that you already have a project folder with the source files (I'm not near an eclipse IDE to tell exactly the steps, but it's something like this). Eclipse will then import the project with all the settings you had previously defined.
从现在开始,当您从该 svn 签出时,您将拥有 Eclipse 项目文件,因此您需要做的就是创建新项目,然后选择表明您已经拥有包含源文件的项目文件夹的选项(我我不在 Eclipse IDE 附近来准确说出步骤,但它是这样的)。然后 Eclipse 将使用您之前定义的所有设置导入项目。
I hope that this answers your question.
我希望这能回答你的问题。
回答by boutta
Try refactoring your project. Rightclick on the folder to move and then choose Refactor->Move. Don't know if this will solve your problem but it will try to change the references in all projects according to the move.
尝试重构您的项目。右键单击要移动的文件夹,然后选择 Refactor->Move。不知道这是否会解决您的问题,但它会尝试根据移动更改所有项目中的引用。