Hi,

On our side, we created the best of both worlds:

* We used Ant's <exec> to call the command-line SQL client (in the poster's 
case, SQLPlus) and to rebuild the database as desired
* We then used those ant scripts as the basis for a Maven plugin

End result, a fully integrated and reusable ant-based database build process 
which is integrated into Maven's build lifecycle.

Thanks,

Ryan Slobojan

-----Original Message-----
From: Phillip Rhodes [mailto:[EMAIL PROTECTED]
Sent: Tue 12/12/2006 7:11 PM
To: Maven Users List
Subject: Re: SQL  scripts in webapp
 
I dealt with this one too.  I had to take a step back.

Maven is great for building/compiling code, but it is not an platform 
for execution.
My problem went away when I decided to use maven to package/build my 
projects and left sql/data migration programs/etc/ to ant scripts.

Just my 2 cents.


Vinita Joshi wrote:

>I want to use sql scripts in my webapp which I am building using maven 2.
>However, the scripts are executed when I run mvn package command. I want
>these scripts to be executed when I deploy the app on geronimo.
>
> 
>
>Any help is appreciated.
>
> 
>
>Regards,
>
> 
>
>Vinita
>
> 
>
> 
>
>I have added the following in my pom.xml
>
> 
>
><plugins>
>
>            <plugin>
>
> 
>
>        <groupId>org.codehaus.mojo</groupId>
>
>        <artifactId>sql-maven-plugin</artifactId>
>
> 
>
>        <dependencies>
>
>          <!-- specify the dependent jdbc driver here -->
>
>          <dependency>
>
>            <groupId>ojdbc14</groupId>
>
>            <artifactId>ojdbc14</artifactId>
>
>            <version>10.1.0.4.0</version>
>
>          </dependency>
>
>        </dependencies>
>
> 
>
>        <!-- common configuration shared by all executions -->
>
>        <configuration>
>
>           <username>sf</username>
>
>           <password>sf</password>
>
>           <!-- You can comment out username/password configurations and 
>
>                have maven to look them up in your settings.xml using
>${settingsKey}
>
>           -->
>
>           <settingsKeys>sensibleKey</settingsKeys>
>
>           <driver>oracle.jdbc.driver.OracleDriver</driver>
>
>           <url>jdbc:oracle:thin:@localhost:1521:orcl</url>
>
>        </configuration>
>
> 
>
>        <executions>
>
> 
>
>          
>
>          <execution>
>
>            <id>create-data</id>
>
>            <phase>process-test-resources</phase>
>
>            <goals>
>
>              <goal>execute</goal>
>
>            </goals>
>
>            <configuration>
>
>              <fileset>
>
>                <basedir>src</basedir>
>
>                <includes>
>
>                  <!-- These 2 files may not get executed in sequence, use
>srcFiles instead, if needed -->
>
>                  <include>test/sql/test-data.sql</include>
>
>                  <!--<include>test/sql/test-data2.sql</include>-->
>
>                </includes>
>
>              </fileset>
>
>            </configuration>
>
>          </execution>
>
> 
>
>          
>
>        </executions>
>
>            </plugin>
>
>            </plugins>
>
>
>  
>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Reply via email to