Announcement Announcement Module
Collapse
No announcement yet.
Cannot get grails dependency to Spring Data. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot get grails dependency to Spring Data.

    I am creating a Grails app. I am not using the Neo4j plugin because I am using the milestones for Grails, Neo4j and Spring Data Neo4j.

    So Grails 2.0.0.M1
    Neo4j 1.5.M02
    Spring Data Neo4j 2.0.0.RC

    But I can't seem to get my BuildConfig.groovy correct. I got it working for the Neo4j Jars, but not Spring Data Neo4j.

    This is what I have

    Code:
    repositories {
            inherits true // Whether to inherit repository definitions from plugins
            grailsPlugins()
            grailsHome()
            grailsCentral()
            mavenCentral()
            mavenRepo "http://maven.springframework.org/milestone/"
    
        }
        dependencies {
            // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
    
            // runtime 'mysql:mysql-connector-java:5.1.16'
            runtime 'org.neo4j:neo4j:1.5.M02'
            runtime 'org.springframework.data:spring-data-neo4j:2.0.0.RC1'
            runtime 'org.springframework.data:spring-data-neo4j-aspects:2.0.0.RC1'
        }
    Any help would be greatly appreciated.

    Thanks

    Mark

  • #2
    Mark,

    Spring Data Neo4j RC1 is not yet published we try to get it out today
    You might go with M1 for today.
    Neo4j 1.5 was only released yesterday so that we waited for that for the RC.

    Cheers

    Michael

    Comment


    • #3
      I actually realized I put RC1, I had meant M1. But even when I did that, grails would update fine, but the jars still aren't in the classpath that I can use the Annotations on my domain objects.

      Shows me what happens when you get so excited that you want to use the latest and greatest before it reaches RELEASE.

      I'll just blame it on Jon Brisbin and his Evented Data with RabbitMQ and Riak talk two weeks ago at SpringOne.

      Mark

      Comment


      • #4
        Mark, can you share your (minimal) app somewhere so that I can have a look at it?

        Michael

        Comment


        • #5
          Sure. Unfortunately I am teaching on day 4 of Core Spring at a SpringSource client, so I can load it probably tomorrow.

          I think the issue might be related to an issue I have with plugins in Grails 2.0. That it has changed and no longer puts the stuff into the .grails/plugins directory. Just a guess though.

          Thanks

          Mark

          Comment


          • #6
            Try to add
            log "debug"
            just before repositories in BuildConfig.groovy. Hopefully you'll get some detailed output indicating the cause of the trouble.

            Regards,
            Stefan

            Comment


            • #7
              I am going to try out with RC1 today and see if I can get Grails to download the jars and set up the dependencies. If it doesn't work, I'll post to Dropbox and give you a link through a PM.

              Thanks

              Mark

              Comment


              • #8
                Michael, did you receive the PM with the link? I want to make sure it doesn't have to stay up publicly for that long.

                Thanks

                Mark

                Comment


                • #9
                  I have gotten the jars to download and get into my classpath. I changed the BuildConfig.groovy dependencies to

                  Code:
                  dependencies {
                          // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
                  
                          // runtime 'mysql:mysql-connector-java:5.1.16'
                          compile 'org.springframework.data:spring-data-neo4j:2.0.0.RC1'
                                  'org.springframework.data:spring-data-neo4j-aspects:2.0.0.RC1'
                          runtime 'org.neo4j:neo4j:1.5.M02'
                                  'org.springframework.data:spring-data-neo4j:2.0.0.RC1'
                                  'org.springframework.data:spring-data-neo4j-aspects:2.0.0.RC1'
                      }
                  I had just had them in the runtime scope, but by adding them to a compile time scope they were then downloaded. Now my IntelliJ project has them in the classpath and I can import the annotations. I still can't use the Grails Plugin annotations, but I think at that layer I will just stick with the Spring Data Annotations instead, although I am not sure if Grails will be able to do scaffolding, and I might have to do all that manually too.

                  Mark

                  Comment


                  • #10
                    What do you mean by
                    Grails Plugin annotations
                    ?

                    Since you're using the plain jar files of spring-data-neo4j they do not integrate into GORM. If you want to use the Neo4j GORM integration use the code from https://github.com/SpringSource/grails-data-mapping. This is completely seperated from spring-data.
                    That said relying on spring-data-neo4j will not provide you any scaffolding.

                    If you use runtime scope, the dependecies are resolved when calling 'grails run-app'.

                    Comment


                    • #11
                      Thanks Stefan.

                      I saw somewhere there were annotations for a plugin, now it could have been from the Roo plugin, but I vaguely remember it in Grails with @Neo4jIndexed and @Neo4jEntity along those lines.

                      Right now, I am trying to find the first combination that will actually work. Whether that is Roo or Grails. I have spent a good three weeks on the tools, tooling etc and none on my actual code to build the application. Mostly because I am choosing to use the latest stuff Either Grails 2.0, Roo 1.2, Neo4j 1.5, maybe Spring Data 2.0.

                      But, if you think the Neo4j GORM integration is the best approach with Grails, I will try it out. But that isn't your plugin that you created is it?

                      Again, thanks I am going to try out the grails-data-mapping project and use it.

                      Mark

                      Comment


                      • #12
                        OK, reading more, though I am still guessing. I guess it is the same plugin as yours. There is just a disconnect there that I couldn't see.

                        If you want a beta tester on the documentation you are writing, I think I am a good candidate for you.

                        For me, seeing the correlation between plugin version number and version number for the grails-data-mapping. I downloaded the grails-data-mapping 1.0RC would I use the same version in my Grails app for the Neo4J Grails plugin.

                        Then how do you setup Neo4j in your Grails app? When Grails first creates an app it adds a datasource for Hsqldb, do we have to change that to the Neo4j file? How do you do that?

                        After that, is that all you need to change. Let Grails do all the rest. Our domain objects won't require any type of annotations on them, it can automatically determine which domain objects should be a Node and what should be a Relationship?

                        Those are the type of things that I have been looking for in some documentation. But yes, even a real simple AddressBook sample app with the Neo4j plugin and Neo4j being used goes a long way.

                        I tried looking at the tests in the grails-data-mapping neo4j project, but it doesn't help me much.

                        Thanks

                        Mark

                        Comment


                        • #13
                          In trying to use the plugin for NEO4j with GORM, I remove any Spring Data stuff in my code, I also removed any Neo4j Annotations I had in my domain object. Now I just have the plugin.

                          Now I get the following error

                          Code:
                          | Error 2011-11-26 14:21:34,364 [Thread-13] ERROR context.GrailsContextLoader  - Error executing bootstraps: Cannot cast object '<graphDatabaseService>' with class 'grails.spring.BeanBuilder$ConfigurableRuntimeBeanReference' to class 'org.neo4j.graphdb.GraphDatabaseService'
                          Message: Cannot cast object '<graphDatabaseService>' with class 'grails.spring.BeanBuilder$ConfigurableRuntimeBeanReference' to class 'org.neo4j.graphdb.GraphDatabaseService'
                             Line | Method
                          ->> 693 | invokeBeanDefiningMethod  in grails.spring.BeanBuilder
                          - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
                          |   546 | invokeMethod              in     ''
                          |   736 | invokeBeanDefiningClosure in     ''
                          |   569 | beans                     in     ''
                          |   511 | invokeMethod . . . . . .  in     ''
                          |   303 | innerRun                  in java.util.concurrent.FutureTask$Sync
                          |   138 | run . . . . . . . . . . . in java.util.concurrent.FutureTask
                          |   886 | runTask                   in java.util.concurrent.ThreadPoolExecutor$Worker
                          |   908 | run . . . . . . . . . . . in     ''
                          ^   680 | run                       in java.lang.Thread
                          
                          Process finished with exit code 1
                          Not sure how to fix this one.

                          Thanks

                          Mark

                          Comment

                          Working...
                          X