我正在尝试使用gradle-grails-plugin构建一个已存在的(小型)Grails项目。这样做应该可以吗?build.gradle
中的依赖关系与buildConfig.groovy
中指定的依赖关系之间有何关系?
无论如何,我有两个项目,因此顶层的build.gradle
文件位于父目录中,如下所示:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.grails:grails-gradle-plugin:2.2.0.RC1"
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
然后,在Grails项目中的build.gradle文件应该如下:
apply plugin: "grails"
repositories {
grails.central() //creates a maven repo for the Grails Central repository (Core libraries and plugins)
}
grails {
grailsVersion = '2.4.4'
groovyVersion = '2.3.9'
springLoadedVersion '1.2.0.RELEASE'
}
dependencies {
bootstrap "org.grails.plugins:tomcat:7.0.55.3"
compile 'org.grails.plugins:asset-pipeline:3.0.1'
compile 'org.grails.plugins:scaffolding:2.1.2'
compile 'org.grails.plugins:cache:1.1.8'
runtime 'org.grails.plugins:hibernate4:4.3.1.1'
runtime 'org.grails.plugins:database-migration:1.3.8'
runtime 'org.grails.plugins:jquery:1.11.0'
}
然而,当我运行./gradlew war
时,返回以下结果:
Caused by: java.long.ClassNotFoundException: grails.artefact.Service
有谁能为此提供一些说明吗?在谷歌上几乎没有关于这个的参考资料,它似乎是一个Grails 3.x类?另外,我正在使用Java 1.7。