Chris and Company
i tried 12 ways from sunday and I could not get this plugin.xml to work for me
debug statements display NPEs on any/all references to srcFiles
I discovered the srcFiles array is not initted and not allocated
Source file: org.codehaus.mojo.sql.SqlExecMojo
<parameter>
<name>srcFiles</name>
<type>java.io.File[]</type>
<required>false</required>
<editable>true</editable>
<description>List of files containing SQL statements to
load.</description>
</parameter>
One solution is to refactor the array to use ArrayList
and reconfig on pluginXml to implement java.util.ArrayList<java.io.File> does
work (at least for me)
<parameter>
<name>srcFiles</name>
<type>java.util.ArrayList</type>
<required>false</required>
<editable>true</editable>
<description>List of files containing SQL statements to
load.</description>
</parameter>
this is more than a 1 line change and I have other things to do..i could do a
fix
but then theres the test-suite to worry about
any possibility to get an official response from the author?
Good Catch Chris!
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung.
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est
interdite. Ce message sert à l'information seulement et n'aura pas n'importe
quel effet légalement obligatoire. Étant donné que les email peuvent facilement
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité
pour le contenu fourni.
> Date: Thu, 14 Oct 2010 10:03:58 -0400
> Subject: Re: Maven SQL plugin
> From: [email protected]
> To: [email protected]
>
> Hi Chris,
>
> #2 is probably the best to ensure repeatability in the order you want. It
> also prevents inadvertent re-ordering if a new sql file is introduced into
> the sql directory. In our project, we use srcFiles rather than fileset:
>
> <srcFiles>
> <srcFile>[file1]</srcFile>
> <srcFile>[file2}</srcFile>
> ...
> </srcFiles>
>
> HTH,
> John Singleton
>
> On Thu, Oct 14, 2010 at 9:25 AM, Chris Odney <[email protected]> wrote:
>
> > Hi,
> >
> > I am facing some problem in ordering the sql execution.
> >
> > We have one sql script file for each table under one directory. Ex: There
> > is
> > user.sql and role.sql in the directory c:\SqlScripts. We are using the sql
> > maven plugin to execute these sql files.
> >
> > The role table has a Foriegn key to the user table and the execution is
> > failing because the plugin is trying to execute the role.sql before
> > user.sql. I cannot use the orderfile attribute as we specify the <fileset>
> > as c:\SqlScripts\*.sql.
> >
> > How do I overcome this problem?
> >
> > I see 2 solutions:
> >
> > 1) Merge all scripts into one file in the creation order, the script to
> > create role comes after the script to create user.
> >
> > 2)Remove the * wildcard and specify each file in the <filelist> attribute
> > in
> > the order of execution.
> >
> > 3)Number the name of the files according to the execution order ex:
> > 1_user.sql, 2_role.sql and use the 'ascending' orderfile attribute(not sure
> > if this would work though, as the ordering may not be applied)
> >
> > Any more elegant solutions?
> >
> > Thank you,
> > Chris.
> >