tags:

views:

3044

answers:

4

I checked out a project from SVN and did not specify the project type, so it checked out as a "default" project. What is the easiest way to quickly convert this to a "Java" project?

I'm using Eclipse version: 3.3.2

+4  A: 

Open the .project file and add java nature and builders.

<projectDescription>
    <buildSpec>
     <buildCommand>
      <name>org.eclipse.jdt.core.javabuilder</name>
      <arguments>
      </arguments>
     </buildCommand>
    </buildSpec>
    <natures>
     <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>

And in .classpath, reference the Java libs:

<classpath>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
</classpath>
Chris Marasti-Georg
+1  A: 

I deleted the project without removing content. I then created a new Java project from an existing resource. Pointing at my SVN checkout root folder. This worked for me. Although, Chris' way would have been much quicker. That's good to note for future. Thanks!

Joe Dean
+1  A: 

Joe's approach is actually the most effective means that I have found for doing this conversation. To elaborate a little bit more on it, you should right click on the project in the package explorer in eclipse and then select to delete it without removing directory or its contents. Next, you select to create a Java project (File -> New -> Java Project) and in the Contents part of the New Java Project dialog box, select 'Create project from existing source'.

The advantage this approach is that source folders will be properly identified. I found that mucking around with the .project file can lead to the entire directory being considered a source folder which is not what you want.

Chris J
A: 

Manually changing XML and/or settings is very dangerous in eclipse unless you know exactly what you're doing. In the other case you might end up finding your complete project is screwed. Taking a backup is very recommended! Howto do it just using eclipse?

1) Select project. 2) Open the project properties through Project -> Properties. 3) Goto Targetted Runtimes and add the proper runtime. Click APPLY. 4) Goto Project Facets and select the JAVA facet which has appeared due to step 4. Click APPLY 5) Set your build path. 6) If it's a Maven project, you might want to select the project, click Maven -> Update Project configuration...

That did it for me. And Eclipse is configured correctly. Hope it'll work for you too. Regards Lorenzo Webworks Consulting.

Lorenzo