Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Grails 独立GORM脚本的当前依赖项是什么?_Grails_Groovy_Gorm_Grape - Fatal编程技术网

Grails 独立GORM脚本的当前依赖项是什么?

Grails 独立GORM脚本的当前依赖项是什么?,grails,groovy,gorm,grape,Grails,Groovy,Gorm,Grape,我试图从Github中学习Graeme Rocher的例子: 我越来越 java.lang.RuntimeException:抓取葡萄时出错--[下载失败:>com.googlecode.concurrentlinkedhashmap#concurrentlinkedhashmap->lru;1.3.1!concurrentlinkedhashmap-lru.jar,下载失败:>javax.transaction#jta;1.1!jta.jar,下载失败:org.jboss.logging#j

我试图从Github中学习Graeme Rocher的例子:

我越来越

java.lang.RuntimeException:抓取葡萄时出错--[下载失败:>com.googlecode.concurrentlinkedhashmap#concurrentlinkedhashmap->lru;1.3.1!concurrentlinkedhashmap-lru.jar,下载失败:>javax.transaction#jta;1.1!jta.jar,下载失败:org.jboss.logging#jboss->logging;3.1.3.GA!jboss-logging.jar,下载失败:org.javassist#javassist;3.18.1!GA!javassist.jar(bundle)]

我认为这意味着一些依赖项已经改变/消失


是否有此代码的当前工作版本?

我得到了以下工作:

@GrabResolver(name='mvncentral', root='http://central.maven.org/maven2/')
@Grab("org.grails:grails-datastore-gorm-hibernate4:3.1.1.RELEASE")
@Grab("org.grails:grails-spring:2.4.3")
@Grab("com.h2database:h2:1.3.164")
import grails.orm.bootstrap.*
import grails.persistence.*
import org.springframework.jdbc.datasource.DriverManagerDataSource
import org.h2.Driver


init = new HibernateDatastoreSpringInitializer(Person)
def dataSource = new DriverManagerDataSource(Driver.name, "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE", 'sa', '')
init.configureForDataSource(dataSource)


println "Total people = " + Person.count()


@Entity
class Person {
    String name
    static constraints = {
        name blank:false
    }
}

我添加了一个不同于最新版本groovy中默认jcenter的解析程序。此外,您可能需要清除缓存版本中尝试下载的内容。以下是一个。

我已经尝试将@GrabResolver()用于各种URL(应该说,抱歉)

我试过杰夫·贝克的答案,但没有用

通过设置一些调试标志,我经历了一个调试周期,以查看发生了什么(-Dgroovy.grape.report.downloads=true-Divy.message.logger.level=4)

最后,我不得不创建一个定制的~/.groovy/grapeConfig.xml(根据),并添加Jeff提供的mavencentral URL作为进一步的“ibiblio”条目

然后一切都好了

不知道为什么@GrabResolver()无法解析,但这是一个解决方法

@GrabResolver(name='mvncentral', root='http://central.maven.org/maven2/')
@Grab("org.grails:grails-datastore-gorm-hibernate4:3.1.1.RELEASE")
@Grab("org.grails:grails-spring:2.4.3")
@Grab("com.h2database:h2:1.3.164")
import grails.orm.bootstrap.*
import grails.persistence.*
import org.springframework.jdbc.datasource.DriverManagerDataSource
import org.h2.Driver


init = new HibernateDatastoreSpringInitializer(Person)
def dataSource = new DriverManagerDataSource(Driver.name, "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE", 'sa', '')
init.configureForDataSource(dataSource)


println "Total people = " + Person.count()


@Entity
class Person {
    String name
    static constraints = {
        name blank:false
    }
}