|
Hi folks
I'm experimenting Gradle (1.0-m7) to build a Grails 2.0.0 app. I'm a gradle newbbe... I'm using this build file ( https://gist.github.com/1779558 ) grailsVersion = '2.0.0' buildscript { repositories { mavenCentral() mavenRepo urls: 'http://snapshots.repository.codehaus.org' mavenRepo urls: 'http://download.java.net/maven/2/' mavenRepo name: "Grails Repo", urls: "http://repo.grails.org/grails/repo" } dependencies { classpath "org.grails:grails-gradle-plugin:1.1-SNAPSHOT" } } apply plugin: "grails" version = "1.0-SNAPSHOT" repositories { mavenCentral() flatDir dirs: "lib" mavenRepo name: "Grails Repo", urls: "http://repo.grails.org/grails/repo" } configurations { compile.exclude module: "commons-logging" } dependencies { compile "org.grails:grails-crud:${grailsVersion}", "org.grails:grails-dependencies:${grailsVersion}", "org.grails:grails-resources:${grailsVersion}" runtime "org.slf4j:slf4j-log4j12:1.6.2", "com.h2database:h2:1.3.160", "net.sf.ehcache:ehcache-core:2.4.6", "org.grails:grails-plugin-logging:2.0.0.M2" } What is the best practice to manage a grails app with gradle? Do I have to add dependencies to both BuildConfig.groovy AND build.gradle ? Now I have a couple of issues: * during build I have logging errors ( Log4j missing appenders and SLF4J duplicate adapter) , even if the task runs OK. Now this create a bit of noise since I have to check "false positives" from real errors * gradle assemble task create the war as expected but grails-run-app fail to run tomcat with the following error | Running Grails application | Error javax.servlet.ServletContext.getSessionCookieConfig()Ljavax/servlet/SessionCookieConfig; java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()Ljavax/servlet/SessionCookieConfig; at org.grails.plugins.tomcat.InlineExplodedTomcatServer.doStart(InlineExplodedTomcatServer.groovy:114) at org.grails.plugins.tomcat.TomcatServer.start(TomcatServer.groovy:102) at _GrailsRun$_run_closure5_closure12.doCall(_GrailsRun.groovy:175) at _GrailsRun$_run_closure5.doCall(_GrailsRun.groovy:152) at _GrailsRun.runInline(_GrailsRun.groovy:120) at _GrailsRun$_run_closure1.doCall(_GrailsRun.groovy:66) at RunApp$_run_closure1.doCall(RunApp.groovy:33) at org.grails.gradle.plugin.GrailsTask.executeCommand(GrailsTask.groovy:92) at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:158) at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:93) at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$2.execute(AnnotationProcessingTaskFactory.java:129) Thanks -- SammyRulez http://www.sammyrulez.com http://twitter.com/sammyrulez http://www.linkedin.com/in/sammyrulez --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
I blatantly stole your build script and it does work - I deployed (by hand) to a tomcat 7 instance and the grails home page appears.
I was able to get rid of the slf4j errors by adding a second exclude in the configurations closure: compile.exclude module: "slf4j-log4j12" There's probably a more idiomatic way of doing it, but It Works. |
|
Thanks
so there is no way to tell Grails to use Gradle for dependencies resolution ? I DO HAVE to specify external dependencies in bod build.grandle and BuildConfig.groovy ? 2012/2/9 tyconnell <[hidden email]>: > I blatantly stole your build script and it does work - I deployed (by hand) > to a tomcat 7 instance and the grails home page appears. > > I was able to get rid of the slf4j errors by adding a second exclude in the > configurations closure: > compile.exclude module: "slf4j-log4j12" > > There's probably a more idiomatic way of doing it, but It Works. > > -- > View this message in context: http://grails.1312388.n4.nabble.com/2-0-Building-Grails-app-with-Gradle-tp4373020p4374639.html > Sent from the Grails - user mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > -- SammyRulez http://www.sammyrulez.com http://twitter.com/sammyrulez http://www.linkedin.com/in/sammyrulez --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Keeping in mind my limited understanding, I think Gradle "understands" Grails, but not the other way around.
http://www.cacoethes.co.uk/blog/groovyandgrails/building-a-grails-project-with-gradle That post is somewhat old (in internet terms), but seems like if properly configured, you can use gradle to do all things gradle and grails. |
|
This post has NOT been accepted by the mailing list yet.
In reply to this post by ::SammyRulez::
i have also blatantly stole your build script
and yes i can get it to build my war and init my project but when i run gradle grails-run-app i get a InvocationTargetException
| Error SLF4J: Class path contains multiple SLF4J bindings. | Error SLF4J: Found binding in [jar:file:/Users/smithbn/.gradle/caches/artifacts-8/filestore/org.grails/grails-plugin-logging/2.0.0.M2/jar/88f330d212092f22042ecb8856d74288912b0317/grails-plugin-logging-2.0.0.M2.jar!/org/slf4j/impl/StaticLoggerBinder.class] | Error SLF4J: Found binding in [jar:file:/Users/smithbn/.gradle/caches/artifacts-8/filestore/org.grails/grails-plugin-log4j/2.0.0/jar/3f2e0e2a2d22c13442b0fe08a65b54ea11acc2bb/grails-plugin-log4j-2.0.0.jar!/org/slf4j/impl/StaticLoggerBinder.class] | Error SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. | Error log4j:WARN No appenders could be found for logger (org.springframework.core.io.support.PathMatchingResourcePatternResolver). | Error log4j:WARN Please initialize the log4j system properly. | Error log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. | Packaging Grails application..... | Error WARNING: No default container found, installing Tomcat.. | Plugin 'tomcat' with version '2.0.0' is already installed FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':grails-run-app'. > java.lang.reflect.InvocationTargetException @SammyRulez i am still getting the log4j warn even though i have your exclude in my configurations closure so not sure whats going on now my build.gradle file: grailsVersion = '2.0.0' buildscript { repositories { mavenCentral() mavenRepo urls: 'http://snapshots.repository.codehaus.org' mavenRepo urls: 'http://download.java.net/maven/2/' mavenRepo name: "Grails Repo", urls: "http://repo.grails.org/grails/repo" } dependencies { classpath "org.grails:grails-gradle-plugin:1.1-SNAPSHOT" } } apply plugin: "grails" version = "1.0-SNAPSHOT" repositories { mavenCentral() flatDir dirs: "lib" mavenRepo name: "Grails Repo", urls: "http://repo.grails.org/grails/repo" } configurations { compile.exclude module: "commons-logging" compile.exclude module: "slf4j-log4j12" } dependencies { compile "org.grails:grails-crud:${grailsVersion}", "org.grails:grails-dependencies:${grailsVersion}", "org.grails:grails-resources:${grailsVersion}" runtime "org.slf4j:slf4j-log4j12:1.6.2", "com.h2database:h2:1.3.160", "net.sf.ehcache:ehcache-core:2.4.6", "org.grails:grails-plugin-logging:2.0.0.M2" } |
| Powered by Nabble | Edit this page |
