<?xml version="1.0" encoding="UTF-8"?>
<section id="pcreate" xreflabel="pcreate">
    <?dbhtml filename="pcreate.html"?>
    <sectioninfo>
        <keywordset>
            <keyword>project</keyword>
            <keyword>component</keyword>
            <keyword>CDK</keyword>
    <keyword>Guide</keyword>
        </keywordset>
    </sectioninfo>
    <title>Creating project for component</title>
    <para>
       At first we need to create a project for the component itself. In the library directory 
        <property>Sandbox</property> you just created, launch the following command (all in one line):
    </para>
    <programlisting role="XML"><![CDATA[mvn archetype:create -DarchetypeGroupId=org.richfaces.cdk -DarchetypeArtifactId=maven-archetype-jsf-component -DarchetypeVersion=3.2.1.GA -DartifactId=inputDate]]>
    </programlisting>
    <para>
        As is easy to see a new directory with the name <property>inputDate</property> will be created. 
        It does not have any components in it yet, but it has this predefined structure:
    </para>
    <figure>
        <title>The project structure</title>
        <mediaobject> 
            <imageobject>
                <imagedata fileref="images/tree.png"/>
            </imageobject>
        </mediaobject>
    </figure>
    <para>
        Here are the main directories with descriptions:
    </para>
    <table>
        <title>The project structure</title>
        <tgroup cols="2">
            <thead>
                <row>
                    <entry>Directory</entry>
                    <entry>Description</entry>
                </row>
            </thead>
            <tbody>
                <row>
                    <entry>
                        src/main/config
                    </entry>
                    <entry>
                        Contains the metadata for the components
                    </entry>
                </row>
                <row>
                    <entry>
                        src/main/java
                    </entry>
                    <entry>
                        Contains Java code (both pre-generated and created by you)
                    </entry>
                </row>
                <row>
                    <entry>
                        src/main/resources
                    </entry>
                    <entry>
                        Used to store resource files, such as pictures, JavaScript and CSS files
                    </entry>
                </row>
                <row>
                    <entry>
                        src/main/templates
                    </entry>
                    <entry>
                        Used to contain the JSP-like templates that define the component layout
                    </entry>
                </row>
            </tbody>
        </tgroup>
    </table>
    <para>
	It is necessary to extend a predefined structure with the following directories:
    </para>
     <table>
        <title>The project structure</title>
        <tgroup cols="2">
            <thead>
                <row>
                    <entry>Directory</entry>
                    <entry>Description</entry>
                </row>
            </thead>
            <tbody>
                <row>
                    <entry>
                        src/main/config/resources
                    </entry>
                    <entry>
                        Contains the <property>resource-config.xml</property> file for the resources registration
                    </entry>
                </row>
                <row>
                    <entry>
                        src/main/java/org/mycompany/renderkit
                    </entry>
                    <entry>
                        Contains Renderer Base class
                    </entry>
                </row>
                <row>
                    <entry>
                        src/main/resources/org/mycompany/renderkit/html/css
                    </entry>
                    <entry>
                        Used to store CSS files
                    </entry>
                </row>
		<row>
                    <entry>
                        src/main/resources/org/mycompany/renderkit/html/images
                    </entry>
                    <entry>
                        Used to store images
                    </entry>
                </row>
                <row>
                    <entry>
                        src/main/templates/org/mycompany
                    </entry>
                    <entry>
                        Used to contain the JSP-like template
                    </entry>
                </row>
            </tbody>
        </tgroup>
    </table>
    
    <para>        Now you should add <property>maven-compiler-plugin</property> 
        to the <property>plugins</property> section in the <property>inputDate/pom.xml</property> file:    </para>
    <programlisting role="XML"><![CDATA[...
<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <inherited>true</inherited>
    <configuration>
        <source>1.5</source>
        <target>1.5</target>
    </configuration>
</plugin>
...]]>
    </programlisting>
    <para>        Finally your <property>inputDate/pom.xml</property> should look like this one:    </para>
    <programlisting role="XML"><![CDATA[<?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.2.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.2.1.GA</version>
        </dependency>
    </dependencies>
</project>]]>
</programlisting>
</section>

