Unable to resolve dependency in a recent created grails project
Unable to resolve dependency in a recent created grails project
when i try to build my project this is the trace of 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
I can't understand why have this error, the project was created with grails cli:
grails create-app grails-rest --profile=rest-api --features=mongodb
And generated a simple Domain User class, and then generate-all with grails cli.
It is my 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)
I have tried to resolve my dependencies on debug mode but I can't see a more accurate error message.
Why is my gradle having this issues if this is a new and clean project?
If it is documented that grails createapp with MongoDB does set up Hibernate automatically for you (and I didn't know that Hibernate supported MongoDB) then this is a bug in grails createapp I suppose.
– Rup
Aug 21 at 11:12
Hi bro, thanks for your answer. Hibernate have MongoDB support. Have you any idea how to fix it ?
– Mario GT
Aug 21 at 11:18
Here's someone else's build.gradle for hibernate and mongodb on GitHub: github.com/mabrod/hibernate-ogm-mongodb/blob/master/… You could try copying the hibernate and hibernate ogm compile dependencies from there. He's defining the version numbers at the top of the file to be substituted with $s so might be simpler to just substitute them into the dependency lines manually for now. But I don't know Hibernate and MongoDB so no idea if that's specifically what you want or not!
– Rup
Aug 21 at 11:27
I tried to put it dependencies and has the same error. I did the same project again with this different dependencies and it doesn't work, any way thanks you for all.
– Mario GT
Aug 21 at 13:15
1 Answer
1
grails create-app grails-rest --profile=rest-api --features=mongodb
grails create-app grails-rest --profile=rest-api --features=mongodb
Does not produce a file called /src/integration-test/groovy/shit/UserFunctionalSpec.groovy
/src/integration-test/groovy/shit/UserFunctionalSpec.groovy
That test is apparently a Hibernate Geb test and you have neither of those dependencies.
EDIT:
The rest-api profile has a discrepancy with the generate-all command and the dependencies it provides. To continue working, simply delete the generated UserFunctionalSpec
and UserServiceSpec
. Please file an issue here
UserFunctionalSpec
UserServiceSpec
Yes, sorry i forget wrote, than generate a Domain User class, and generate-all then with grails cli.
– Mario GT
Aug 21 at 14:02
Thanks for your answer i created the issue (github.com/grails-profiles/rest-api/issues/7)
– Mario GT
Aug 21 at 14:36
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
So the problem is that you're expecting one of the grails dependencies to pull in Hibernate for you transitively? You say you've checked the dependencies in debug mode - do you see a transitive dependency on Hibernate?
– Rup
Aug 21 at 11:10