Skip to content Skip to sidebar Skip to footer

Java Sqlite Gradle

I'm pretty new to gradle and java at all.. I have a project which uses sqlite and it runs fine through intellij idea but I can't run it from the terminal, it throws an exception: j

Solution 1:

I've fixed this issue by adding sqlite in the classpath of distribution jar file of the project by modifying my jar section by this:

task copyDependenciesToTarget(type: Copy) {
    println 'Copying dependencies to target...'

    configurations.compile.collect().each { compileDependency ->
        copy {
            withfrom (compileDependency.getPath()) {
                include '*'
            }
            into'target/libs/libs'
        }
    }
}

build.dependsOn(copyDependenciesToTarget)


jar {
    manifest.attributes(
            "Main-Class": "Main",
            "Class-Path": configurations.compile.collect { 'libs/' + it.getName()}.join(' ')
    )
}

Now gradle downloads dependencies and copies them to libs/ directory.

Post a Comment for "Java Sqlite Gradle"