You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by at...@apache.org on 2008/05/16 10:43:20 UTC

svn commit: r656970 - /portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/maven-plugin/plugin.jelly

Author: ate
Date: Fri May 16 01:43:20 2008
New Revision: 656970

URL: http://svn.apache.org/viewvc?rev=656970&view=rev
Log:
Enforce processing of sql scripts alphabetically ordered.
See also https://issues.apache.org/jira/browse/JS2-812 

Modified:
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/maven-plugin/plugin.jelly

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/maven-plugin/plugin.jelly
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/maven-plugin/plugin.jelly?rev=656970&r1=656969&r2=656970&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/maven-plugin/plugin.jelly (original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/maven-plugin/plugin.jelly Fri May 16 01:43:20 2008
@@ -883,13 +883,20 @@
     <util:available file="${sql.src.path}">
       <echo>Running SQL scripts in directory ${sql.src.path}...</echo>
       <util:file name="${sql.src.path}" var="sqldir"/>
-      <j:set var="fileList" value="${sqldir.listFiles()}"/>
-      <j:forEach items="${fileList}" var="sqlfile" >
+      <!-- first check the files and then add them to a sorted Set to ensure they are executed in sorted order -->
+      <j:new className="java.util.TreeSet" var="fileList"/>
+      <j:forEach items="${sqldir.listFiles()}" var="sqlfile" >
         <j:if test="${sqlfile.name.endsWith('.sql')}" >
-          <j:set var="database.arg.script" value="${sqlfile.absolutePath}"/>
-          <attainGoal name="${process.database.script.goal}"/>
+          <j:invoke on="${fileList}" method="add">
+            <j:arg value="${sqlfile.absolutePath}"/>
+          </j:invoke>
         </j:if>
       </j:forEach>
+      <!-- now execute the found sql scripts, sorted by full path -->
+      <j:forEach items="${fileList.iterator()}" var="sqlfile" >
+          <j:set var="database.arg.script" value="${sqlfile}"/>
+          <attainGoal name="${process.database.script.goal}"/>
+      </j:forEach>
     </util:available>
   </goal>
     



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org