Skip to main content

Source code browse

Revision: 12556

Fix PMD warning
» Project Revision History

» Checkout URL

svn / trunk / jsf-archetype

FilenameAuthorRevisionModifiedLog Entry
edburns 9007 over 5 years ago archetype updates
edburns 11832 over 3 years ago SECTION: Modified Files -------...
edburns 9347 about 5 years ago Maven archetype for use with emb...
edburns 9031 over 5 years ago archetype for jsf-test htmlunit ...
edburns 9293 about 5 years ago archetype maintenance
edburns 9005 over 5 years ago We need more than one archetype,...
JSF Maven archetype Document
Sheetal Vartak 3/17/2011

I have created a new Maven archetype for JSF that contains the following :
* a web project skeleton with a dependency on Java EE
* a minimal JSF application to use as a starting point

Archetype contents
The JSF archetype is made up of:
* an  archetype descriptor(archetype.xml in directory: src/main/resources/META-INF/maven/). It lists all the files that will be contained in the archetype and categorizes them so they can be processed correctly by the archetype generation mechanism.
* the prototype files that are copied by the archetype plugin (directory: src/main/resources/archetype-resources/)
* the prototype pom (pom.xml in: src/main/resources/archetype-resources)
* a pom for the archetype (pom.xml in the archetype's root directory).The config files listed above get auto generated via the  maven command : create-from-project.Creating the JSF archetype. For the JSF archetype creation, I followed the following steps:
1> create a dir jsf-archetype
2> cd jsf-archetype
Create a hierarchy as follows :

3> Run "mvn  install" from under jsf-archetype/. This installs the archetype in the local maven repository.
4> Now,  Now that the archetype has been created and installed, you can try it on your local system by using the following commands. First create a new dir for the new project from this archetype. mkdir create-project-from-archetype.
5> mkdir create-project-from-archetype
   cd create-project-from-archetype/
6> mvn archetype:generate -DarchetypeCatalog=local


after deploying the archetype to a remote repo via "mvn deploy", run the following.
In this command, you need to specify the full information about the archetype you want to use (its groupId, its artifactId, its version) and the information about the new project you want to create (artifactId and groupId).
mvn archetype:generate -DarchetypeGroupId=com.sun.faces
-DarchetypeArtifactId=simple-jsf -DarchetypeVersion=1.0 -DgroupId=simple-jsf
-DartifactId=simple-jsf -DarchetypeRepository=local
The project that I created off of the archetype could be easily built and deployed to GF.
7> Next I tried the following to make sure that the war created gets deployed on GF.
cd create-project-from-archetype/<new-dir-created>
mvn clean install .. This creates the jsf-simple-1.0.war
8> Deploy the war via asadmin deploy jsf-simple-1.0.war
9> Access http://localhost:8080/jsf-sample-1.0/faces/simpleCompositeComponentUsingPage.xhtml

I have added some ant targets to do what is stated above.
Please run "ant make-archetype" to perform step 3 and 4.

To deploy the archetype to the maven repo (, run "ant deploy-archetype".

Alternatively, you can make modifications similar to the following to
the generated pom.xml and simply run mvn deploy in the
target/generated-sources/archetype directory.

bash-2.05b$ diff -u pom.xml ~/Documents/chaff/pom-generated-from-project.xml
--- pom.xml	Wed May  4 11:51:26 2011
+++ /home/ejburns/Documents/chaff/pom-generated-from-project.xml	Wed May  4 11:49:40 2011
@@ -16,6 +16,11 @@
+            <extension>
+                <groupId>org.jvnet.wagon-svn</groupId>
+                <artifactId>wagon-svn</artifactId>
+                <version>1.8</version>
+            </extension>
@@ -26,5 +31,24 @@
+    <distributionManagement>
+      <repository>
+        <uniqueVersion>false</uniqueVersion>
+        <id></id>
+        <url>svn:</url> 
+      </repository>
+    </distributionManagement>
+    <repositories>
+        <repository>
+            <id></id>
+            <name> Repository for Maven</name>
+            <url></url>
+            <layout>default</layout>
+        </repository>
+    </repositories>

This assumes that your ~/.m2/settings.xml file has the following

        <username>your userid</username>
        <password>your password</password>


Please Confirm