From 905d9824b012ee6eceb8305cd15d521c3b4d1956 Mon Sep 17 00:00:00 2001
From: Costin Leau <cleau@vmware.com>
Date: Thu, 17 Dec 2009 17:34:12 +0000
Subject: [PATCH] + improved war structure

---
 .settings/org.eclipse.wst.common.component    | 20 +++----
 pom.xml                                       | 53 +++++++++++--------
 .../classes => resources}/META-INF/aop.xml    |  0
 .../META-INF/jpa-persistence.xml              |  0
 .../classes => resources}/META-INF/orm.xml    |  0
 .../webapp/WEB-INF/classes/log4j.properties   | 18 -------
 .../WEB-INF/classes/messages.properties       |  8 ---
 .../WEB-INF/classes/messages_de.properties    |  8 ---
 .../WEB-INF/classes/messages_en.properties    |  1 -
 src/main/webapp/WEB-INF/web.xml               |  6 ++-
 .../petclinic/jpa/AbstractJpaClinicTests.java |  3 +-
 11 files changed, 45 insertions(+), 72 deletions(-)
 rename src/main/{webapp/WEB-INF/classes => resources}/META-INF/aop.xml (100%)
 rename src/main/{webapp/WEB-INF/classes => resources}/META-INF/jpa-persistence.xml (100%)
 rename src/main/{webapp/WEB-INF/classes => resources}/META-INF/orm.xml (100%)
 delete mode 100644 src/main/webapp/WEB-INF/classes/log4j.properties
 delete mode 100644 src/main/webapp/WEB-INF/classes/messages.properties
 delete mode 100644 src/main/webapp/WEB-INF/classes/messages_de.properties
 delete mode 100644 src/main/webapp/WEB-INF/classes/messages_en.properties

diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index 89d4f2a..429be37 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-modules id="moduleCoreId" project-version="1.5.0">
-	<wb-module deploy-name="org.springframework.samples.petclinic">
-		<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
-		<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
-		<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
-		<property name="java-output-path" value="target/classes"/>
-		<property name="context-root" value="petclinic"/>
-	</wb-module>
-</project-modules>
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+	<wb-module deploy-name="org.springframework.samples.petclinic">
+		<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
+		<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
+		<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
+		<property name="java-output-path" value="target/classes"/>
+		<property name="context-root" value="petclinic"/>
+	</wb-module>
+</project-modules>
diff --git a/pom.xml b/pom.xml
index e7da6cc..6bce6af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,32 +28,30 @@
 		</dependency>
 		<dependency>
 			<groupId>org.springframework</groupId>
-			<artifactId>org.springframework.orm</artifactId>
+			<artifactId>org.springframework.aspects</artifactId>
 			<version>${spring.version}</version>
 		</dependency>
+		<dependency>
+			<groupId>org.aspectj</groupId>
+			<artifactId>com.springsource.org.aspectj.weaver</artifactId>
+			<version>1.6.5.RELEASE</version>
+		</dependency>		
 		<dependency>
 			<groupId>org.springframework</groupId>
-			<artifactId>org.springframework.oxm</artifactId>
+			<artifactId>org.springframework.orm</artifactId>
 			<version>${spring.version}</version>
 		</dependency>
 		<dependency>
 			<groupId>org.springframework</groupId>
-			<artifactId>org.springframework.web.servlet</artifactId>
+			<artifactId>org.springframework.oxm</artifactId>
 			<version>${spring.version}</version>
 		</dependency>
-		
-		<!-- AspectJ -->
 		<dependency>
 			<groupId>org.springframework</groupId>
-			<artifactId>org.springframework.aspects</artifactId>
+			<artifactId>org.springframework.web.servlet</artifactId>
 			<version>${spring.version}</version>
 		</dependency>
-		<dependency>
-			<groupId>org.aspectj</groupId>
-			<artifactId>com.springsource.org.aspectj.weaver</artifactId>
-			<version>1.6.5.RELEASE</version>
-		</dependency>
-				
+		
 		<!-- Logging -->
         <dependency>
             <groupId>org.slf4j</groupId>
@@ -131,13 +129,6 @@
 			<artifactId>com.springsource.org.apache.openjpa</artifactId>
 			<version>1.1.0</version>
 			<scope>runtime</scope>
-			<exclusions>
-				<!-- Exclude Commons Logging in favor of SLF4j (see 'Logging' Dependency Config below) -->
-				<exclusion>
-					<groupId>org.apache.commons.logging</groupId>
-					<artifactId>com.springsource.org.apache.commons.logging</artifactId>
-		         </exclusion>
-			</exclusions>			
 		</dependency>
 
 		<!-- Servlet -->
@@ -208,22 +199,22 @@
 	<repositories>
 		<repository>
 			<id>com.springsource.repository.bundles.release</id>
-			<name>EBR Spring Releases</name>
+			<name>SpringSource Enterprise Bundle Repository - SpringSource Releases</name>
 			<url>http://repository.springsource.com/maven/bundles/release</url>
 		</repository>
 		<repository>
 			<id>com.springsource.repository.bundles.external</id>
-			<name>EBR External Releases</name>
+			<name>SpringSource Enterprise Bundle Repository - External Releases</name>
 			<url>http://repository.springsource.com/maven/bundles/external</url>
 		</repository>
 		<repository>
 			<id>com.springsource.repository.bundles.milestone</id>
-			<name>EBR Spring Milestones</name>
+			<name>SpringSource Enterprise Bundle Repository - SpringSource Milestones</name>
 			<url>http://repository.springsource.com/maven/bundles/milestone</url>
 		</repository>
 		<repository>
 			<id>com.springsource.repository.bundles.snapshot</id>
-			<name>EBR Spring Snapshots</name>
+			<name>SpringSource Enterprise Bundle Repository - Snapshot Releases</name>
 			<url>http://repository.springsource.com/maven/bundles/snapshot</url>
 		</repository>
 	</repositories>
@@ -239,6 +230,22 @@
 					<showWarnings>true</showWarnings>
 				</configuration>
 			</plugin>
+            <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-surefire-plugin</artifactId>
+              <configuration>
+                <includes>
+                  <include>**/*Tests.java</include>
+                </includes>
+              </configuration>
+            </plugin>
+            <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-war-plugin</artifactId>
+              <configuration>
+                <warName>petclinic</warName>
+                </configuration>
+            </plugin>
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-dependency-plugin</artifactId>
diff --git a/src/main/webapp/WEB-INF/classes/META-INF/aop.xml b/src/main/resources/META-INF/aop.xml
similarity index 100%
rename from src/main/webapp/WEB-INF/classes/META-INF/aop.xml
rename to src/main/resources/META-INF/aop.xml
diff --git a/src/main/webapp/WEB-INF/classes/META-INF/jpa-persistence.xml b/src/main/resources/META-INF/jpa-persistence.xml
similarity index 100%
rename from src/main/webapp/WEB-INF/classes/META-INF/jpa-persistence.xml
rename to src/main/resources/META-INF/jpa-persistence.xml
diff --git a/src/main/webapp/WEB-INF/classes/META-INF/orm.xml b/src/main/resources/META-INF/orm.xml
similarity index 100%
rename from src/main/webapp/WEB-INF/classes/META-INF/orm.xml
rename to src/main/resources/META-INF/orm.xml
diff --git a/src/main/webapp/WEB-INF/classes/log4j.properties b/src/main/webapp/WEB-INF/classes/log4j.properties
deleted file mode 100644
index ebee551..0000000
--- a/src/main/webapp/WEB-INF/classes/log4j.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# For JBoss: Avoid to setup Log4J outside $JBOSS_HOME/server/default/deploy/log4j.xml!
-# For all other servers: Comment out the Log4J listener in web.xml to activate Log4J.
-log4j.rootLogger=INFO, stdout, logfile
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
-
-log4j.appender.logfile=org.apache.log4j.RollingFileAppender
-log4j.appender.logfile.File=${petclinic.root}/WEB-INF/petclinic.log
-log4j.appender.logfile.MaxFileSize=512KB
-# Keep three backup files.
-log4j.appender.logfile.MaxBackupIndex=3
-# Pattern to output: date priority [category] - message
-log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
-log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n
-
-log4j.logger.org.springframework.samples.petclinic.aspects=DEBUG
diff --git a/src/main/webapp/WEB-INF/classes/messages.properties b/src/main/webapp/WEB-INF/classes/messages.properties
deleted file mode 100644
index 173417a..0000000
--- a/src/main/webapp/WEB-INF/classes/messages.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-welcome=Welcome
-required=is required
-notFound=has not been found
-duplicate=is already in use
-nonNumeric=must be all numeric
-duplicateFormSubmission=Duplicate form submission is not allowed
-typeMismatch.date=invalid date
-typeMismatch.birthDate=invalid date
diff --git a/src/main/webapp/WEB-INF/classes/messages_de.properties b/src/main/webapp/WEB-INF/classes/messages_de.properties
deleted file mode 100644
index 124bee4..0000000
--- a/src/main/webapp/WEB-INF/classes/messages_de.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-welcome=Willkommen
-required=muss angegeben werden
-notFound=wurde nicht gefunden
-duplicate=ist bereits vergeben
-nonNumeric=darf nur numerisch sein
-duplicateFormSubmission=Wiederholtes Absenden des Formulars ist nicht erlaubt
-typeMismatch.date=ungültiges Datum
-typeMismatch.birthDate=ungültiges Datum
diff --git a/src/main/webapp/WEB-INF/classes/messages_en.properties b/src/main/webapp/WEB-INF/classes/messages_en.properties
deleted file mode 100644
index 05d519b..0000000
--- a/src/main/webapp/WEB-INF/classes/messages_en.properties
+++ /dev/null
@@ -1 +0,0 @@
-# This file is intentionally empty. Message look-ups will fall back to the default "messages.properties" file.
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index b4af822..4d7a09a 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -45,8 +45,10 @@
 
 		<!--
 			To use the JPA variant above, you will need to enable Spring load-time
-			weaving in your server environment. See PetClinic's readme and/or
-			Spring's JPA documentation for information on how to do this.
+			weaving in your server environment. Out of the box, Spring will try to
+			detect the running environment and use the appropriate weaver but if that
+			fails, one must enable one by hand or use the VM-wide weaver.
+			See PetClinic's readme and/or Spring's JPA documentation for more information.
 		-->
 	</context-param>
 
diff --git a/src/test/java/org/springframework/samples/petclinic/jpa/AbstractJpaClinicTests.java b/src/test/java/org/springframework/samples/petclinic/jpa/AbstractJpaClinicTests.java
index 251af81..d8adc91 100644
--- a/src/test/java/org/springframework/samples/petclinic/jpa/AbstractJpaClinicTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/jpa/AbstractJpaClinicTests.java
@@ -195,5 +195,4 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
 		p7 = this.clinic.loadPet(7);
 		assertEquals(found + 1, p7.getVisits().size());
 	}
-
-}
+}
\ No newline at end of file
-- 
GitLab