2015-01-01 36 views
2

我想爲我的Grails項目使用Neo4j圖形數據庫。我創建了一個新的Grails項目(我使用Intellij Ultimate Edition)。該應用程序運行良好。在我BuildConfig.groovy並嘗試更新的項目,我獲得在控制檯下面的錯誤,當我嘗試添加Neo4j的依賴(編譯「:2.0.0-M02:Neo4j的」):無法將Neo4j GORM插件添加到Grails項目

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. 

這裏我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" 
    } 
} 

我甚至試圖用「Grails的安裝,插件的Neo4j」命令來安裝它,但我得到了同樣的錯誤。 有些幫助會很好。感謝您的時間!

快速更新:如果我更換依賴 '編譯 「:Neo4j的:2.0.0-M02」' 與 '編譯 「:Neo4j的:2.0.0-M01」' 它工作正常。所以我想它與最新版本有關。我希望有人能夠向我解釋爲什麼它不起作用。

部分解決:感謝Burt Beckwith,我終於能夠使這些依賴關係工作。然而,當我跑的應用程序,我得到了另一個錯誤:

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 

結束:最後的錯誤有事可做與Hibernate插件。我刪除了它,只剩下Neo4j,應用程序終於開始了。

回答

3

錯誤是告訴你,它找不到依賴org.neo4j:neo4j-jdbc:jar:2.0.2grailsCentral但是這是一個有點誤導 - 這是什麼意思是,它試圖在所有上市BuildConfig.groovy您的回購,並在任何無法找到它,所以它報告它嘗試的最後一個。

使用谷歌搜索neo4j-jdbc maven 2.0.2導致https://maven-repository.com/artifact/org.neo4j/neo4j-jdbc/2.0.2這導致http://m2.neo4j.org/releases/org/neo4j/neo4j-jdbc/2.0.2/並且那裏有neo4j-jdbc-2.0.2.jar。因此向後工作,並從該網址您需要添加此回購網址中刪除的版本,ID和組:

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

,然後它會解決。

+0

我添加了你建議的版本庫url,現在我得到了一個不同的錯誤:**解決錯誤獲取依賴關係:在grailsCentral **中找不到工件org.neo4j:neo4j-jdbc:zip:2.0.2。現在它找不到.zip文件。它沒有結束...... – Zan

+0

它在最後工作。我能夠獲得依賴關係。但我偶然發現了另一個問題。現在,當我嘗試運行該應用程序時,它抱怨一些'sessionFactory'bean沒有被定義。 – Zan

+0

2015年3月5日:目前,版本2.0.2的repo URI正在返回「服務器未找到與請求URI匹配的任何內容」 – Nathan