70157

Unable to add Neo4j GORM plugin to a Grails project

I want to use Neo4j graph database for my Grails project. I created a new Grails project (i'm using Intellij Ultimate Edition). The app runs fine. When i try to add the Neo4j dependency (compile ":neo4j:2.0.0-M02") in my BuildConfig.groovy and try to update the project I get the following errors in the console:

Error | Resolve error obtaining dependencies: Could not find artifact org.neo4j:neo4j-jdbc:jar:2.0.2 in grailsCentral (https://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace) Error | Resolve error obtaining dependencies: Could not find artifact org.neo4j:neo4j-jdbc:jar:2.0.2 in grailsCentral (https://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace) Error | Resolve error obtaining dependencies: Could not find artifact org.neo4j:neo4j-jdbc:jar:2.0.2 in grailsCentral (https://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace) Error | Could not find artifact org.neo4j:neo4j-jdbc:jar:2.0.2 in grailsCentral (https://repo.grails.org/grails/plugins) |Run 'grails dependency-report' for further information.

Here is my BuildConfig.groovy:

grails.servlet.version = "3.0" // Change depending on target container compliance (2.5 or 3.0) grails.project.class.dir = "target/classes" grails.project.test.class.dir = "target/test-classes" grails.project.test.reports.dir = "target/test-reports" grails.project.work.dir = "target/work" grails.project.target.level = 1.6 grails.project.source.level = 1.6 //grails.project.war.file = "target/${appName}-${appVersion}.war" grails.project.fork = [ // configure settings for compilation JVM, note that if you alter the Groovy version forked compilation is required // compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256, daemon:true], // configure settings for the test-app JVM, uses the daemon by default test: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, daemon:true], // configure settings for the run-app JVM run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false], // configure settings for the run-war JVM war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false], // configure settings for the Console UI JVM console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256] ] grails.project.dependency.resolver = "maven" // or ivy grails.project.dependency.resolution = { // inherit Grails' default dependencies inherits("global") { // specify dependency exclusions here; for example, uncomment this to disable ehcache: // excludes 'ehcache' } log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose' checksums true // Whether to verify checksums on resolve legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility 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/" } dependencies { // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g. // runtime 'mysql:mysql-connector-java:5.1.29' // runtime 'org.postgresql:postgresql:9.3-1101-jdbc41' test "org.grails:grails-datastore-test-support:1.0.2-grails-2.4" } plugins { // plugins for the build system only build ":tomcat:7.0.55" // plugins for the compile step compile ":neo4j:2.0.0-M02" compile ":scaffolding:2.1.2" compile ':cache:1.1.8' compile ":asset-pipeline:1.9.9" // plugins needed at runtime but not for compilation runtime ":hibernate4:4.3.6.1" // or ":hibernate:3.6.10.18" runtime ":database-migration:1.4.0" runtime ":jquery:1.11.1" // Uncomment these to enable additional asset-pipeline capabilities //compile ":sass-asset-pipeline:1.9.0" //compile ":less-asset-pipeline:1.10.0" //compile ":coffee-asset-pipeline:1.8.0" //compile ":handlebars-asset-pipeline:1.3.0.3" } }

I even tried to install it with the 'grails install-plugin neo4j' command, but I get the same errors. Some help would be nice. Thank you for your time!

<strong>QUICK UPDATE</strong>: If I replace the dependency 'compile ":neo4j:2.0.0-M02"' with ' compile ":neo4j:2.0.0-M01"' it works fine. So i guess it has to do with the latest version. I hope someone can provide me an explanation of why it doesn't work.

<strong>Partially solved:</strong> Thanks to Burt Beckwith i was finally able to make those dependencies work. However when I ran the app i got another error:

Error | 2015-01-02 13:25:59,826 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: No bean named 'sessionFactory' is defined Message: No bean named 'sessionFactory' is defined Line | Method ->> 104 | postProcessBeanFactory in org.grails.datastore.gorm.plugin.support.PersistenceContextInterceptorAggregator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 262 | run in java.util.concurrent.FutureTask | 1145 | runWorker . . . . . . in java.util.concurrent.ThreadPoolExecutor | 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 745 | run . . . . . . . . . in java.lang.Thread Error | Forked Grails VM exited with error

<strong>End:</strong> The last error had something to do with the hibernate plugin. I removed it, and left only Neo4j, and the app finally started.

Answer1:

The error is telling you that it can't find dependency org.neo4j:neo4j-jdbc:jar:2.0.2 in grailsCentral but that's a little misleading - what this means is that it tried all of your repos listed in BuildConfig.groovy and couldn't find it in any, so it reports the last one it tried.

Googling for neo4j-jdbc maven 2.0.2 leads to https://maven-repository.com/artifact/org.neo4j/neo4j-jdbc/2.0.2 which leads to http://m2.neo4j.org/releases/org/neo4j/neo4j-jdbc/2.0.2/ and there is a neo4j-jdbc-2.0.2.jar there. So working backwards and removing the version, id, and group from that url you need to add this repo url:

repositories { ... mavenRepo 'http://m2.neo4j.org/releases' }

and then it will resolve.

Recommend

  • Adding dependencies to a custom gradle plugin
  • m2eclipse filtering test resources
  • Running a java code repeatedly for a given duration in Jenkins
  • C3p0 with Hibernate 4.2 error: setCharacterStream(ILjava/io/Reader;J)V is abstract
  • Eclipse java - How do I include Jersey archetype in Maven?
  • Changes in dependent modules cannot be seen in other module in Maven Eclipse
  • Maven LifeCycleExecutor with an incomplete configuration error
  • Specify root context for web application in wildfly 8 at deployment
  • How to configure log4j2 to log for HikariCP
  • How to write simple SMPP server
  • Commons logging to use java.util.logging
  • gcloud ping attempt failure with performing a 'docker push'
  • Docker - Updating Environment Variables of a Container
  • Capture android screen [duplicate]
  • Import Protobuf generated classes using Gradle in IntelliJ
  • Maven - which projects or techologies you are using it for?
  • Reusing the same code across multiple Android Studio projects
  • Hudson - different build targets for different triggers
  • lein uberjar doesn't pack the jar file under resource into the final jar
  • JENKINS: ERROR when I try to use an older JDK for a specific maven project
  • Regarding client side code generation from WSDL
  • maven jboss-as:start A required class was missing … org/sonaty…/ArtifactResolutionException
  • How do you create a Fuseki SPARQL server using the Apache Jena Java API?
  • Getting last autonumber in access
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Spray.io: When (not) to use non-blocking route handling?
  • Modifying destination and filename of gulp-svg-sprite
  • GridView Sorting works once only
  • SVN: Merging two branches together
  • Hibernate gives error error as “Access to DialectResolutionInfo cannot be null when 'hibernate.
  • -fvisibility=hidden not passed by compiler for Debug builds
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • Bitwise OR returns boolean when one of operands is nil
  • sending mail using smtp is too slow
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • Binding checkboxes to object values in AngularJs
  • How can I use `wmic` in a Windows PE script?