Eclipse – Repairing the Default Java Builder

For a while now I’ve been using my own custom batch file to build my project, in addition to compiling the class files it also packages it into a jar, signs it, and uploads it to my development server (as it’s an applet for a site I’m working on). However, since there’s two computers I develop on I had to create two copies of this script that were customized to each of the PCs, as one was running Windows 7 and the other Windows XP. During one of the SVN commits or updates the default builder was completely nuked, it still showed up but gave errors when I tried to use it. I tried to recreate it inside of Eclipse but had no luck, so for a while I just worked around it, however it was frustrating when I simply wanted to launch the applet within Eclipse for a quick test.

Eventually I created a new project for something else and found the builder in it worked as expected, so I realized it was project specific. So I compared the .project files and was able to correct the corrupted one using the new one as a reference. Here is an example of how a .project file should look with just the default Java builder:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>HelloWorld</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>

In the above example I have removed my custom builders to focus on the built in one, they would each be listed as extra buildCommand entries in the parent buildSpec node. In my corrupted copy I had several argument and trigger values that were unnecessary. Just for comparison, here is the buildCommand for my custom Windows 7 builder:

<buildCommand>
	<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
	<triggers>full,incremental,</triggers>
	<arguments>
		<dictionary>
			<key>LaunchConfigHandle</key>
			<value>&lt;project&gt;/.externalToolBuilders/Win7_Builder.launch</value>
		</dictionary>
	</arguments>
</buildCommand>

Hope this helps someone else out there! And stay tuned, as I’ll be releasing my custom build script very soon for those who may be interested 😀


Tags: , , , ,

  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

Leave a Reply