Chapter 9. Creating a New plug 'n' skin

The plug 'n' skin feature is a powerful way to create, customize, and deploy new skins for the RichFaces framework.

In this chapter, we'll learn how to create a new skin, edit it, and build it in order to have it ready to be deployed in our project.

In order to use the plug 'n' skin feature, we are going to use Apache Maven for the template creation and compiling. This is very useful, as we don't have to worry about dependencies and versioning that are completely managed by the Apache technology.

Installing Maven

If you haven't installed it yet, you'll need to download and install Maven before starting. In order to do that, visit the Maven website (http://maven.apache.org), download the latest version, and follow the instructions to complete the installation.

After that, we have to add the RichFaces profile to that of Maven. Let's open the<maven_root_directory>/conf/settings.xml file and add the following code into the<profiles> section:

<profile>
<id>RichFaces</id>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
<id>repository.jboss.com</id>
<name>Jboss Repository for Maven</name>
<url>
http://repository.jboss.com/maven2/
</url>
<layout>default</layout>
</repository>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<id>maven2-snapshots.jboss.com</id>
<name>Jboss Repository for Maven Snapshots</name>
<url>http://snapshots.jboss.org/maven2</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven2-snapshots.jboss.com</id>
<name>Jboss Repository for Maven Snapshots</name>
<url>http://snapshots.jboss.org/maven2</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
<pluginRepository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
<id>repository.jboss.com</id>
<name>Jboss Repository for Maven</name>
<url>
http://repository.jboss.com/maven2/
</url>
<layout>default</layout>
</pluginRepository>
</pluginRepositories>
</profile>

Now we have to activate the new profile. In order to do so, let's move to the bottom of the file, uncomment the<activeProfiles> section, and add the new profile. The section must appear as follows:

<!-- activeProfiles
| List of profiles that are active for all builds.
| -->
<activeProfiles>
<activeProfile>RichFaces</activeProfile>
</activeProfiles>

Let's save the file and we're done with the Maven configuration!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.184.90