Differences between revisions 13 and 14
Revision 13 as of 2009-01-15 23:26:31
Size: 3507
Comment:
Revision 14 as of 2009-09-20 23:01:59
Size: 3509
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
There is a [http://maven.apache.org/guides/introduction/introduction-to-archetypes.html "Maven Archetype"] in Trinidad which goal is to help setting up a new JSF/Trinidad project in less than one minute. There is a [[http://maven.apache.org/guides/introduction/introduction-to-archetypes.html|"Maven Archetype"]] in Trinidad which goal is to help setting up a new JSF/Trinidad project in less than one minute.
Line 10: Line 10:
Note also, that you have to compile the Trinidad components on your own (see ["Building ADF With Maven"]). Note also, that you have to compile the Trinidad components on your own (see [[Building ADF With Maven]]).

Archetype

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

  • Trinidad Archetype: this archetype creates the basic structure for a project that will use Trinidad. It includes all the dependencies needed so you don't have to find them out. The best way to start a new web application.

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                                  \
                     -DartifactId=testApp

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 http://svn.apache.org/repos/asf/myfaces/myfaces-build-tools/trunk/maven2-archetypes/myfaces-archetype-trinidad/ 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                                  \
                     -DartifactId=testApp

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)