NocWriter / runsql-gradle-plugin

Gradle plugin for running SQL scripts
Apache License 2.0
3 stars 1 forks source link

Could not find method arrayOf() #8

Open alexei-28 opened 2 years ago

alexei-28 commented 2 years ago

In build.gradle


plugins {
    // Apply the application plugin to add support for building a CLI application in Java.
    id 'application'
    // Build uber-jar
    id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
    id "com.nocwriter.runsql" version "1.0.3"
}

task createEmptyDB(type: RunSQL) {
    config {
        username = ""
        password = ""
        url = "jdbc:sqlite:$projectDir/db_empty/sqlite/m2cm.db"
        driverClassName = "org.sqlite.JDBC"
        scriptFile = "/build/resources/main/db/sqlite/create-tables.sql"
    }
}

Usage:

gradle createEmptyDB

As result it's success create sqlite's m2cm.db

Nice.

But I need to execute 2 sql scripts. I try this:

task createEmptyDB(type: RunSQL) {
    config {
        username = ""
        password = ""
        url = "jdbc:sqlite:$projectDir/db_empty/sqlite/m2cm.db"
        driverClassName = "org.sqlite.JDBC"
        scriptFile = arrayOf("/build/resources/main/db/sqlite/create-tables.sql","/build/resources/main/db/sqlite/insert-data.sql")
    }
}

Usage:

gradle createEmptyDB

But get error


FAILURE: Build failed with an exception.

* Where:
Build file 'C:\dev\temp\m2cm\app\build.gradle' line: 164

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not find method arrayOf() for arguments [/build/resources/main/db/sqlite/create-tables.sql, /build/resources/main/db/sqlite/insert-data.sql] on RunSQLPrope
rties[url='jdbc:sqlite:C:\dev\temp\m2cm\app/db_empty/sqlite/m2cm.db', username='', password='', driverClassName='org.sqlite.JDBC', scriptFile='null'] of type com.n
ocwriter.runsql.gradle.RunSQLProperties.

* Try:
> Run with --stacktrace option to get the stack trace.