ceylon-ide-eclipse icon indicating copy to clipboard operation
ceylon-ide-eclipse copied to clipboard

Using Ceylon from a Java (non Ceylon project) should be made easier

Open ghost opened this issue 9 years ago • 1 comments

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:

  1. In the build configuration of Ceylon, export Ceylon Language Module and Ceylon Project Modules
  2. In the build configuration of Java, add a project dependency to the Ceylon project AND a class folder dependency on the .exploded folder.
  3. In the build configuration of Java, add a variable pointing to the module car.
  4. In the RUN configuration of Java, add a classpath dependency on the variable (going via a variable is due to a known Eclipse bug).

ghost avatar Nov 13 '15 17:11 ghost

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 the Order and Export tab, check the Ceylon Language Module and Ceylon 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 the Ceylon-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.

davidfestal avatar Feb 26 '16 18:02 davidfestal