brainless-studios / alchemist

Other
2 stars 1 forks source link

not runnable in with gradle build #13

Open meltzow opened 8 years ago

meltzow commented 8 years ago

in eclipse its working. but if you run "./gradlew sample:run" in terminal you get an exception

Exception in Application start method java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389) at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767) Caused by: java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalStateException: Location is not set. at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2434) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409) at com.brainless.alchemist.view.util.ViewLoader.loadFXMLForControl(ViewLoader.java:48) at com.brainless.alchemist.view.util.ViewLoader.loadFXMLForControl(ViewLoader.java:34) at plugin.infiniteWorld.editor.view.WorldEditor.(WorldEditor.java:32) at plugin.infiniteWorld.editor.view.WorldEditorTab.(WorldEditorTab.java:9) at app.MainSample.onIntialize(MainSample.java:116) at com.brainless.alchemist.view.Alchemist.start(Alchemist.java:46) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863) at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326) at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at com.sun.glass.ui.gtk.GtkApplication.lambda$null$49(GtkApplication.java:139) ... 1 more Exception running application app.MainSample AL lib: (EE) alc_cleanup: 1 device not closed :sampleProject:run FAILED

FAILURE: Build failed with an exception.

methusalah commented 8 years ago

I've news here :

at command line, gradle build a jar and you have to ask him to include ressources.

adding sourceSets.main.resources.include "*/.fxml" in the sample project build.gradle resolve the problem.

Then, you have exceptions because all assets are not added inside the jar.

adding sourceSets.main.resources.include "/." resolves all issue and everithing runs correctly at command line by my side.

What I don't understand is that it was working, as far as I remember with OpenRTS, but there is no "include" mention.

methusalah commented 8 years ago

It would be great to find a way to make gradle point to the external assets directory, thought. including all assets into the jar is more a trick than a fix.