May 27 2009

If you created a project in Eclipse, but you created a regular “Project” instead of a particular project type (in my case, a “PHP Project” then there is a fairly easy way of fixing it. I had to do this to make a particular project work in the PHP Explorer (which for some reason worked fine on Windows version of Eclipse, but not my version…)

Create a new project of the type you want to convert your existing project to. In my case, I just created a new PHP Project. Alternatively, you can use an existing PHP Project (or project of the type you want to convert to) if you have one. Open the .project file of this, and copy the <natures> and <buildSpec> XML sections. Open the .project file of the project you wish to convert. Remove the old <natures> and <buildSpec> sections and replace with the copied section. If you have other <natures>, for example PDE etc., then you’ll have to merge them by hand. Mine now looks a little like this:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>someprojectname</name>
	<comment></comment>
	<projects>
		<project>otherproject</project>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.wst.validation.validationbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.dltk.core.scriptbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.php.core.PhpIncrementalProjectBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.php.core.ValidationManagerWrapper</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.php.core.PHPNature</nature>
	</natures>
</projectDescription>

It’s as simple as that! Close the project and re-open it and you’ll have all the magical features of PDT (or whichever project type you wanted…)

Leave a Reply

Purchase Tramadol Online