Search code examples
javaeclipsejsfmavenrichfaces

Adding Richfaces to Maven based project


Good evening,

Currently I'm trying to add Richfaces to a Maven based project in Eclipse. However, when I deploy my application (Glassfish) I get the following warnings in my browser:

Warning: This page calls for XML namespace h++p://richfaces.org/rich declared with prefix rich but no taglibrary exists for that namespace.

Additionally, I get no error messages in my console.

In Netbeans, I had the same problem when trying Richfaces the first time. However, I was able to solve this by doing Right-click on the Dependencies folder in my web project, and then selecting Download Declared Dependencies. However, I don't have this option in Eclipse.

The project in Eclipse uses JSF 2.1 (Apache MyFaces 2.1.5). The dependencies were added as follows:

    <dependency>
        <groupId>org.richfaces.ui</groupId>
        <artifactId>richfaces-components-api</artifactId>
        <version>4.2.2.Final</version>
    </dependency>
    <dependency>
        <groupId>org.richfaces.ui</groupId>
        <artifactId>richfaces-components-ui</artifactId>
        <version>4.2.2.Final</version>
    </dependency>
    <dependency>
        <groupId>org.richfaces.core</groupId>
        <artifactId>richfaces-core-api</artifactId>
        <version>4.2.2.Final</version>
    </dependency>
    <dependency>
        <groupId>org.richfaces.core</groupId>
        <artifactId>richfaces-core-impl</artifactId>
        <version>4.2.2.Final</version>
    </dependency>

Although this code worked fine in Netbeans I also tried following the advice on:

https://community.jboss.org/wiki/HowToAddRichFaces4xToMavenBasedProject https://community.jboss.org/wiki/MavenGettingStarted-Users

However, the problem persisted. Any ideas why this is happening?


Solution

  • This looks as though Maven hasn't downloaded the dependencies into its local repo. The easiest way to do this in eclipse is to use the m2e plugin. Once installed, right click on your project and select;

    Run As > Maven Clean

    which attempts to clean a project's working directory of the files that we're generated at build-time. You can read about it here: http://maven.apache.org/plugins/maven-clean-plugin/

    The again do right click on your project and select:

    Run As > Maven Install

    which is used to add artifact(s) to your local repository. You can read about it here: http://maven.apache.org/plugins/maven-install-plugin/

    Try deploying that to your server, and it should'nt moan about missing dependencies. Also I suggest once you're happy with the concepts of maven, to get familiar with using it from the command line. Good luck!