我想在我的Grails项目中使用Neo4j图形数据库。我创建了一个新的Grails项目(我正在使用Intellij Ultimate Edition)。该应用运行正常。当我尝试在BuildConfig.groovy中添加Neo4j依赖项(编译“:neo4j:2.0.0-M02”)并尝试更新项目时,我在控制台中收到以下错误:
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 install-plugin neo4j'命令安装它,但是我得到了同样的错误。 一些帮助会很好。谢谢你的时间!
QUICK UPDATE :如果我将依赖项'compile'替换为:neo4j:2.0.0-M02“'与'compile':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,应用终于开始了。
答案 0 :(得分:3)
该错误告诉您它无法在org.neo4j:neo4j-jdbc:jar:2.0.2
中找到依赖关系grailsCentral
,但这有点误导 - 这意味着它尝试了您列出的所有回购信息BuildConfig.groovy
并且无法在任何内容中找到它,因此会报告它尝试的最后一个。
通过Google搜索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
位于repositories {
...
mavenRepo 'http://m2.neo4j.org/releases'
}
。因此,向后工作并从该URL中删除版本,ID和组,您需要添加此repo url:
{{1}}
然后它会解决。