Search code examples
javaeclipseantpde

PDE build with Ant is extremly slow compared to Eclipse


I have a very large OSGi project with about 300 bundles. When I import the project in Eclipse and do a Project -> Clean... and Project -> Build All it takes about 10 minutes until everything is build and I can start my application.

I think that 10 minutes are already pretty long, but when I execute a headless PDE build with Ant scripts it takes about an hour! I think something goes pretty wrong...

Do you have any hint for me how to speed-up the Ant-based build? Or how to track the problem down? I use the normal PDE build with a command like below. I have no idea why it is so much slower compared to a complete build in Eclipse.

java -jar eclipse/plugins/org.eclipse.equinox.launcher_<version>.jar -application org.eclipse.ant.core.antRunner -buildfile  eclipse/plugins/org.eclipse.pde.build_<version>/scripts/build.xml -Dbuilder=<path to the build configuration folder>

Thanks, Thomas

PS.: I know the question is very general, but even a hint how to find the performance lack would be helpful.


Solution

  • What you are seeing is expected, because you are (probably) comparing two different things:

    When forcing a rebuild in the Eclipse IDE, you are simply compiling all java-files. (For our 270-bundle project, this takes about 1-2 minutes.)

    When building with PDE-build, you are packaging the product as well (generating bundles and features, resolving plugin dependencies, JAR-ing everything, etc), and this takes much more time. (For our project this takes about 6-7 minutes.) The equvivalent of this in the IDE would be to open your .product file, and on the "overview"-tab in the editor, you select "eclipse product export wizard".

    As for tips on how to speed up the build: There is no silver bullet that I know of. But: Search for "tycho build eclipse", and/or see http://www.vogella.com/tutorials/EclipseTycho/article.html and https://eclipse.org/tycho/. In other words: You can change your build to use Tycho, which enabeles you to build each plugin separately (and incrementally if you want).