Java 用eclipse克隆项目?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25348761/
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
Clone project with eclipse?
提问by Royi Namir
I'm learning JAVA with Eclipse (ADT , Latest version - For Android development).
Each lesson we enhance the sameproject. (I don't like this approach)
So - I want to create different project for eachlesson so :
Each lesson I'm cloning the main folder - and then I import it as an existing project.
( I thought that cloning + renaming the folder - would be fine)
我正在用 Eclipse 学习 JAVA(ADT,最新版本 - 用于 Android 开发)。
每节课我们都加强同一个项目。 (我不喜欢这种方法)
所以 - 我想为每节课创建不同的项目,所以:
每节课我都克隆主文件夹 - 然后我将它作为现有项目导入。
(我认为克隆 + 重命名文件夹 - 会很好)
But :
但 :
Eclipse says that the project already exists. (make sense)
Eclipse 说该项目已经存在。(有道理)
Question
题
If I have a folder that contains a project ( LeadoMat
) :
如果我有一个包含项目 ( LeadoMat
)的文件夹:
, And I'm creating folder LeadoMat_Ver2
( cloned files)
,我正在创建文件夹LeadoMat_Ver2
(克隆文件)
— How/What should I do in order for eclipse to accept it as a new project named : LeadoMat_Ver2
?
— 如何/我应该怎么做才能让 Eclipse 接受它作为名为 : 的新项目LeadoMat_Ver2
?
采纳答案by Robby Cornelissen
The project folder contains a file called .project
. In your cloned project, open that file with any text editor and look for the project name:
项目文件夹包含一个名为.project
. 在您克隆的项目中,使用任何文本编辑器打开该文件并查找项目名称:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>LeadoMat</name>
<!-- more stuff here -->
</projectDescription>
Change the content of the name
element to LeadoMat_Ver2
. You should now be able to import the project into Eclipse.
将name
元素的内容更改为LeadoMat_Ver2
。您现在应该能够将项目导入 Eclipse。
回答by i_turo
The simplest approach would probably be to do the copying right in eclipse
:
最简单的方法可能是在以下位置进行复制eclipse
:
Right Click your Project -> Copy
Right Click in the Project Explorer -> Paste
or
CTRL + C & CTRL + V
Eclipse will then automatically prompt you to enter a new name for the clone. Then you'll have a full copy of your project with the new name.
然后 Eclipse 将自动提示您输入克隆的新名称。然后,您将拥有具有新名称的项目的完整副本。
The reason why eclipse
thinks that it is the same project, is because you also clone the .project
-files which contain the name of the project used in eclipse
.
之所以eclipse
认为它是同一个项目,是因为您还克隆了.project
包含在eclipse
.
回答by Gim
Right Click and chooseCopy (to copy project that you want to clone) Right Click on blank area on Package Explorer tab choose PasteInput project name wait and you have a new one
右键单击并选择复制(复制您要克隆的项目)右键单击包资源管理器选项卡上的空白区域选择粘贴输入项目名称等待,您有一个新的