2

我尝试寻找答案并遇到了很多类似的问题,但不是这个确切的问题。

我正在尝试从具有非 Eclipse 友好文件夹结构的 CVS 项目设置 Eclipse。

在项目文件夹内,所有源代码都在名为“com”的文件夹下。随后,源文件中的所有导入语句都采用以下形式:

import com.xxx.yyy.SomeObject;

当然,它指的是位于 com/xxx/yyy 的 SomeObject.java。

问题是当我在 Properties -> Java Build Path -> Source 选项卡 -> Add Folder 中添加 com 文件夹时,Eclipse 抱怨上面的 import 语句。它说,“声明的包'com.xxx.yyy'与预期的包'xxx.yyy'不匹配”。

我该如何解决这个问题?

4

1 回答 1

0

My recommendation, especially if your source files are all in one - or just a few - director(ies):

1) Check out your CVS project into a temp folder

2) Create a new Eclipse project from scratch. It will create a "src" folder by default.

3) Create your package with Eclipse. It will automatically create subfolders representing your package name (e.g. com.foo.mypackage).

4) Drag/drop your source into the Eclipse package

5) Make sure everything builds

6) Save the new Eclipse folder tree to CVS (ideally, use the CVS plugin for Eclipse to do this).

IMHO...

于 2013-07-10T23:12:25.783 回答