[weld-commits] Weld SVN: r6678 - in archetypes/javaee6-webapp/trunk: eclipse-dot-files and 2 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Sat Jul 17 02:54:05 EDT 2010


Author: dan.j.allen
Date: 2010-07-17 02:54:04 -0400 (Sat, 17 Jul 2010)
New Revision: 6678

Added:
   archetypes/javaee6-webapp/trunk/eclipse-dot-files/
   archetypes/javaee6-webapp/trunk/eclipse-dot-files/.factorypath
   archetypes/javaee6-webapp/trunk/eclipse-dot-files/.settings/
   archetypes/javaee6-webapp/trunk/eclipse-dot-files/.settings/org.eclipse.jdt.apt.core.prefs
Modified:
   archetypes/javaee6-webapp/trunk/build.sh
   archetypes/javaee6-webapp/trunk/readme.txt
   archetypes/javaee6-webapp/trunk/src/main/java/com/mycompany/MemberListProducer.java
Log:
furthur document the JPA metamodel generation
don't start with a compile dependency on the metamodel (to avoid confusion)
introduce out-of-box Eclipse settings to generate JPA metamodel


Modified: archetypes/javaee6-webapp/trunk/build.sh
===================================================================
--- archetypes/javaee6-webapp/trunk/build.sh	2010-07-17 06:53:03 UTC (rev 6677)
+++ archetypes/javaee6-webapp/trunk/build.sh	2010-07-17 06:54:04 UTC (rev 6678)
@@ -15,7 +15,8 @@
 echo Generating archetype from project into $ARCHETYPE_BUILD_DIR...
 mvn clean archetype:create-from-project -Darchetype.properties=archetype.properties
 echo Relocating generated archetype project to $ARCHETYPE_DIR...
-rsync -az --exclude `basename $0` --exclude archetype-pom.xml $ARCHETYPE_BUILD_DIR/src $ARCHETYPE_DIR/
+rsync -az --exclude `basename $0` --exclude archetype-pom.xml --exclude eclipse-dot-files $ARCHETYPE_BUILD_DIR/src $ARCHETYPE_DIR/
+rsync -az eclipse-dot-files/ $ARCHETYPE_RESOURCES_DIR/
 cp -f archetype-pom.xml $ARCHETYPE_DIR/pom.xml
 mvn -f $ARCHETYPE_DIR/pom.xml clean
 echo Patching generated archetype...
@@ -25,6 +26,7 @@
 sed -i 's;
 ;;' $ARCHETYPE_RESOURCES_DIR/readme.txt
 sed -i 's;<name>jboss-javaee6-webapp-src</name>;<name>${name}</name>;' $ARCHETYPE_RESOURCES_DIR/pom.xml
+sed -i 's;eclipse-dot-files/\?;;' $ARCHETYPE_DIR/src/main/resources/META-INF/maven/archetype-metadata.xml
 # remove local file that NetBeans add to source project
 rm -f $ARCHETYPE_RESOURCES_DIR/src/main/webapp/WEB-INF/sun-web.xml
 # could set the release version at this point, if specified

Added: archetypes/javaee6-webapp/trunk/eclipse-dot-files/.factorypath
===================================================================
--- archetypes/javaee6-webapp/trunk/eclipse-dot-files/.factorypath	                        (rev 0)
+++ archetypes/javaee6-webapp/trunk/eclipse-dot-files/.factorypath	2010-07-17 06:54:04 UTC (rev 6678)
@@ -0,0 +1,5 @@
+<factorypath>
+    <factorypathentry kind="PLUGIN" id="org.eclipse.jst.ws.annotations.core" enabled="true" runInBatchMode="false"/>
+    <factorypathentry kind="VARJAR" id="M2_REPO/org/hibernate/hibernate-jpamodelgen/1.0.0.Final/hibernate-jpamodelgen-1.0.0.Final.jar" enabled="true" runInBatchMode="false"/>
+    <factorypathentry kind="VARJAR" id="M2_REPO/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.0.Final/hibernate-jpa-2.0-api-1.0.0.Final.jar" enabled="true" runInBatchMode="false"/>
+</factorypath>

Added: archetypes/javaee6-webapp/trunk/eclipse-dot-files/.settings/org.eclipse.jdt.apt.core.prefs
===================================================================
--- archetypes/javaee6-webapp/trunk/eclipse-dot-files/.settings/org.eclipse.jdt.apt.core.prefs	                        (rev 0)
+++ archetypes/javaee6-webapp/trunk/eclipse-dot-files/.settings/org.eclipse.jdt.apt.core.prefs	2010-07-17 06:54:04 UTC (rev 6678)
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.apt.aptEnabled=false
+org.eclipse.jdt.apt.genSrcDir=target/generated-sources/annotations
+org.eclipse.jdt.apt.reconcileEnabled=true

Modified: archetypes/javaee6-webapp/trunk/readme.txt
===================================================================
--- archetypes/javaee6-webapp/trunk/readme.txt	2010-07-17 06:53:03 UTC (rev 6677)
+++ archetypes/javaee6-webapp/trunk/readme.txt	2010-07-17 06:54:04 UTC (rev 6678)
@@ -19,7 +19,7 @@
 
  All you need to run this project is Java 5.0 (Java SDK 1.5) or greator and
  Maven 2.0.10 or greater. This application is setup to be run on a Java EE 6
- application server. We've tested it on GlassFish 3 and JBoss AS 6.0.
+ application server. We've tested it on GlassFish 3.0.1 and JBoss AS 6.0.0.M3.
 
  Please note that Maven 2 project needs to use the JBoss Nexus Maven repository
  because there are certain Java EE API JARs that are not yet publised to the
@@ -66,8 +66,12 @@
   mvn package jboss:hard-deploy
 
  This will deploy two artifacts, target/jboss-javaee6-webapp-src.war and
- default-ds.xml. The latter installs a data source named jdbc/__default,
- so both JBoss AS and GlassFish have a data source with the same name.
+ default-ds.xml.
+ 
+ NOTE:
+ If you deploy the WAR manually, don't forget to also deploy default-ds.xml!
+ The default-ds.xml file installs a data source named jdbc/__default, so both
+ JBoss AS and GlassFish have a data source with the same name.
 
  You can also set jboss.home on the commandline:
 
@@ -75,12 +79,8 @@
 
  Start JBoss AS. The application will be running at the following URL:
 
-  http://localhost:8080/jboss-javaee6-webapp-src/home.jsf
+  http://localhost:8080/jboss-javaee6-webapp-src/
 
- Note: If you are using JBoss AS 6.0.0.M3, you may encounter the exception
- described in https://jira.jboss.org/browse/WELD-448 if you attempt to access
- to root context path (i.e., /).
-  
  To undeploy from JBoss AS, run this command:
 
   mvn jboss:hard-undeploy
@@ -153,15 +153,22 @@
  Select File > Import... and select "Existing Maven Projects" and navigate to
  your project directory. Click Finish and m2eclipse will take it from there.
 
- Once in the IDE, you can execute the Maven commands through the IDE controls
- to deploy the application to a container.
+ Additional configuration is required to get Eclipse to generate the JPA
+ metamodel. The archetype includes the necessary Eclipse config files in your project.
+ To enable this feature, right click on the project and select:
 
- NOTE: If the project shows a compile error after import, it's likely that the
- generated sources are not on the Eclipse project classpath. Right click the
- project and select:
+ Properties > Java Compiler > Annotation Processing
 
- Maven > Update Project Configuration
+ Check "Enable annotation processing" then click OK and OK again when your are
+ prompted to run a project build.
 
+ You can verify your configuration by referring to the Hibernate JPA documentation.
+
+ http://docs.jboss.org/hibernate/stable/jpamodelgen/reference/en-US/html_single/#d0e319
+
+ Once the project is imported into the IDE, you can execute the Maven commands
+ through the IDE controls to deploy the application to a container.
+
  Downloading the sources and Javadocs
  ====================================
 

Modified: archetypes/javaee6-webapp/trunk/src/main/java/com/mycompany/MemberListProducer.java
===================================================================
--- archetypes/javaee6-webapp/trunk/src/main/java/com/mycompany/MemberListProducer.java	2010-07-17 06:53:03 UTC (rev 6677)
+++ archetypes/javaee6-webapp/trunk/src/main/java/com/mycompany/MemberListProducer.java	2010-07-17 06:54:04 UTC (rev 6678)
@@ -40,8 +40,9 @@
    {
       CriteriaBuilder cb = em.getCriteriaBuilder();
       CriteriaQuery<Member> criteria = cb.createQuery(Member.class);
-      Root<Member> widget = criteria.from(Member.class);
-      criteria.select(widget).orderBy(cb.asc(widget.get(Member_.name)));
+      Root<Member> member = criteria.from(Member.class);
+      // replace "name" with Member_.name if the JPA metamodel has been generated
+      criteria.select(member).orderBy(cb.asc(member.get("name")));
       members = em.createQuery(criteria).getResultList();
    }
 }



More information about the weld-commits mailing list