Garret Wilson
Garret Wilson

Reputation: 21466

Create SQLite database in Maven cross platform

My client has an SQL file that needs to be processed and turned into an SQLite database during the Maven build process. It seemed simple enough: just use the org.codehaus.mojo.sql-maven-plugin with the org.xerial.sqlite-jdbc JDBC driver. Unfortunately, version 3.7.2 of the driver has a trivial oversight of a bug that nonetheless prevents it from being used in this situation. Although it's supposedly been fixed months ago, it's not available in the central Maven repository and no one will answer my queries. Other posts indicate that later versions will remove pure Java support altogether.

So how am I supposed to create an SQLite database from within Maven?

Upvotes: 1

Views: 1304

Answers (1)

steliann
steliann

Reputation: 11

I ran also into this problem and finally I found a good solution: set escapeProcessing tag to false as in the following example:

<execution>
    <id>create-schema</id>
    <phase>process-test-resources</phase>
    <goals>
        <goal>execute</goal>
    </goals>
    <configuration>
        <autocommit>true</autocommit>
        <escapeProcessing>false</escapeProcessing>
        <srcFiles>
            <srcFile>src/main/sql/your-schema.sql</srcFile>
        </srcFiles>
     </configuration>
</execution>

Upvotes: 1

Related Questions