Create new RichFaces Documentation Jira issue

This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.orgCommunity Documentation

4.1. Creating project for component

At first we need to create a project for the component itself. In the library directory Sandbox you just created, launch the following command (all in one line):


mvn archetype:create -DarchetypeGroupId=org.richfaces.cdk -DarchetypeArtifactId=maven-archetype-jsf-component -DarchetypeVersion=3.3.1.GA -DartifactId=inputDate
    

As is easy to see a new directory with the name inputDate will be created. It does not have any components in it yet, but it has this predefined structure:

The project structure

Figure 4.1. The project structure


Here are the main directories with descriptions:

Table 4.1. The project structure

DirectoryDescription
src/main/config Contains the metadata for the components
src/main/java Contains Java code (both pre-generated and created by you)
src/main/resources Used to store resource files, such as pictures, JavaScript and CSS files
src/main/templates Used to contain the JSP-like templates that define the component layout

It is necessary to extend a predefined structure with the following directories:

Table 4.2. The project structure

DirectoryDescription
src/main/config/resources Contains the resource-config.xml file for the resources registration
src/main/java/org/mycompany/renderkit Contains Renderer Base class
src/main/resources/org/mycompany/renderkit/html/css Used to store CSS files
src/main/resources/org/mycompany/renderkit/html/images Used to store images
src/main/templates/org/mycompany Used to contain the JSP-like template

Now you should add maven-compiler-plugin to the plugins section in the inputDate/pom.xml file:


...
<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <inherited>true</inherited>
    <configuration>
        <source>1.5</source>
        <target>1.5</target>
    </configuration>
</plugin>
...
    

Finally your inputDate/pom.xml should look like this one:


<?xml version="1.0"?>
<project>
    <parent>
        <artifactId>sandbox</artifactId>
        <groupId>org.mycompany</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.mycompany</groupId>
    <artifactId>inputDate</artifactId>
    <name>inputDate</name>
    <version>1.0-SNAPSHOT</version>
    <build>
        <plugins>
            <plugin>
                <groupId>org.richfaces.cdk</groupId>
                <artifactId>maven-cdk-plugin</artifactId>
                <version>3.3.1.GA</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>    
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <library>
                        <prefix>org.mycompany</prefix>
                        <taglib>
                            <shortName>inputDate</shortName>
                        </taglib>
                    </library>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <inherited>true</inherited>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.richfaces.framework</groupId>
            <artifactId>richfaces-impl</artifactId>
            <version>3.3.1.GA</version>
        </dependency>
    </dependencies>
</project>