Skip to content

Instantly share code, notes, and snippets.

@acisternino
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acisternino/6aadaaed6c568f30844d to your computer and use it in GitHub Desktop.
Save acisternino/6aadaaed6c568f30844d to your computer and use it in GitHub Desktop.
Groovy JavaFX HelloWorld
# Errors output by the Groovy compiler when the above class is compiled
# by Gradle in a very simple Groovy-Gradle project.
#
# Environment:
# OS: Windows 7
# Gradle: 2.0 & 2.1-rc-2 (both give the same error)
# Groovy: 2.3.6
# Java: 1.8.0_20
D:\Work\hellofx-groovy-gradle> gradle -i classes
Connected to the daemon. Dispatching Build{id=fa1ffa14-8fa6-4915-8c8a-f6bbb71c1c15.1, currentDir=D:\Work\hellofx-groovy-gradle} request.
The client will now receive all logging from the daemon (pid: 1012). The daemon log file: C:\Users\andrea\.gradle\daemon\2.0\daemon-1012.out.log
Executing build with daemon context: DefaultDaemonContext[uid=51fae0a3-969c-404e-9ce7-1e47e1ca2c9e,javaHome=C:\Program Files (x86)\Java\jdk1.8.0_20,daemonRegistryDir=C:\Users\andrea\.gradle\daemon,pid=1012,idleTimeout=10800000,daemonOpts=-Xms64m,-Xmx512m,-Dfile.encoding=windows-1252]
Starting Build
Settings evaluated using empty settings script.
Projects loaded. Root project using build file 'D:\Work\hellofx-groovy-gradle\build.gradle'.
Included projects: [root project 'hellofx-groovy-gradle']
Evaluating root project 'hellofx-groovy-gradle' using build file 'D:\Work\hellofx-groovy-gradle\build.gradle'.
All projects evaluated.
Selected primary task 'DefaultTaskParameter{taskName='classes',projectPath='null'}'
Tasks to be executed: [task ':compileJava', task ':compileGroovy', task ':processResources', task ':classes']
:compileJava (Thread[Daemon,5,main]) started.
:compileJava
In-memory cache of D:\Work\hellofx-groovy-gradle\.gradle\2.0\taskArtifacts\fileHashes.bin: Size{0}, CacheStats{hitCount=0, missCount=0, loadSuccessCount=0, loadExceptionCount=0, totalLoadTime=0, evictionCount=0}
In-memory cache of D:\Work\hellofx-groovy-gradle\.gradle\2.0\taskArtifacts\outputFileStates.bin: Size{0}, CacheStats{hitCount=0, missCount=0, loadSuccessCount=0, loadExceptionCount=0, totalLoadTime=0, evictionCount=0}
In-memory cache of D:\Work\hellofx-groovy-gradle\.gradle\2.0\taskArtifacts\fileSnapshots.bin: Size{0}, CacheStats{hitCount=0, missCount=0, loadSuccessCount=0, loadExceptionCount=0, totalLoadTime=0, evictionCount=0}
In-memory cache of D:\Work\hellofx-groovy-gradle\.gradle\2.0\taskArtifacts\taskArtifacts.bin: Size{0}, CacheStats{hitCount=0, missCount=0, loadSuccessCount=0, loadExceptionCount=0, totalLoadTime=0, evictionCount=0}
Skipping task ':compileJava' as it has no source files.
:compileJava UP-TO-DATE
:compileJava (Thread[Daemon,5,main]) completed. Took 0.006 secs.
:compileGroovy (Thread[Daemon,5,main]) started.
:compileGroovy
Invalidating in-memory cache of D:\Work\hellofx-groovy-gradle\.gradle\2.0\taskArtifacts\taskArtifacts.bin
Invalidating in-memory cache of D:\Work\hellofx-groovy-gradle\.gradle\2.0\taskArtifacts\fileSnapshots.bin
Invalidating in-memory cache of D:\Work\hellofx-groovy-gradle\.gradle\2.0\taskArtifacts\fileHashes.bin
Invalidating in-memory cache of D:\Work\hellofx-groovy-gradle\.gradle\2.0\taskArtifacts\outputFileStates.bin
Executing task ':compileGroovy' (up-to-date check took 0.241 secs) due to:
No history is available.
Starting process 'Gradle Compiler Daemon 1'. Working directory: D:\Work\hellofx-groovy-gradle Command: C:\Program Files (x86)\Java\jdk1.8.0_20\bin\java.exe -Dfile.encoding=windows-1252 -cp D:\Software\gradle-2.0\lib\gradle-base-services-2.0.jar;D:\Software\gradle-2.0\lib\gradle-core-2.0.jar;D:\Software\gradle-2.0\lib\gradle-cli-2.0.jar;D:\Software\gradle-2.0\lib\gradle-native-2.0.jar;D:\Software\gradle-2.0\lib\gradle-messaging-2.0.jar;D:\Software\gradle-2.0\lib\slf4j-api-1.7.5.jar;D:\Software\gradle-2.0\lib\logback-classic-1.0.13.jar;D:\Software\gradle-2.0\lib\logback-core-1.0.13.jar;D:\Software\gradle-2.0\lib\jul-to-slf4j-1.7.5.jar;D:\Software\gradle-2.0\lib\guava-jdk5-17.0.jar org.gradle.process.internal.launcher.GradleWorkerMain
Successfully started process 'Gradle Compiler Daemon 1'
Started Gradle compiler daemon (0.487 secs) with fork options DaemonForkOptions{minHeapSize=null, maxHeapSize=null, jvmArgs=[], classpath=[C:\Users\andrea\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy\2.3.6\58479615c4a53124169506b0275de5cf366b0f35\groovy-2.3.6.jar, D:\Software\gradle-2.0\lib\ant-1.9.3.jar, D:\Software\gradle-2.0\lib\ant-launcher-1.9.3.jar]}.
Executing org.gradle.api.internal.tasks.compile.ApiGroovyCompiler@754635 in compiler daemon.
startup failed:
D:\Work\hellofx-groovy-gradle\src\main\groovy\helloworld\HelloWorldFx.groovy: 5: unable to resolve class javafx.scene.control.Button
@ line 5, column 1.
import javafx.scene.control.Button
^
D:\Work\hellofx-groovy-gradle\src\main\groovy\helloworld\HelloWorldFx.groovy: 7: unable to resolve class javafx.stage.Stage
@ line 7, column 1.
import javafx.stage.Stage
^
Exception executing org.gradle.api.internal.tasks.compile.ApiGroovyCompiler@754635 in compiler daemon: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details..
D:\Work\hellofx-groovy-gradle\src\main\groovy\helloworld\HelloWorldFx.groovy: 4: unable to resolve class javafx.scene.Scene
@ line 4, column 1.
import javafx.scene.Scene
^
D:\Work\hellofx-groovy-gradle\src\main\groovy\helloworld\HelloWorldFx.groovy: 3: unable to resolve class javafx.application.Application
@ line 3, column 1.
import javafx.application.Application
^
D:\Work\hellofx-groovy-gradle\src\main\groovy\helloworld\HelloWorldFx.groovy: 6: unable to resolve class javafx.scene.layout.StackPane
@ line 6, column 1.
import javafx.scene.layout.StackPane
^
5 errors
:compileGroovy FAILED
:compileGroovy (Thread[Daemon,5,main]) completed. Took 1.127 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileGroovy'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
Total time: 1.809 secs
Stopped 1 compiler daemon(s).
package helloworld
import javafx.application.Application
import javafx.scene.Scene
import javafx.scene.control.Button
import javafx.scene.layout.StackPane
import javafx.stage.Stage
import groovy.transform.CompileStatic
@CompileStatic
class HelloWorldFx extends Application {
static void main(String[] args) {
launch(args)
}
@Override
void start(Stage primaryStage) {
def btn = new Button()
btn.text = "Say 'Hello World'"
btn.onAction = { println 'Hello World!' }
def root = new StackPane()
root.children.add btn
primaryStage.title = 'Hello World!'
primaryStage.scene = new Scene(root, 300, 250)
primaryStage.show()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment