Thursday, August 30, 2012

Incremental build with RichFaces CDK


To whom of us using RichFaces CDK and being unsatisfied with a build time, our day just came!

CDK got an incremental build feature, which caches information collected during a Library compilation and store it on a hard drive.

Once you trigger a build for a second time, the last modification time of all sources is compared to last modification time of cache file.

When CDK recognizes that any source has changed, it will re-compile it and the collected data will be applied on Library model again, effectively rewriting old data.

How to Configure Incremental Build

How to configure incremental build in your CDK project? It's pretty simple: you don't need to do anything.

Incremental build is turned on by default to make your life easier and to save your precious time.


I recommend you to configure the fast CDK turnaround using JRebel - together with the incremental build, nothing will beat you in the rich JSF components development time.

Troubleshooting

When using incremental build at current implementation, be aware that in some cases when you do structural changes (e.g. renaming methods), you may get to a point where the incrementally generated sources will not be valid - sometimes it won't make any trouble (attribute renaming), sometimes sources generated by CDK might not be even compilable at all.

In this case, you just need to recompile the sources from scratch, either with additional maven-cdk-plugin configuration

$ mvn cdk:generate -Dcdk.recompile=true


or using command line interface:

$ bash run.sh --force-recompile

However in most cases, incremental build will work just fine. :-)

Improvement

Using incremental build, I have achieved build-time improvement from 10 545 ms to 1 622 ms in Bootstrap sandbox project.

Such an improvement will allow us to re-factor RichFaces component suite to be developed just from one maven module and simplify a build a lot.

Enjoy JSF component development

No comments:

Post a Comment