Know the feeling when you’re just about to release code to the public’s eye, and all you need to do is write that pesky build file? Even as I write it I feel it’s an understatement: the task of creating an ant build file can take a few good days out of anyone’s life, and even with copying the last project’s build file and changing a few parameters you can’t really minimise it to less than half a day’s work.Â
But why should you, really? If you’re working with Eclipse you probably notice how your IDE knows about the relationships between all the projects in the workspace, which project requires which Jar files, and where to place all the binaries. After all, it is your workspace and integrated development environment. So why can’t that information be used to generate that damned file?
Well, one guy thought it should be, and implemented something better: a generic build system for Eclipse-managed projects called ebuild. In his blog Omry describes ebuild himself, but since his posts are in Hebrew I’ve decided to spread the word in English as well.
Ebuild is added to your workspace and, by adding a short file called build.properties, can be executed in order to build your project. After that, you get one build.xml file which can build any of your projects. All your projects need to have is the build.properties file in it, worth three lines of key-value pairs at most, and ebuild will do the magic of finding out the project’s dependencies and build order.
Omry is also the person behind JNotify, the library which brings you file system notifications in a nicely wrapped Java API.
For those of you who use IntelliJ: as far as I know, selecting “Generate Ant File” from the “Build” menu should be more than enough for you – it doesn’t create the magical build.xml file, but it does save a lot of work when lazying out on writing the build files.
Liked Chaotic Java? It's free! But I also make some other things that aren't, which you might like. Like Firewall, a rule changing, turn based strategy game for iOS.
July 19th, 2008 at 11:06 pm
Aviad,
You slightly misunderstood:
it’s not a build file generator – it’s a build file that can build (almost) any Eclipse Java project.
July 19th, 2008 at 11:12 pm
Just to show you how Java is more a native language for me than even Hebrew.
I will soon correct the post and add a short explanation on how to use ebuild.
July 19th, 2008 at 11:36 pm
Done. Omry’s comment might seem silly now that the post is changed.. But the title is still there (don’t really want to change it.)
Just know that at some point in time, I made a mistake and wrote that ebuild was a build file generator while its actually a generic build system. That’s all.
September 25th, 2008 at 3:41 pm
Ever tried to use Maven? I admit that it takes some time to get used to it, but I really like how you can setup complete projects in some seconds and then let it generate the required project files for your favourite IDE.
September 5th, 2009 at 3:18 am
My project is TemperatureConverterService,
which has 1 file TempereatureConverter.java
What should my build.properties look like.
(How about when I edit it with the eclipse properties editor?) I executed ant -DTemperatureWebService and I get an error.
Thanks,
Sonia
September 5th, 2009 at 9:56 am
Sonia,
see this : http://ebuild.firefang.net/wiki/build.properties
sinece in your case you probably don’t need to include or exclude anything, you can leave the two include/exclude lines out, so your build properties would end up like:
main.class=TempereatureConverter
(Assuming it’s in the default package).
you can edit with Eclipse properties editor, but it only useful to edit the include/exclude lines.
since the code should build even without a build.properties, I am guessing that you just ran ant in the wrong place.
you need to run ant in the ebuild directory, or tell it where the build.xml file is.
a more convenient alternative is to create a minimal build.xml file inside your project, like this one here:
http://ebuild.firefang.net/wiki/DriverBuildXML
July 14th, 2010 at 8:05 pm
Eclipse is capable of generating an ant build file for your project, you just have to know to access this feature 😉
right-click project -> export
select General -> Ant Buildfiles
there it is, your perfect ant build file.
December 26th, 2010 at 3:46 am
Sam provided the best answer. Eclipse already has this feature. Completely agreed with Sam.
January 4th, 2011 at 11:55 am
Hi,
I have added the EBuild as a project in my eclipse’s workspace.
After adding, the projects failed to build.
All the imports of org.apache.tools.ant.*; does not work.
How it can be fixed?
Thanks,
Eyal.
January 4th, 2011 at 12:30 pm
What do you mean, just putting ebuild files in your workspace broke your eclipse build?
January 4th, 2011 at 1:07 pm
Sorry, I have solved the problem.
My mistake.
February 4th, 2011 at 11:29 am
Awesome, I found exact classpath using this project and able write build.xml. Thanks very much…