2

Just started Grails. Went through all questions but still with the issue. Connector seems in place. jdbc connector in the lib folder and dependency added to a class path

repositories of BuildConfig

 repositories {
    inherits true // Whether to inherit repository definitions from plugins

    grailsPlugins()
    grailsHome()
    mavenLocal()
    grailsCentral()
    mavenCentral()
    // uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
    //mavenRepo "http://repository.codehaus.org"
    //mavenRepo "http://download.java.net/maven/2/"
    //mavenRepo "http://repository.jboss.com/maven2/"
    //mavenRepo "http://repo1.maven.org/maven2/"
}

DataSource

dataSource {
    pooled = true
    jmxExport = true
    driverClassName = "org.postgresql.Driver"
    username = "postgres"
    password = "password"
}

environments {
    development {
        dataSource {
        dbCreate = "update"
        url = "jdbc:postgresql://localhost:5433/dev1base"
    }
}

And I get this:

|Loading Grails 2.4.3
|Configuring classpath
Error |
Resolve error obtaining dependencies: Could not find artifact postgresql:postgresql:jar:9.3-  1100.jdbc4 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: Could not find artifact postgresql:postgresql:jar:9.3-1100.jdbc4 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
Error |
Could not find artifact postgresql:postgresql:jar:9.3-1100.jdbc4 in grailsCentral (http://repo.grails.org/grails/plugins)
|Run 'grails dependency-report' for further information.

There shouldn't be magic here.

2 Answers 2

3

The issue is in the formatting of your artifact. It should be:

runtime 'org.postgresql:postgresql:9.3-1100-jdbc41'

Notice that the final period should be a dash instead.

Sign up to request clarification or add additional context in comments.

2 Comments

You're right in 6 mins green check, but why it's not written somewhere clearly? grails.org/Quick+Start example shows this: dependencies { … runtime "postgresql:postgresql:8.3-603.jdbc3" }
@Maxim It would appear that postgresql uses different formatting with different versions. The more recent ones use a dash instead of a dot as well as an extra "org." prefix.
1

Add a dependency in Config.groovy:

dependencies {
    runtime 'org.postgresql:postgresql:9.3-1101-jdbc41'

This is the version I am using, but you can try yours first (mind the format: add an 'org.' prefix and replace a '.' with a '-'). A even more recent version 1102 also seems to be available (http://mvnrepository.com/artifact/org.postgresql/postgresql)

1 Comment

Thanks for the reference. *-jdbc4 in my case works too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.