There is a "Maven Archetype" in Trinidad which goal is to help setting up a new JSF/Trinidad project in less than one minute.

Note that the archetype is not released yet, but they will be soon... In the meanwhile, you will have to build the archetypes yourself before using them.

Note also, that you have to compile the Trinidad components on your own (see Building ADF With Maven).

The Trinidad Archetype

This archetype allows you to generate a template for a web application that uses MyFaces and Trinidad, based on the blank example application. So, creating the template of the application is as easy as executing:

mvn archetype:create -DarchetypeGroupId=org.apache.myfaces.buildtools   \
                     -DarchetypeArtifactId=myfaces-archetype-trinidad   \
                     -DarchetypeVersion=1.0                             \
                     -DgroupId=myAppId                                  \

In the future, the archetype will be located in a public repository in internet, but currently if you want to use it you have to build it from sources.

Getting and installing the plugin locally

To be able to use the archetype the first thing you should do is to checkout the Trinidad Archetype source from the svn, using the command:

svn co trinidad-archetype

Now, let's install the plugin locally (this supposes that you have maven 2.x already installed). Navigate to the plugin root folder and use the mvn install command:

cd trinidad-archetype
mvn install

At this point, you have the plugin installed in your local system. You don't have to install it again unless you want to update it.

Creating a template for a web application

Now, using maven (anywhere in your file system) you can create a template for an application that uses !Trinidad using the command:

mvn archetype:create -DarchetypeGroupId=org.apache.myfaces.buildtools   \
                     -DarchetypeArtifactId=myfaces-archetype-trinidad   \
                     -DarchetypeVersion=1.0-SNAPSHOT                    \
                     -DgroupId=myAppId                                  \

In this last command we are creating an application with groupId=myAppId and artifactId=testApp. You can change that values to adapt your needs.

Finally, if we want to test the basic application created, just run the command:

cd testApp
mvn package

And you will have your war created at testApp/target folder!

This whole process can save a lot of time while setting up a new web application. And what is better, you have already the structure to use maven :-)

Jetty plugin

The Jetty6 plugin has been added to the pom.xml of the archetype.

mvn -PjettyConfig clean jetty6:run

This will create a war, launch the Jetty container and it will server your project at http://localhost:8080/testApp

Trinidad_Archetype (last edited 2009-09-20 23:01:59 by localhost)