After checking out Subversion code into Eclipse, how do I get it to build?

匿名 (未验证) 提交于 2019-12-03 01:44:01

问题:

This problem has been frustrating me for some time...

A lot of sites like Sourceforge use SVN or Subversion to manage their code. I have little problem compiling SVN code in C++, but when it comes to Java, my IDE gives me a headache.

I've installed Subclipse for SVN support for Eclipse, and it works. I can check out any code into my Workspace. Now Subclipse will put the whole thing into a special project of some sort that can't be compiled. So I search Google for something and I come up with modifying the eclipse XML file to specify the 'nature' to be a Java project.

Okay, now it's a Java project. Say I have a folder structure like:

\src \data \graphics 

I get 800 compiler errors complaining the package name is org.company.SomePackage instead of src.org.company.SomePackage.

Then what I do is create packages called src, data, graphics, etc, instead of just folders. I cut and paste everything in the folders into the packages and finally I can compile it.

What is a better way to do this?

EDIT: I can only check out anything SVN as a SVN project, and there's no way within Eclipse to change that to a Java project. How can I check out the SVN as a java project in the first place?

回答1:

I get 800 compiler errors complaining the package name is org.company.SomePackage instead of src.org.company.SomePackage.

Right click on Project -> Properties -> Java Build Path -> Source Tab -> Add "src" as a source folder and remove any others.



回答2:

it thinks your source is stored in root folder. you need to specify to the project that /src is the source folder.



回答3:

< natures> < /natures> 

and change it to as below

< natures> <nature>org.eclipse.jdt.core.javanature</nature> < /natures> 



回答4:

You have to configure proper source paths. Some open source projects make this automatic by checking their .project and .classpath files in with the rest of their files. For others, you'll have exactly the problem you are having. You need to set the classpath so the Java compiler knows where to find the source. You right click on the project and select properties and configure an arbitrary classpath, but the answer given by Kevin is easier for a beginner.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!