2/03/2009

Change svn project to java project in Eclipse

I checked out a project from subversion repository using Eclipse (3.4.1 ganymede). I chose to check it out into a new Eclipse project, but it turned out to be a non-java, svn project was created. In the project properties, there is no associated builder. Its .project file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>project1</name>
<comment>project1</comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
Now I want to turn it into a java project so it can be built with a java builder. I tried a few menus and other places inside Eclipse to no avail. Then I found I can just edit .project file, and that did the trick. Close Eclipse before doing these manual editing.
$HOME/workspace/project1/.project:
----------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>project1</name>
<comment>project1</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
I also added a .classpath file:
$HOME/workspace/project1/.classpath:
-----------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<!-- change the default bin directory to classes directory -->
<classpathentry kind="output" path="classes"/>
</classpath>

Finally, start Eclipse, open project1, and modify its source path, libraries, and other project properties.

10 comments:

Josh said...

Try this:

between the natures tag, add a single nature tag with this in the middle

org.eclipse.jdt.core.javanature

see if that works.

-Josh

Jagdeesh said...

Thanks Josh,

It's Worked.

jagdeesh333@gmail.com

Karen Sellers said...

If you create a blank java project first using the desired name and location, then checkout via svn, the project will remain a java project and hooked into the svn.

Anonymous said...

it works.. thanks alot

Anonymous said...

Worked like a charm, thanks

jazz said...

it really worked in my case.thanks!

Bobb said...

Well explained by you.That was helpfull

Etpl Seo said...

Nice post it is very useful for me.
Each and every year we are providing Cheap and best students project at Madurai.

Steve Smith said...

Great and Useful Article.

Online Java Training

Java Online Training India

Java Online Course

Java EE course

Java EE training

Best Recommended books for Spring framework

Java Interview Questions








Java Course in Chennai

Java Online Training India

Vũ Diệu Linh said...

I enjoyed on reading your blog post. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. Please visit my website, Friv 4000 Games is where all the free friv games.
Friv 4000