通过右键单击一个函数并选择“运行函数名称”,我设法在“演练”存储库中编译和执行 Cyelon 代码。
我还尝试创建自己的 Ceylon 项目(名为 POSTtoFile)并查看是否可以从那里执行“Hello World”功能。我不能。我想我必须为我的项目创建某种构建配置,但我不知道在这些表单字段中填写什么:
安装 Ceylon IDE for IntelliJ指南对这个问题完全没有提及。如果它包含一个名为“制作你的第一个锡兰”项目的部分,那就太好了。令人尴尬的是,该文档的所有以前的读者都必须事先知道这些内容。所以我在这里!唯一的例外。
在“Ceylon 模块”下拉菜单中,有一个选项,名为module default "unversioned"
. 我尝试选择那个,然后单击“运行”->“运行 POSTtoFile”。我得到了这个输出:
"C:\Program Files\Java\jdk1.8.0_121\bin\java" -Dceylon.system.repo=C:\Users\Jon\.IdeaIC2016.3\config\plugins\CeylonIDEA\classes\embeddedDist\repo -Didea.launcher.port=7536 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3.3\bin" -Dfile.encoding=windows-1252 -classpath "C:\Users\Jon\.IdeaIC2016.3\config\plugins\CeylonIDEA\classes\embeddedDist\lib\ceylon-bootstrap.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.redhat.ceylon.launcher.Bootstrap run --run "" default/unversioned
ceylon run: Module default/unversioned not found in the following repositories:
C:\Users\Jon\.IdeaIC2016.3\config\plugins\CeylonIDEA\classes\embeddedDist\repo
C:\Users\Jon\Auchitect\POSTtoFile\modules
C:\Users\Jon\.ceylon\cache
https://modules.ceylon-lang.org/repo/1
[Maven] Aether
[NPM] npm
Process finished with exit code 1
编辑:
从下面的屏幕截图中可以看出,IntelliJ 窗口底部没有工具栏,也没有看到名为“Ceylon 问题”的工具窗口:
至于你的其他问题:
- “模块”文件夹为空
- 当我单击时,IntelliJ 似乎可以工作
Build>Rebuild Project
。这是输出:
- 这些是我的版本号:
当我将以下代码放入我的
main.ceylon
文件中时:共享 void hello() { print("Hello , World!"); }
(抱歉,堆栈溢出不会将其格式化为代码,即使我在每行前面有 4 个空格)
我得到功能左侧的绿色箭头hello
,但是我无法单击它。它说“这里什么都没有”:
编辑 2:我尝试将源代码文件 ( main.ceilon
) 从根目录 ( POSTtoFile
) 移动到源目录 ( POSTtoFile/source
)。然后我点击Run
-> Run 'POSTtoFile'
。
这给了我以下新输出:
"C:\Program Files\Java\jdk1.8.0_121\bin\java" -Dceylon.system.repo=C:\Users\Jon\.IdeaIC2016.3\config\plugins\CeylonIDEA\classes\embeddedDist\repo -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3.3\bin" -Dfile.encoding=windows-1252 -classpath "C:\Users\Jon\.IdeaIC2016.3\config\plugins\CeylonIDEA\classes\embeddedDist\lib\ceylon-bootstrap.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.redhat.ceylon.launcher.Bootstrap run --run "" default/unversioned
ceylon run: String index out of range: 0
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:658)
at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:53)
at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:105)
at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:101)
at ceylon.modules.Main.execute(Main.java:69)
at ceylon.modules.Main.main(Main.java:42)
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 org.jboss.modules.Module.run(Module.java:308)
at org.jboss.modules.Main.main(Main.java:487)
at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:292)
at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:547)
at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:423)
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.redhat.ceylon.launcher.Launcher.runInJava7Checked(Launcher.java:108)
at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:38)
at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:31)
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.redhat.ceylon.launcher.Bootstrap.runVersion(Bootstrap.java:162)
at com.redhat.ceylon.launcher.Bootstrap.runInternal(Bootstrap.java:117)
at com.redhat.ceylon.launcher.Bootstrap.run(Bootstrap.java:93)
at com.redhat.ceylon.launcher.Bootstrap.main(Bootstrap.java:85)
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.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Process finished with exit code 2
这是的内容main.ceilon
:
shared void hello() {
print("Hello , World!");
}
编辑 3:
将内容更改为以下内容后main.ceilon
:
void hello() {
print("Hello, World!");
}
hello();
我在做Run
->时得到这个输出Run 'POSTtoFile'
:
现在突然间我Ceylon problems
在底部工具栏中有了按钮!它说我有三个问题:
incorrect syntax: no viable alternative at token end of file.
missing declaration or argument name.
not an annotation constructor: hello
不过,我不明白为什么会出错,因为我的代码直接来自Tour of Ceylon。