ceylon-ide-eclipse
ceylon-ide-eclipse copied to clipboard
Using Ceylon from a Java (non Ceylon project) should be made easier
To reproduce: Create a workspace with two projects, one Ceylon, one pure Java.
Goal: use Ceylon objects from Java.
To actual get this to work properly in Eclipse Mars, the following magic is required, otherwise runtime errors occur when using the metadata loader and/or JDT gets out of sync:
- In the build configuration of Ceylon, export Ceylon Language Module and Ceylon Project Modules
- In the build configuration of Java, add a project dependency to the Ceylon project AND a class folder dependency on the .exploded folder.
- In the build configuration of Java, add a variable pointing to the module car.
- In the RUN configuration of Java, add a classpath dependency on the variable (going via a variable is due to a known Eclipse bug).
So let me summarize the current state of this: With the last master IDE (compiler from the master of all projects), the required actions are:
- in the required Ceylon projects, in the
Java Build Path
Properties Page, on theOrder and Export
tab, check theCeylon Language Module
andCeylon Project Modules
lines to export the corresponding classpath entries - in the Java project that uses Ceylon Projects, when trying to run it using
run as Java Application
, select theCeylon-Aware Eclipse JDT Launcher
. This is an extension of the standard JDT launcher that completes the classpath with the archives required by referenced Ceylon projects, as well as allows stepping into Ceylon code correctly during debug.
The metamodel registering should still be performed manually. For a command line program, using Main.instance().setup(<referencedCeylonModuleName>, <referencedCeylonModuleVersion>);
at the beginning of the program should be sufficient.