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!
Reactions: 

4 comments:

Jean said...

Hi! I was trying to get the source of richfaces 3.1.2... but I could not generate the ui source...

here is the error:

"org.richfaces.cdk:maven-cdk-plugin not found in repository: Unable to download the artifact from any repository"

I realy need this source... can you help me?

If you dont know what is this error, can you sand-me the jar?

thank you =]

Jean said...

Hi! I cant get the ui source of richfaces... I get this error:


Downloading: http://repo1.maven.org/maven2/org/richfaces/cdk/maven-cdk-plugin/3.
3.0.GA/maven-cdk-plugin-3.3.0.GA.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] A required plugin was not found: Plugin could not be found - check that t
he goal name is correct: Unable to download the artifact from any repository

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=org.richfaces.cdk -DartifactId=maven-cdk-
plugin -Dversion=3.3.0.GA -Dpackaging=maven-plugin -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.richfaces.cdk -DartifactId=maven-cdk-pl
ugin -Dversion=3.3.0.GA -Dpackaging=maven-plugin -Dfile=/path/to/file -Durl=[url
] -DrepositoryId=[id]


org.richfaces.cdk:maven-cdk-plugin:maven-plugin:3.3.0.GA

from the specified remote repositories:
atlassian-m2-repository (http://repository.atlassian.com/maven2),
central (http://repo1.maven.org/maven2)

org.richfaces.cdk:maven-cdk-plugin:maven-plugin:3.3.0.GA

from the specified remote repositories:
atlassian-m2-repository (http://repository.atlassian.com/maven2),
central (http://repo1.maven.org/maven2)



Can you help-me? If you send-me the source of richfaces ui it would be very nice...

thaks

Christian said...

Hi!

I have the same problem also with source code versions 3.2.2 and 3.3.0

I just wanted to change the Datascroller implementation and build the libraries again.

Any suggestions?

Thanks a lot

Christian said...

I solved the problem :-)

I had to define the richfaces profile and active profile.

See:
http://www.jboss.org/community/docs/DOC-9919;jsessionid=F637F655AA52E5C57CAAFF5B09508716

I managed to re-build the sources and use the modified libraries.