[
http://jira.codehaus.org/browse/MSQL-64?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dennis Lundberg updated MSQL-64:
--------------------------------
Description:
Guys
I could not get this plugin.xml to work
debug statements display NPEs on any/all references to parameter srcFiles
I discovered the srcFiles array is not initted and not allocated
Source file: org.codehaus.mojo.sql.SqlExecMojo
{noformat}
<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>
{noformat}
One solution is to refactor the array to use ArrayList<java.io.File>
and reconfig on pluginXml to implement java.util.ArrayList<java.io.File> does
work (at least for me)
{noformat}
<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>
{noformat}
pom.xml test harness
{noformat}
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.4</version>
<dependencies>
<!-- put oracle drivers (org.jdbc.driver.oracleDriver) in this artifact -->
<dependency>
<groupId>org.jdbc</groupId>
<artifactId>oracle</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<configuration>
<driver>oracle.jdbc.driver.OracleDriver</driver>
<url>jdbc:thin://localhost:1521/comm2servlet</url>
<username>system</username>
<password>password</password>
<skip>${maven.test.skip}</skip>
<!-- sqlCommand>select ${one} FROM SYSIBM.SYSDUMMY1;</sqlCommand -->
<!-- enableFiltering>true</enableFiltering -->
<srcFiles>
<srcFile>src/main/sql/sql1.sql</srcFile>
<srcFile>src/main/sql/sql2.sql</srcFile>
</srcFiles>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<one>1</one>
</properties>
</project>
{noformat}
/src/main/sql/sql1.sql
{noformat}
select SYSDATE FROM DUAL;
{noformat}
/src/main/sql/sql2.sql
{noformat}
select * from V$PARAMETER WHERE name='sql_version';
{noformat}
Thanks
Martin
was:
Guys
I could not get this plugin.xml to work
debug statements display NPEs on any/all references to parameter 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<java.io.File>
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>
--pom.xml test harness--
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.4</version>
<dependencies>
<!-- put oracle drivers (org.jdbc.driver.oracleDriver) in this artifact -->
<dependency>
<groupId>org.jdbc</groupId>
<artifactId>oracle</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<configuration>
<driver>oracle.jdbc.driver.OracleDriver</driver>
<url>jdbc:thin://localhost:1521/comm2servlet</url>
<username>system</username>
<password>password</password>
<skip>${maven.test.skip}</skip>
<!-- sqlCommand>select ${one} FROM SYSIBM.SYSDUMMY1;</sqlCommand -->
<!-- enableFiltering>true</enableFiltering -->
<srcFiles>
<srcFile>src/main/sql/sql1.sql</srcFile>
<srcFile>src/main/sql/sql2.sql</srcFile>
</srcFiles>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<one>1</one>
</properties>
</project>
/src/main/sql/sql1.sql
select SYSDATE FROM DUAL;
/src/main/sql/sql2.sql
select * from V$PARAMETER WHERE name='sql_version';
Thanks
Martin
> Files[] type produces NPE (should be replaced by ArrayList<java.io.File>)
> --------------------------------------------------------------------------
>
> Key: MSQL-64
> URL: http://jira.codehaus.org/browse/MSQL-64
> Project: Maven 2.x SQL Plugin
> Issue Type: Bug
> Affects Versions: 1.4
> Reporter: Martin Gainty
>
> Guys
> I could not get this plugin.xml to work
> debug statements display NPEs on any/all references to parameter srcFiles
> I discovered the srcFiles array is not initted and not allocated
> Source file: org.codehaus.mojo.sql.SqlExecMojo
> {noformat}
> <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>
> {noformat}
> One solution is to refactor the array to use ArrayList<java.io.File>
> and reconfig on pluginXml to implement java.util.ArrayList<java.io.File> does
> work (at least for me)
> {noformat}
> <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>
> {noformat}
> pom.xml test harness
> {noformat}
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>sql-maven-plugin-test</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> <build>
> <plugins>
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>sql-maven-plugin</artifactId>
> <version>1.4</version>
> <dependencies>
> <!-- put oracle drivers (org.jdbc.driver.oracleDriver) in this artifact
> -->
> <dependency>
> <groupId>org.jdbc</groupId>
> <artifactId>oracle</artifactId>
> <version>1.4</version>
> </dependency>
> </dependencies>
> <configuration>
> <driver>oracle.jdbc.driver.OracleDriver</driver>
> <url>jdbc:thin://localhost:1521/comm2servlet</url>
> <username>system</username>
> <password>password</password>
> <skip>${maven.test.skip}</skip>
> <!-- sqlCommand>select ${one} FROM SYSIBM.SYSDUMMY1;</sqlCommand -->
> <!-- enableFiltering>true</enableFiltering -->
> <srcFiles>
> <srcFile>src/main/sql/sql1.sql</srcFile>
> <srcFile>src/main/sql/sql2.sql</srcFile>
> </srcFiles>
> </configuration>
> </plugin>
> </plugins>
> </build>
> <properties>
> <one>1</one>
> </properties>
>
> </project>
> {noformat}
> /src/main/sql/sql1.sql
> {noformat}
> select SYSDATE FROM DUAL;
> {noformat}
> /src/main/sql/sql2.sql
> {noformat}
> select * from V$PARAMETER WHERE name='sql_version';
> {noformat}
> Thanks
> Martin
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email