1

Today i installed the intelliJ ceylon IDE on my macbook. When compiling my project I get the following message

/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java "-Dceylon.system.repo=/Users/Laust/Library/ApplicationSupport/IdeaIC2016.3/CeylonIDEA/classes/embeddedDist/repo" -Didea.launcher.port=7533 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Users/Laust/Library/Application Support/IdeaIC2016.3/CeylonIDEA/classes/embeddedDist/lib/ceylon-bootstrap.jar:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain com.redhat.ceylon.launcher.Bootstrap run --run main default/unversioned
ceylon run: Module default/unversioned not found in the following repositories:
 /Users/Laust/Library/Application Support/IdeaIC2016.
3/CeylonIDEA/classes/embeddedDist/repo
 /Users/Laust/.ceylon/cache
 https://modules.ceylon-lang.org/repo/1
 [Maven] Aether
 [NPM] npm

Process finished with exit code 1

The code executes fine on my other computer (windows 7).

the folder 'modules' contains the following:

default
    default.car
    default.car.sha1
    default.src
    default.src.sha1

and my build configuration looks as follows.

this is my code (in the file source/main.ceylon)

shared void main() {
    print("Generating pretty sweet g-code:");

    {Gcommand+} myGcommands = {
        G00( Vector3(0.0, 0.0, 0.0) ),
        G00( Vector3(9.0, 0.0, 0.0) ),
        G00( Vector3(9.0, 9.0, 0.0) ),
        G00( Vector3(0.0, 9.0, 0.0) ),
        G00( Vector3(0.0, 0.0, 0.0) )
    };

    GcodeProgram myGcodeProgram = GcodeProgram( *myGcommands );

    print(myGcodeProgram.toString());
}

"A carthesian coordinate class"
alias X => Float;
alias Y => Float;
alias Z => Float;
class Vector3(shared X x, shared Y y, shared Z z) {
}

"An abstract spec class for all G-code command classes"
abstract class Gcommand() {
    shared formal String toString();
}

"G-code command for moving in a straight line at rapid speed"
class G00( Vector3 endPoint ) extends Gcommand() {
    toString() => "G0 " + "X" + endPoint.x.string
                        + "Y" + endPoint.y.string
                        + "Z" + endPoint.z.string + "\n";
}

class GcodeProgram( Gcommand+ gcommands ) {

    variable String stringifiedGcodeProgram = "";

    shared String toString() {
        for (gcommand in gcommands) {
            stringifiedGcodeProgram = stringifiedGcodeProgram + gcommand.toString();
        }
    return stringifiedGcodeProgram;
    }
}
Kadziola
  • 13
  • 2

4 Answers4

3

The screenshot you provided shows that the run configuration isn't based on any IntelliJ module (Use classpath of module is set to [none]). This means that the configuration will not be run in your project folder where the modules directory lives. That directory contains the compiled code, and ceylon run will look for that directory when you ask it to run the default module.

Generally speaking, you should avoid creating run configurations manually. By clicking on the green arrow next to a runnable function's name, Ceylon IDE will automatically create and configure a correct run configuration.

Run Ceylon function

To fix your existing run configuration, simply select the IntelliJ module that contains your code in the field labeled Use classpath of module.

See also the getting started guide for more information on how to get started with Ceylon IDE for IntelliJ.

Bastien Jansen
  • 8,756
  • 2
  • 35
  • 53
  • 1
    If you choose to have a new, correct, run configuration built for you automatically, do remember to delete the old, faulty, run configuration afterwards (or perhaps before, so you don't confuse them). Do so in 'Run' -> 'Edit configurations'. –  Feb 04 '17 at 20:05
0

That might be a bug with the IntelliJ plugin not handling "default" modules correctly. We tend not to use default modules much because they're more limited than regular modules.

Try creating a module and moving your code to it. THat will most likely fix the problem. If so you can then open an issue to have this bug fixed here: https://github.com/ceylon/ceylon-ide-intellij/issues/new

Quintesse
  • 452
  • 2
  • 9
  • This explanation seems pretty speculative to me. Looks far more likely to be a problem with the project configuration. – Gavin King Feb 04 '17 at 14:16
0

In this question, the first (and only) answer tells how to create a new module.

I have a few comments to that answer:

  • when beginning on a new project, you probably don't need an intricate nested naming hierarchy for your modules. You will get that, if you use periods in your module name (eg. my.ceylon.example), so I suggest you stick to a simple name such as main.
  • when creating your new module, you will (among other things) be asked to specify a 'Runnable unit name'. The purpose of this field is to tell IntelliJ which of your modules' classes it should execute when starting your program. In other words, this becomes the entry point to your program. A suitable name for this could (also) be main.
  • Ceylon projects are divided into modules, modules are divided into packages, and packages are divided into classes and top-level functions. When you create a module, a package is automatically created under this module. The path for your code files under this module will be 'source/moduleName/packageName'. When creating a new module, you don't get to specify the name for the first package in the module. Instead the package is given the same name as your module name. Thus a module named 'main' would have this path: source/main/main as the path for it's code files.
  • In your new modules folder (eg. source/main/main) three new files will be created. Find the file that is named after the 'Runnable unit name' you chose earlier. Your code should go into this file. Also, your code should have a class with the exact same name that you chose as your 'Runnable unit name'.
  • the answer used the fancy term 'runnable unit', by which he just means a file containing Ceylon code.
  • remember to delete the file containing your old 'default' module, before trying to run your new module.
  • a module name cannot start with a capital letter.
  • modules/ is the output directory where compiled code goes. It is automatically recreated from the code in source/ when the project is built.
Community
  • 1
  • 1
0

There appears to be something messed up in the project setup here. Note the list of repos that are being searched:

Module default/unversioned not found in the following repositories:
 /Users/Laust/Library/Application Support/IdeaIC2016.3/CeylonIDEA/classes/embeddedDist/repo
 /Users/Laust/.ceylon/cache
 https://modules.ceylon-lang.org/repo/1
 [Maven] Aether
 [NPM] npm

I would expect to see a repo of form your-project-dir/modules as the second entry in that list, but it's not there.

That is to say, ceylon run is not looking in the modules directory where the compiled .car is. So the question is why that repo is missing from the list.

What do you see in Project Structure > Modules > Ceylon > Repositories?

Gavin King
  • 3,182
  • 1
  • 13
  • 11