MYFACES-2295 Add debug maven profile for myfaces archetypes when using jetty
diff --git a/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/META-INF/archetype.xml b/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/META-INF/archetype.xml
index dea5438..5196f55 100644
--- a/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/META-INF/archetype.xml
+++ b/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/META-INF/archetype.xml
@@ -22,8 +22,11 @@
 

 <archetype>

   <id>myfaces-archetype-trinidad</id>

+  <sources>

+    <source>src/main/java/HelloWorldBacking.java</source>

+  </sources>

   <resources>

-    <resource>src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java</resource>

+    <resource>src/main/log4j/log4j.properties</resource>

     <resource>src/main/webapp/index.jspx</resource>

     <resource>src/main/webapp/page2.jspx</resource>

     <resource>src/main/webapp/WEB-INF/web.xml</resource>

diff --git a/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/pom.xml b/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/pom.xml
index 1135f7e..50e6d79 100644
--- a/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/pom.xml
+++ b/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/pom.xml
@@ -21,102 +21,175 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

-  <modelVersion>4.0.0</modelVersion>

-  <groupId>${groupId}</groupId>

-  <artifactId>${artifactId}</artifactId>

-  <packaging>war</packaging>

-  <version>${version}</version>

-  <name>A custom project using myfaces</name>

-  <url>http://www.myorganization.org</url>

+    <modelVersion>4.0.0</modelVersion>

+    <groupId>${groupId}</groupId>

+    <artifactId>${artifactId}</artifactId>

+    <packaging>war</packaging>

+    <version>${version}</version>

+    <name>A custom project using myfaces</name>

+    <url>http://www.myorganization.org</url>

 

-  <build>

+    <properties>

+        <jsf-myfaces.version>1.2.7</jsf-myfaces.version>

+        <jsf-ri.version>1.2_13</jsf-ri.version>

+        <trinidad.version>1.2.11</trinidad.version>        

+        <maven.jetty.plugin.version>6.1.16</maven.jetty.plugin.version>

+        <log4j.version>1.2.13</log4j.version>

+    </properties>

+    

+    <build>

         <finalName>${artifactId}</finalName>

         <plugins>

             <plugin>

                 <!--This plugin allows to run the example using mvn jetty:run -->

                 <groupId>org.mortbay.jetty</groupId>

                 <artifactId>maven-jetty-plugin</artifactId>

-                <version>6.1.8</version>

+                <version>${maven.jetty.plugin.version}</version>

                 <configuration>

                     <scanIntervalSeconds>10</scanIntervalSeconds>

                 </configuration>

             </plugin>

         </plugins>    

-  </build>

+    </build>

+    

+    <profiles>

+        <profile>

+            <id>myfaces</id>

+            <activation>

+                <property>

+                    <name>!jsf</name>

+                </property>

+            </activation>

+            <dependencies>

+                <dependency>

+                    <groupId>org.apache.myfaces.core</groupId>

+                    <artifactId>myfaces-api</artifactId>

+                    <version>${jsf-myfaces.version}</version>

+                    <scope>compile</scope>

+                </dependency>

+                <dependency>

+                    <groupId>org.apache.myfaces.core</groupId>

+                    <artifactId>myfaces-impl</artifactId>

+                    <version>${jsf-myfaces.version}</version>

+                    <scope>compile</scope>

+                </dependency>

+            </dependencies>

+        </profile>

+        <profile>

+            <!-- Active adding -Djsf=ri when execute maven goals. -->

+            <id>jsf-ri</id>

+            <activation>

+                <property>

+                    <name>jsf</name>

+                    <value>ri</value>

+                </property>

+            </activation>

+            <dependencies>

+                <dependency>

+                    <groupId>javax.faces</groupId>

+                    <artifactId>jsf-api</artifactId>

+                    <version>${jsf-ri.version}</version>

+                </dependency>

+                <dependency>

+                    <groupId>javax.faces</groupId>

+                    <artifactId>jsf-impl</artifactId>

+                    <version>${jsf-ri.version}</version>

+                </dependency>

+            </dependencies>

+        </profile>

+        

+        <profile>

+            <!-- Debug profile for myfaces and jetty.

+                It allows to see debug messages using -PjettyConfig -->

+            <id>jettyConfig</id>

+            <build>

+                <resources>

+                    <resource>

+                        <directory>src/main/resources</directory>

+                    </resource>

+                    <resource>

+                        <directory>src/main/log4j</directory>

+                    </resource>

+                </resources>

+                <plugins>

+                    <plugin>

+                        <!--This plugin allows to run the example using mvn jetty:run -->

+                        <groupId>org.mortbay.jetty</groupId>

+                        <artifactId>maven-jetty-plugin</artifactId>

+                        <version>${maven.jetty.plugin.version}</version>

+                        <configuration>

+                            <scanIntervalSeconds>10</scanIntervalSeconds>

+                            <systemProperties>

+                                <systemProperty>

+                                    <name>org.apache.commons.logging.Log</name>

+                                    <value>org.apache.commons.logging.impl.Log4JLogger</value>

+                                </systemProperty>

+                            </systemProperties>

+                        </configuration>

+                    </plugin>

+                </plugins>

+            </build>

+            <dependencies>

+                <dependency>

+                    <groupId>log4j</groupId>

+                    <artifactId>log4j</artifactId>

+                    <version>${log4j.version}</version>

+                    <type>jar</type>

+                </dependency>

+            </dependencies>

+        </profile>

+    </profiles>

 

-  <repositories>

-    <repository>

-      <releases>

-        <enabled>true</enabled>

-      </releases>

-      <snapshots>

-        <enabled>true</enabled>

-      </snapshots>

-      <id>apache-maven-snapshots</id>

-      <url>http://people.apache.org/repo/m2-incubating-repository/</url>

-    </repository>

-    <repository>

-      <id>java.net</id>

-      <url>http://download.java.net/maven/1</url>

-      <layout>legacy</layout>

-    </repository>    

-  </repositories>

+    <repositories>

+        <repository>

+            <releases>

+                <enabled>false</enabled>

+            </releases>

+            <snapshots>

+                <enabled>true</enabled>

+            </snapshots>

+            <id>apache-maven-snapshots</id>

+            <url>http://people.apache.org/repo/m2-snapshot-repository</url>

+        </repository>

+        <repository>

+            <id>java.net</id>

+            <url>http://download.java.net/maven/1</url>

+            <layout>legacy</layout>

+        </repository>

+    </repositories>

 

-  <!-- Project dependencies -->

-  <dependencies>

-    <dependency>

-      <groupId>org.apache.myfaces.core</groupId>

-      <artifactId>myfaces-api</artifactId>

-      <version>${myfaces.version}</version>

-      <scope>compile</scope>

-    </dependency>

-

-    <dependency>

-      <groupId>org.apache.myfaces.core</groupId>

-      <artifactId>myfaces-impl</artifactId>

-      <version>${myfaces.version}</version>

-      <scope>compile</scope>

-      <exclusions>

-        <exclusion>

-          <!-- Temporal fix to avoid transitive dependency to shared -->

-          <groupId>org.apache.myfaces.shared</groupId>

-          <artifactId>myfaces-shared-impl</artifactId>

-        </exclusion>

-      </exclusions>

-    </dependency>

-

-    <!-- Apache Trinidad -->

-    <dependency>

-      <groupId>org.apache.myfaces.trinidad</groupId>

-      <artifactId>trinidad-api</artifactId>

-      <version>${trinidad.version}</version>

-      <scope>compile</scope>

-    </dependency>

-

-    <dependency>

-      <groupId>org.apache.myfaces.trinidad</groupId>

-      <artifactId>trinidad-impl</artifactId>

-      <version>${trinidad.version}</version>

-      <scope>compile</scope>

-    </dependency>

-    <dependency>

-    	<groupId>javax.servlet</groupId>

-    	<artifactId>jstl</artifactId>

-    	<version>1.2</version>

-    	<scope>runtime</scope>

-    </dependency>

-    <dependency>

-      <groupId>junit</groupId>

-      <artifactId>junit</artifactId>

-      <version>4.0</version>

-      <scope>test</scope>

-    </dependency>

-

-  </dependencies>

-

-  <properties>

-    <trinidad.version>1.2.10</trinidad.version>

-    <myfaces.version>1.2.5</myfaces.version>

-  </properties>

+    <!-- Project dependencies -->

+    <dependencies>

+        

+        <!-- Apache Trinidad -->

+        <dependency>

+            <groupId>org.apache.myfaces.trinidad</groupId>

+            <artifactId>trinidad-api</artifactId>

+            <version>${trinidad.version}</version>

+            <scope>compile</scope>

+        </dependency>

+        

+        <dependency>

+            <groupId>org.apache.myfaces.trinidad</groupId>

+            <artifactId>trinidad-impl</artifactId>

+            <version>${trinidad.version}</version>

+            <scope>compile</scope>

+        </dependency>

+        

+        <dependency>

+        	<groupId>javax.servlet</groupId>

+        	<artifactId>jstl</artifactId>

+        	<version>1.2</version>

+        	<scope>runtime</scope>

+        </dependency>

+        

+        <dependency>

+            <groupId>junit</groupId>

+            <artifactId>junit</artifactId>

+            <version>4.0</version>

+            <scope>test</scope>

+        </dependency>

+        

+    </dependencies>

 

 </project>

diff --git a/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java b/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/java/HelloWorldBacking.java
similarity index 97%
rename from maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java
rename to maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/java/HelloWorldBacking.java
index 4d0ed6d..a56bc17 100644
--- a/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java
+++ b/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/java/HelloWorldBacking.java
@@ -16,7 +16,7 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.myfaces.trinidad.blank;
+package $package;
 
 import javax.faces.context.FacesContext;
 
diff --git a/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/log4j/log4j.properties b/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/log4j/log4j.properties
new file mode 100644
index 0000000..78352e4
--- /dev/null
+++ b/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/log4j/log4j.properties
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+log4j.rootLogger=INFO, A1, A2
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+
+#log on a file on target too, to make easier check it
+log4j.appender.A2=org.apache.log4j.RollingFileAppender
+log4j.appender.A2.File=target/log4j.log
+log4j.appender.A2.MaxFileSize=1000KB
+# Keep one backup file
+log4j.appender.A2.MaxBackupIndex=1
+log4j.appender.A2.layout=org.apache.log4j.PatternLayout
+log4j.appender.A2.layout.ConversionPattern=%p %t %c - %m%n
+
+# Log level for myfaces libraries
+log4j.logger.org.apache.commons=INFO
+log4j.logger.org.apache.myfaces=TRACE
+log4j.logger.javax.faces=TRACE
+
+# Print the date in ISO 8601 format
+log4j.appender.A1.layout.ConversionPattern=%5p [%t] (%F\:%L) - %m%n
\ No newline at end of file
diff --git a/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/faces-config.xml b/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/faces-config.xml
index e5ecb66..1ebe6e1 100644
--- a/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/faces-config.xml
+++ b/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/faces-config.xml
@@ -34,12 +34,8 @@
   <!-- Global preferences object that proxies to others -->

   <managed-bean>

     <managed-bean-name>helloWorldBacking</managed-bean-name>

-    <managed-bean-class>

-       org.apache.myfaces.trinidad.blank.HelloWorldBacking

-    </managed-bean-class>

-    <managed-bean-scope>

-       request

-    </managed-bean-scope>

+    <managed-bean-class>${package}.HelloWorldBacking</managed-bean-class>

+    <managed-bean-scope>request</managed-bean-scope>

   </managed-bean>

 

   <!-- navigation rules for index.jspx -->