title: sql-mvn-plugin execute files in the exact order as they are listed in pom.xml
body: <p>I would like to ask some help regarding <a href="http://mojo.codehaus.org/sql-maven-plugin">sql-mvn-plugin</a>. According to the <a href="http://mojo.codehaus.org/sql-maven-plugin/execute-mojo.html#orderFile">documentation</a> if the pom.xml file does not have anything about the file order - <em>orderFile</em> tag - than the files will be executed in the exact order as they are listed. But it is not true! If I remove the <em>orderFile</em> tag than the files will be executed by ascending by default.</p>
  
  <p>To be honest, I wanted to use this plugin to create the database and import data during installation. Due to the fact I'm working more than 20 tables - the scripts, the table and the sequence and the constraints, are separated into individual files - I can not work files which do not have meaningful name. It would be the hell itself and using this plugin would be worthless. On the other hand I don't want to have this step outside from maven because in my head the maven is the tool to build, to test and deploy my application and the tool to avoid the script hell.</p>
  
  <p>As you can see in the sample below the execution order is not defined, and despite this fact during execution the first file which is executed the *procedures/test_activate_all_partners.sql*, which is the penultimate in the file order! In my understanding the first executed file should be the *tables/datapoint_component_types/table.sql*.</p>
  
  <p>My pom.xml:</p>
  
  <pre><code>              &lt;plugin&gt;
                  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                  &lt;artifactId&gt;sql-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.5&lt;/version&gt;
                  &lt;dependencies&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;postgresql&lt;/groupId&gt;
                          &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
                          &lt;version&gt;9.1-901.jdbc4&lt;/version&gt;
                      &lt;/dependency&gt;            
                  &lt;/dependencies&gt;
                  &lt;configuration&gt;
                      &lt;driver&gt;org.postgresql.Driver&lt;/driver&gt;
                      &lt;url&gt;jdbc:postgresql://localhost:5432/database&lt;/url&gt;
                      &lt;username&gt;postgres&lt;/username&gt;
                      &lt;password&gt;postgres&lt;/password&gt;
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;default-cli&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;execute&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;delimiter&gt;/&lt;/delimiter&gt;
                              &lt;delimiterType&gt;normal&lt;/delimiterType&gt;
                              &lt;autocommit&gt;true&lt;/autocommit&gt;
                              &lt;fileset&gt;
                                  &lt;!-- at home --&gt;
                                  &lt;basedir&gt;d:/PRIVAT/Projects/java/bigProject/&lt;/basedir&gt;
                                  &lt;includes&gt;
                                      &lt;!-- tables --&gt;
                                      &lt;include&gt;tables/datapoint_component_types/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datapoint_datapoint_components/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datapoint_java_result_types/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datapoint_postgres_result_types/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datapoint_result_types/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datapoints/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datatype_descs/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datatypes/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/disabled_period/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/file_extensions/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/logs/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/partner_datatypes/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/partner_processes/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/partner_protocols/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/partner_protocols_attributes_details/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/partners/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/process_step/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/process_step_actions/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/process_steps_param/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/process_steps_partner_processes/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/processes/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/protocol_attributes/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/protocols/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/result_tables/table.sql&lt;/include&gt;
                                      &lt;include&gt;tables/valid_period/table.sql&lt;/include&gt;
                                      &lt;!-- constrains --&gt;
                                      &lt;include&gt;tables/datapoint_component_types/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datapoint_datapoint_components/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datapoint_java_result_types/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datapoint_postgres_result_types/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datapoint_result_types/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datapoints/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datatype_descs/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datatypes/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/disabled_period/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/file_extensions/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/logs/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/partner_datatypes/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/partner_processes/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/partner_protocols/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/partner_protocols_attributes_details/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/partners/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/process_step/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/process_step_actions/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/process_steps_param/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/process_steps_partner_processes/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/processes/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/protocol_attributes/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/protocols/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/result_tables/sequences.sql&lt;/include&gt;
                                      &lt;include&gt;tables/valid_period/sequences.sql&lt;/include&gt;
                                      &lt;!-- sequences --&gt;
                                      &lt;include&gt;tables/datapoint_component_types/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datapoint_datapoint_components/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datapoint_java_result_types/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datapoint_postgres_result_types/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datapoint_result_types/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datapoints/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datatype_descs/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/datatypes/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/disabled_period/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/file_extensions/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/logs/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/partner_datatypes/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/partner_processes/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/partner_protocols/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/partner_protocols_attributes_details/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/partners/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/process_step/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/process_step_actions/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/process_steps_param/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/process_steps_partner_processes/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/processes/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/protocol_attributes/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/protocols/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/result_tables/constraints.sql&lt;/include&gt;
                                      &lt;include&gt;tables/valid_period/constraints.sql&lt;/include&gt;
                                      &lt;!-- procedures --&gt;
                                      &lt;include&gt;procedures/test_activate_all_partners.sql&lt;/include&gt;
                                      &lt;!-- testdata --&gt;
                                      &lt;include&gt;testdata/data.sql&lt;/include&gt;
                                  &lt;/includes&gt;
                              &lt;/fileset&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
  </code></pre>
  
  <p>The output:</p>
  
  <pre><code>d:/PRIVAT/Projects/java/bigProject&gt;mvn sql:execute
  [INFO] Scanning for projects...
  ...
  [INFO]
  [INFO] ------------------------------------------------------------------------
  [INFO] Building EJB 1.0-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO]
  [INFO] --- sql-maven-plugin:1.5:execute (default-cli) @ DiLibCoreEJB ---
  [INFO] Executing file: sql\procedures\test_activate_all_partners.sql
  [INFO] Executing file: sql\tables\datapoints\constraints.sql
  [ERROR] Failed to execute:
   ALTER TABLE
   datapoints
   ADD
   CONSTRAINT datapoints_pkey PRIMARY KEY (datapoint_id );
  
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 2.503s
  [INFO] Finished at: Sun Jan 06 17:49:40 CET 2013
  [INFO] Final Memory: 4M/77M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.codehaus.mojo:sql-maven-plugin:1.5:execute (default-cli) on project DiLibCoreEJB: ERROR: relation "datapoints" does not exist -&gt; [Help 1]
  [ERROR]
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR]
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
  d:/PRIVAT/Projects/java/bigProject&gt;
  </code></pre>
  
  <p>Thanks for any help in advance!</p>