Skip to content

Could not find method arrayOf() #8

Description

@alexei-28

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions