04.11.04

Change a project in eclipse to Java?

After I checked out a project from CVS, and forgetting to check it out as a Java Project, I couldn't get it changed.
Does anyone know how to change a project to a new kind of project?
Or to change one from Java to Tomcat?
It really sucks to remove the project and then create it new with the wizards. I could not get it changed with the project properties.
Can anyone help?

Posted by Karsten at 04.11.04 09:49 | TrackBack
Comments

Hmm,
XML files don't seem to show-up too nice in the comments...

Another try:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>YOUR-PROJECT-NAME</name>
<comment></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>

Erwin

Posted by: erwin at 05.11.04 12:59

Depending on how brave you are, you can just add the Java Nature to the project properties file.

If you open the .project file, and have a look at the XML (make sure Eclipse is closed at this point).

There's a section called <natures>. Just add a line like this;
<nature>org.eclipse.jdt.core.javanature</nature>

And that will magically turn it into a Java project.

To make it compile, you need to add in the following:

<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>

Into the <buildSpec> element.

I just tested it, and you don't even have to shut down Eclipse, if you edit the .project file, using the Navigator view it will magically turn from a simple project into a Java project complete with Build Paths etc.

There you go.

Posted by: Jon Eaves at 05.11.04 13:03

Thanks a lot guys.
I just wonder why eclipse is not supporting this. I could have needed this already a couple of times.
So thanks again for the hints. Will give this a try the next time I am to stupid to do it right in the first place.

Posted by: Karsten at 05.11.04 17:36
Post a comment









Remember personal info?