Building Richfaces Source Library (Jars)

Congratulations for having decided to switch to Richfaces! Once you start using the library within your development environment, as a programmer, you might want to explore the source of this open-source library. Richfaces source code is available for download at http://www.jboss.org/jbossrichfaces/downloads/

Richfaces library is built using CDK (Component Development Kit). Hence, when you download the source, what you essentially get is the whole of CDK project. Now, what you might require is to link your development environment library. Unfortunately, there is no such ready-made source jar available as part of the download. Don't be disappointed; Richfaces CDK project that you just downloaded has everything you need to build the source jars.

You have three Richfaces binary jars in your project:

- richfaces-api-xxx.jar

- richfaces-impl-xxx.jar

- richfaces-ui-xxx.jar
No marks for guessing; "xxx" stands for the Richfaces version.

Let us look at how you build the source jars:

- Extract the source library you just downloaded

- navigate to richfaces-ui-xxx-src\richfaces-ui-xxx\framework

Here is the directory structure you see:

+ api

+ impl

+ test

- pom.xml

- pom.xml.releaseBackup
- open your command window and run the following command:

mvn install
Oh, you need maven installed on your machine before you try this.

Check out http://maven.apache.org/ for instructions

- Wait few minutes for the run to complete. After it is done, navigate to richfaces-ui-xxx-src\richfaces-ui-xxx\framework\api\target. Alas! The source jar you are looking for the binary "richfaces-api-xxx.jar" is ready.

You will find the source jar for "richfaces-impl-xxx.jar" at richfaces-ui-xxx-src\richfaces-ui-xxx\framework\impl\target

- Now, switch to richfaces-ui-xxx-src\richfaces-ui-xxx\ui and run the same command again

mvn install

Source jars will be created under the respective component folder.

To quickly find the jars that just got created; perform a file search.

Copy all the jars to a single folder.

All that is left is to deflate the jars and compile them into a single jar

You can automate this task using an "Ant" build file.

- Done. You now have the source code for "richfaces-ui-xxx.jar" too.

- If you are using Eclipse, you can link the source code using the Eclipse ".classpath" file.

<classpathentry
kind="lib"
path="WEB-INF/lib/richfaces-api-xxx.jar"
sourcepath="jars/richfaces-api-xxx-sources.jar"/>

<classpathentry
kind="lib"
path="WEB-INF/lib/richfaces-impl-xxx.jar"
sourcepath="jars/richfaces-impl-xxx-sources.jar"/>

<classpathentry
kind="lib"
path="WEB-INF/lib/richfaces-ui-xxx.GA.jar"
sourcepath="jars/richfaces-ui-xxx-sources.jar"/>

Enjoy browsing Richfaces Source code!