Hello,
I want to write a program in groovy, making use of DbUnit. This library needs to have on its path the slf4j logging library.
Let me explain with example:
Here is my source file in src/main.groovy/Test.groovy:
println "test"
toto#truc
There is obviously a compilation error.
With this build.gradle :
apply plugin: 'groovy'
repositories {
mavenCentral()
}
dependencies {
groovy group: 'org.codehaus.groovy', name: 'groovy', version: '1.8.5'
}
I have the following output (which is correct):
:compileJava UP-TO-DATE :compileGroovy [ant:groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: [ant:groovyc] D:\DEV\GROOVY\test\src\main\groovy\Test.groovy: 3: unexpected char: ‘#’ @ line 3, column 5. [ant:groovyc]
toto#truc [ant:groovyc]
^ [ant:groovyc] [ant:groovyc] 1 error [ant:groovyc]
FAILURE: Build failed with an exception.
-
What went wrong: Execution failed for task ‘:compileGroovy’. Cause: Forked groovyc returned error code: 1
-
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.332 secs
Now, if I modify the build.gragle by adding a dependency on slf4j and log4j binding (for instance):
apply plugin: 'groovy'
repositories {
mavenCentral()
}
dependencies {
groovy group: 'org.codehaus.groovy', name: 'groovy', version: '1.8.5'
groovy group: 'org.slf4j', name: 'slf4j-api', version: '1.6.2'
groovy group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.6.2'
}
Here is the output (which is not correct now, because the compilation error won’t show):
:compileJava UP-TO-DATE :compileGroovy
FAILURE: Build failed with an exception.
-
What went wrong: Execution failed for task ‘:compileGroovy’. Cause: Forked groovyc returned error code: 1
-
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.388 secs
Thank you for your help,
Ben