无法解决最近创建的 grails 项目中的依赖关系



当我尝试构建我的项目时,这是 gradle 的痕迹:

:compileIntegrationTestJava NO-SOURCE
startup failed:
/src/integration-test/groovy/shit/UserFunctionalSpec.groovy: 11: 
unable to resolve class GebSpec 
@Integration
/src/integration-test/groovy/shit/UserServiceSpec.groovy: 6: unable to resolve class org.hibernate.SessionFactory
import org.hibernate.SessionFactory

我不明白为什么会出现此错误,该项目是使用 grails cli 创建的:

grails create-app grails-rest --profile=rest-API --features=MongoDB

并生成了一个简单的域用户类,然后使用 grails cli 生成所有内容。

这是我的build.gradle:

buildscript {
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "org.grails.plugins:views-gradle:1.1.6"
}
}
version "0.1"
group "shit"
apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.plugins.views-json"
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-plugin-url-mappings"
compile "org.grails:grails-plugin-rest"
compile "org.grails:grails-plugin-codecs"
compile "org.grails:grails-plugin-interceptors"
compile "org.grails:grails-plugin-services"
compile "org.grails:grails-plugin-datasource"
compile "org.grails:grails-plugin-databinding"
compile "org.grails:grails-web-boot"
compile "org.grails:grails-logging"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:async"
compile "org.grails.plugins:mongodb"
compile "org.grails.plugins:views-json"
compile "org.grails.plugins:views-json-templates"
console "org.grails:grails-console"
profile "org.grails.profiles:rest-api"
provided "org.grails.plugins:embedded-mongodb:1.0.2"
testCompile "org.grails:grails-gorm-testing-support"
testCompile "org.grails:grails-datastore-rest-client"
testCompile "org.grails:grails-web-testing-support"
}
bootRun {
jvmArgs('-Dspring.output.ansi.enabled=always')
addResources = true
String springProfilesActive = 'spring.profiles.active'
systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}

我试图解决我对调试模式的依赖,但我看不到更准确的错误消息。 如果这是一个新的干净项目,为什么我的毕业生会有这个问题?

grails create-app grails-rest --profile=rest-api --features=mongodb

不生成名为/src/integration-test/groovy/shit/UserFunctionalSpec.groovy

的文件该测试显然是Hibernate Geb测试,您没有这些依赖项。

编辑:

rest-api 配置文件与 generate-all 命令及其提供的依赖项存在差异。要继续工作,只需删除生成的UserFunctionalSpecUserServiceSpec。请在此处提交问题

最新更新