ratpack / example-ratpack-gradle-groovy-app

An example of a Groovy Ratpack app built with Gradle.
37 stars 29 forks source link

Current 0.9.0-SNAPSHOT won't build, can't find Groovy or Ratpack classes #1

Closed msgilligan closed 11 years ago

msgilligan commented 11 years ago

./gradlew run gives the following output:

:compileGroovy startup failed: /Users/sean/git/example-ratpack-gradle-groovy-app/src/main/groovy/groovywebconsole/ScriptExecutor.groovy: 4: unable to resolve class org.codehaus.groovy.runtime.StackTraceUtils @ line 4, column 1. import org.codehaus.groovy.runtime.StackTraceUtils ^

/Users/sean/git/example-ratpack-gradle-groovy-app/src/main/groovy/groovywebconsole/ScriptExecutor.groovy: 3: unable to resolve class org.codehaus.groovy.control.MultipleCompilationErrorsException @ line 3, column 1. import org.codehaus.groovy.control.MultipleCompilationErrorsException ^

/Users/sean/git/example-ratpack-gradle-groovy-app/src/main/groovy/groovywebconsole/ScriptExecutor.groovy: 17: unable to resolve class Binding @ line 17, column 24. def aBinding = new Binding([out: printStream]) ^

/Users/sean/git/example-ratpack-gradle-groovy-app/src/main/groovy/groovywebconsole/ScriptExecutor.groovy: 22: unable to resolve class MetaClassRegistryChangeEventListener @ line 22, column 11. } as MetaClassRegistryChangeEventListener ^

/Users/sean/git/example-ratpack-gradle-groovy-app/src/main/groovy/groovywebconsole/ScriptExecutor.groovy: 20: unable to resolve class MetaClassRegistryChangeEvent @ line 20, column 24. def listener = { MetaClassRegistryChangeEvent event -> ^

/Users/sean/git/example-ratpack-gradle-groovy-app/src/main/groovy/groovywebconsole/ScriptExecutor.groovy: 34: unable to resolve class GroovyShell @ line 34, column 22. result = new GroovyShell(aBinding).evaluate(scriptText) ^

/Users/sean/git/example-ratpack-gradle-groovy-app/src/main/groovy/groovywebconsole/ScriptExecutor.groovy: 45: unable to resolve class MetaClassRegistryChangeEvent @ line 45, column 28. emcEvents.each { MetaClassRegistryChangeEvent event -> ^

7 errors

:compileGroovy FAILED

FAILURE: Build failed with an exception.

BUILD FAILED

pledbrook commented 11 years ago

I just pulled master and ran the build successfully. I don't understand why the Groovy compilation is failing here. StackTraceUtils has been around since Groovy 1.5, so for some reason Groovy isn't in the compiler path when you run the build.

Can't think what the issue might be right now :frowning:

ldaley commented 11 years ago

Can't reproduce either.

Try running ./gradlew run --refresh-dependencies

ldaley commented 11 years ago

Can you paste the output of ./gradlew dependencies here please.

msgilligan commented 11 years ago

Running ./gradlew run --refresh-dependencies didn't change the error output.

Here's the output of ./gradlew dependencies:

The groovy configuration has been deprecated and is scheduled to be removed in Gradle 2.0. Typically, usages of 'groovy' can simply be replaced with 'compile'. In some cases, it may be necessary to additionally configure the 'groovyClasspath' property of GroovyCompile and Groovydoc tasks.
:dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

archives - Configuration for archive artifacts.
No dependencies

compile - Compile classpath for source set 'main'.
+--- org.ratpack-framework:ratpack-core:0.9.0-SNAPSHOT
\--- org.ratpack-framework:ratpack-groovy:0.9.0-SNAPSHOT

default - Configuration for default artifacts.
+--- org.ratpack-framework:ratpack-core:0.9.0-SNAPSHOT
\--- org.ratpack-framework:ratpack-groovy:0.9.0-SNAPSHOT

groovy - The Groovy libraries to be used for this Groovy project. (Deprecated)
\--- org.ratpack-framework:ratpack-groovy:0.9.0-SNAPSHOT

runtime - Runtime classpath for source set 'main'.
+--- org.ratpack-framework:ratpack-core:0.9.0-SNAPSHOT
\--- org.ratpack-framework:ratpack-groovy:0.9.0-SNAPSHOT

springloaded
\--- org.springsource.springloaded:springloaded-core:1.1.1

testCompile - Compile classpath for source set 'test'.
+--- org.ratpack-framework:ratpack-core:0.9.0-SNAPSHOT
\--- org.ratpack-framework:ratpack-groovy:0.9.0-SNAPSHOT

testRuntime - Runtime classpath for source set 'test'.
+--- org.ratpack-framework:ratpack-core:0.9.0-SNAPSHOT
\--- org.ratpack-framework:ratpack-groovy:0.9.0-SNAPSHOT

BUILD SUCCESSFUL

Total time: 3.662 secs
msgilligan commented 11 years ago

Adding the following to build.gradle makes ./gradlew run work correctly:

apply plugin: 'java'

dependencies {
  compile 'org.codehaus.groovy:groovy-all:2.1.3'
  compile 'org.ratpack-framework:ratpack-core:0.9.0-SNAPSHOT'
  compile 'org.ratpack-framework:ratpack-groovy:0.9.0-SNAPSHOT'
  compile 'org.ratpack-framework:ratpack-guice:0.9.0-SNAPSHOT'
  compile 'org.ratpack-framework:ratpack-session:0.9.0-SNAPSHOT'
  compile 'io.netty:netty-codec-http:4.0.0.CR2'
  compile 'org.javassist:javassist:3.17.1-GA'

  compile 'com.google.guava:guava:13.0.1'
  compile 'com.google.inject:guice:3.0', {
    exclude group: 'org.sonatype.sisu.inject'
  }
}

Shouldn't the ratpack-groovy plugin be doing all that stuff automatically?

ldaley commented 11 years ago

You've somehow disabled transitive dependency resolution globally on your machine. Do you have an init script?

msgilligan commented 11 years ago

A Gradle init script? I don't think so. How would I check?

Note: both @michaelneale and I are having this problem.

msgilligan commented 11 years ago

If I comment out the compile line for ratpack-core, it still works, so I assume that at least one dependency is now being pulled in transitively.

Also, commenting out the apply plugin: 'java' breaks the build ("compile() method undefined", or something like that.)

ldaley commented 11 years ago

Ratpack-core is not a transitive. Your dependencies task output is missing all the transitives.

This is so strange. Thinking on it…

msgilligan commented 11 years ago

I'll email you my IM info and we can screen share or something if you like. I'm using Gradle through GVM, by the way.

msgilligan commented 11 years ago

Confirmed fixed by this commit: https://github.com/ratpack/ratpack/commit/97f7e057b9d7bea8af44c1f0109bb7626e860be2