These are chat archives for ceylon/ceylon-ide-eclipse

1st
Dec 2016
Gavin King
@gavinking
Dec 01 2016 00:22
I think so ... @davidfestal ?
Run As > Something Something Fat Jar
PKK Amos
@pkkamos_twitter
Dec 01 2016 04:59
fatJar.PNG
Not sure what this means @gavinking .
Capture.PNG
PKK Amos
@pkkamos_twitter
Dec 01 2016 05:05
If i did a normal Java project and wanted to export it as a Jar...This is the option Eclipse gives me. I seem not to see the "Something Something Fat jar". The "fat jar" from Ceylon perspective comes only when i do "Run as".
Gavin King
@gavinking
Dec 01 2016 06:57
Oh to export it, no there is no wizard yet. So use the command line
Or I guess running it as a fat jar will produce a fat jar as a side-effect
PKK Amos
@pkkamos_twitter
Dec 01 2016 06:58
@gavinking That was my thinking on("Or I guess running it as a fat jar will produce a fat jar as a side-effect")...but I don't see any activity on that on Eclipse.
Gavin King
@gavinking
Dec 01 2016 07:54
the fat jar would be produced directly in the project directory
refresh the project in Eclipse and you’ll see it
PKK Amos
@pkkamos_twitter
Dec 01 2016 08:02
Okay...let me check it.
PKK Amos
@pkkamos_twitter
Dec 01 2016 08:43
fatJar.PNG

@gavinking , Okay a few things i just observed. I created a new Ceylon project. Now, when I did the "run-as-fat-jar" from the compilation unit perspective i.e I right click on the compilation unit and "run-as-fat-jar". Upon referesh, I see two files generated namely: ceylonb and ceylonb.bat.

When I "run-as-fat-jar" from the project perspective i.e right clicking on the project name . I get the error i posted earlier.

Gavin King
@gavinking
Dec 01 2016 08:45
@pkkamos_twitter would you try with the CLI please?
ceylon fat-jar default
PKK Amos
@pkkamos_twitter
Dec 01 2016 08:45
Okay.

Another thing worth noting:

My default Java version for my Eclipse(Neon) is 8. I decided to change it to Java 7. Upon compilation. I run only to get the (Exception in thread "main" java.lang.UnsupportedClassVersionError: com/pkkamos/HelloWorld : Unsupported major.minor version 52.0)
A quick check from eclipse shows that the change was not effected...was still showing 8 on the SE modules.

Capture2.PNG
David Festal
@davidfestal
Dec 01 2016 08:59
Hi @pkkamos_twitter : Please open an issue about having an option to export the FatJar
as for the error you encounter, you should have details in the console window
do you have a console view related to the generation of the fat-jar ?
PKK Amos
@pkkamos_twitter
Dec 01 2016 09:03
No. The only detail is what I have captured in the image above.
David Festal
@davidfestal
Dec 01 2016 09:04
I'lltry to reproduce it and will come back to you
Gavin King
@gavinking
Dec 01 2016 09:05
@pkkamos_twitter but did you try running ceylon fat-jar from the command line, to see what messages you get?
David Festal
@davidfestal
Dec 01 2016 09:05
anyway, it's not expected to have such an error dialog, we should fail gracefully and provide logs in the console
Gavin King
@gavinking
Dec 01 2016 09:05
sure
PKK Amos
@pkkamos_twitter
Dec 01 2016 09:06
@gavinking I will be trying the CLI shortly.
Gavin King
@gavinking
Dec 01 2016 09:06
ok
PKK Amos
@pkkamos_twitter
Dec 01 2016 09:56

Running from CLI was successful.

G:\ceylon>F:\ceylon-1.3.1\bin\ceylon fat-jar --run=hello default
Warning: duplicate entry META-INF/errors.txt (from G:\ceylon\modules\default\default.car) already added: skipping
Warning: duplicate entry META-INF/hashes.txt (from G:\ceylon\modules\default\default.car) already added: skipping

G:\ceylon>java -jar default.jar
CLI Test

David Festal
@davidfestal
Dec 01 2016 09:57
ah, it's for the default module
I had not paid attention to this detail
might be that we don't support the default module very well
Gavin King
@gavinking
Dec 01 2016 09:57
@davidfestal yeah I wondered if that was the problem
David Festal
@davidfestal
Dec 01 2016 09:57
I'll try this case
PKK Amos
@pkkamos_twitter
Dec 01 2016 09:57
@davidfestal and @gavinking I will still wait for the Eclipse fix though...I am not a lover of CLI...hehe.
David Festal
@davidfestal
Dec 01 2016 09:57
@pkkamos_twitter could you try putting your code in a real module ?
instead of using the default module
which had very limited support in fact
since you cannot import external modules with it
PKK Amos
@pkkamos_twitter
Dec 01 2016 09:59
Okay. let me try that.
Tako Schotanus
@quintesse
Dec 01 2016 10:05

since you cannot import external modules with it

we should really get rid of this limitation some time

Bastien Jansen
@bjansen
Dec 01 2016 10:06
you want to add module descriptors for default modules?
Tako Schotanus
@quintesse
Dec 01 2016 10:06
yes
without imports the default module is basically useless
the only limitation it would have is that you still can't publish it (it doesn't have "identity")
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:07

@davidfestal it seems the ceylon command is not able to create any other module from CLI apart from "default"

G:\ceylon>F:\ceylon-1.3.1\bin\ceylon compile testmod
ceylon compile: Module testmod not found in source directories: source

Usage:
ceylon compile [--apt=<module>...] [--auto-export-maven-dependencies] [--
cacherep=<url>] [--cwd=<dir>] [--ee] [--ee-annotation=<value>...
] [--ee-import=<value>...] [--encoding=<encoding>] [--flat-
classpath] [--fully-export-maven-dependencies] [--generate-
module-info] [--include-dependencies[=<flags>]] [--incremental]
[--javac=<option>...] [--jdk-provider=<module>] [--maven-
overrides=<file>] [--no-default-repositories] [--no-osgi] [--no-
pom] [--offline] [--osgi-provided-bundles=<modules>] [--out=
<url>] [--overrides=<file>] [--pack200] [--pass=<secret>] [--
progress] [--rep=<url>...] [--resource=<dirs>...] [--resource-
root=<folder-name>] [--source=<dirs>...] [--src=<dirs>...] [--
suppress-warning[=<warnings>...]] [--sysrep=<url>] [--target=
<version>] [--timeout=<seconds>] [--user=<name>] [--verbose[=
<flags>]] [--] [<moduleOrFile...>]

Run 'ceylon help compile' for more help

Tako Schotanus
@quintesse
Dec 01 2016 10:07
ah and that you can't import it of course
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:08

When i specify with default i get this:

G:\ceylon>F:\ceylon-1.3.1\bin\ceylon compile default
Note: Created module default

Tako Schotanus
@quintesse
Dec 01 2016 10:08
@pkkamos_twitter you have to put your sources in a sub folder called "testmod" inside "source"
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:08
@quintesse let me try that.
Gavin King
@gavinking
Dec 01 2016 10:08
@pkkamos_twitter sure, you need to move your code to a testmod directory and add a module.ceylon module descriptor
Tako Schotanus
@quintesse
Dec 01 2016 10:08
basically the easiest way to do that is to run ceylon new module testmod
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:16

@quintesse ceylong new module testmod has created the module testmod nicely.

Running the generated jar - I get this:

G:\ceylon>java -jar testmod-1.0.0.jar
Error: Could not find or load main class modhello

Is there anything I have missed?

Tako Schotanus
@quintesse
Dec 01 2016 10:17
@pkkamos_twitter what is the fatjar command you used to generate the jar?
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:18
ceylon fat-jar --run=modhello testmod
Tako Schotanus
@quintesse
Dec 01 2016 10:19
And does the testmod contain a method called modhello?
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:20
Yes.

shared void modhello(){

print("TESTING...OTHER MODULES");

}

Tako Schotanus
@quintesse
Dec 01 2016 10:20
then you need to use its full name: testmod::modhello
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:20
Okay.
Like this ceylon fat-jar --run=testmod::modhello testmod?
Tako Schotanus
@quintesse
Dec 01 2016 10:21
yes indeed
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:22

G:\ceylon>F:\ceylon-1.3.1\bin\ceylon fat-jar --run=testmod::modhello testmod
Warning: duplicate entry META-INF/errors.txt (from G:\ceylon\modules\testmod\1.0.0\testmod-1.0.0.car) already added: skipping
Warning: duplicate entry META-INF/hashes.txt (from G:\ceylon\modules\testmod\1.0.0\testmod-1.0.0.car) already added: skipping

G:\ceylon>java -jar testmod-1.0.0.jar
Error: Could not find or load main class testmod.modhello_

Gavin King
@gavinking
Dec 01 2016 10:23
@pkkamos_twitter did you explicitly recompile? First run:
ceylon compile
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:23
Yes.
Gavin King
@gavinking
Dec 01 2016 10:24
i mean, I could be wrong, but it looks to me like you need to recompile first, before fat-jaring
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:25
Yes. That's exactly what i did.
Gavin King
@gavinking
Dec 01 2016 10:25
oh wait sorry it’s java -jar that fails
that’s weird
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:25
Yes.
Tako Schotanus
@quintesse
Dec 01 2016 10:25
@pkkamos_twitter are you able to run the code without the fat jar? By running ceylon run --run=testmod::modhello testmod?
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:25
It's fine when the module is "default"

Okay. So, I have tried the 2 scenarios

  1. Running with full name.
  2. Running with short name.

G:\ceylon>F:\ceylon-1.3.1\bin\ceylon run --run=testmod::modhello testmod
ceylon run: Could not find toplevel function 'testmod::modhello'.

#

G:\ceylon>F:\ceylon-1.3.1\bin\ceylon run --run=modhello testmod
ceylon run: Could not find toplevel function 'modhello'. Class and method names
need to be fully qualified, maybe you meant 'testmod::modhello'?


Gavin King
@gavinking
Dec 01 2016 10:29
I mean, either you don’t have a shared function named modhello() in the package testmod, or you have not compiled it
those are the only two possibilities :)
AFAICS
Tako Schotanus
@quintesse
Dec 01 2016 10:29
or the package is not shared, that could be it as well, right?
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:30

This is what I have:

shared void modhello(){

print("TESTING...OTHER MODULES");

}

Tako Schotanus
@quintesse
Dec 01 2016 10:31
So:
  1. check that your modhello() is shared
  2. check that the package in source/testmod/package.ceylon is shared
  3. compile again using ceylon compile testmod
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:31
  1. shared package testmod; #package.ceylon
  1. done again.
Still same results...maybe i will take a break and try again....lol!
Tako Schotanus
@quintesse
Dec 01 2016 10:34
What Java version are you using?
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:34
8
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b15, mixed mode)
Tako Schotanus
@quintesse
Dec 01 2016 10:34
If you want you can send the exact code in a zip and I'll see if there's anything weird going on :)
although what you're telling us seems so simple it should just work
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:35

Hahaha....this is the only code. Nothing fancy.

shared void modhello(){
print("TESTING...OTHER MODULES");
}

Tako Schotanus
@quintesse
Dec 01 2016 10:35
and if you change the name of modhello() to run()?
You can then leave out the --run option
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:36
Okay.
Tako Schotanus
@quintesse
Dec 01 2016 10:36
ceylon run testmod should then be enough
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:36
Yes.
Remember when the module was default....it ran nicely.
I definitely will try again later in the day.
Tako Schotanus
@quintesse
Dec 01 2016 10:37
sure, but default modules are really limited, better not to use them
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:39
Okay.
That's fine.
Great learning experience for me though!
Tako Schotanus
@quintesse
Dec 01 2016 10:40
Well yes, but it shouldn't be this hard! Not sure why that is, we should definitely figure out what's wrong
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:40
Right.
Gavin King
@gavinking
Dec 01 2016 10:41

Well yes, but it shouldn't be this hard!

I know this is very strange. Got me stumped.

@pkkamos_twitter and modhello() is really there in source/testmod/xxxx.ceylon?
you don’t have a strange filename or something?
Tako Schotanus
@quintesse
Dec 01 2016 10:43
ah yes, forgot to put that on the list, it should be a .ceylon file inside source/testmod
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:43
Capture3.PNG
Tako Schotanus
@quintesse
Dec 01 2016 10:44
and your modhello() is inside the run.ceylon file?
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:46

This is what i have in run.ceylon

"Run the module testmod."
shared void run(){
// Write your code here and afterwards
// on the command line compile with "ceylon compile testmod" or "ant compile"
// and execute with "ceylon run testmod/1.0.0" or "ant run"
}

Tako Schotanus
@quintesse
Dec 01 2016 10:47
Well, where is your modhello() method then?
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:47
The Utility that generated this must tell us...don't you think so? heheh.
how did modhello() turn to run()?
Tako Schotanus
@quintesse
Dec 01 2016 10:49
Well you need to read a little bit of the tour or something to at least know how modules work. So the code that you wrote before was for the "default" module. Now you created a "testmod" module which is a different module. The are separate so you need to move your code from the file you had before to the new module
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:50
hmmm.
Tako Schotanus
@quintesse
Dec 01 2016 10:50
there's probably a .ceylon file in source where your modhello() method is
PKK Amos
@pkkamos_twitter
Dec 01 2016 10:58
hmmm....So,

G:\ceylon>F:\ceylon-1.3.1\bin\ceylon run --run=testmod::modhello testmod
TESTING...OTHER MODULES

G:\ceylon>F:\ceylon-1.3.1\bin\ceylon fat-jar --run=testmod::modhello testmod
Warning: duplicate entry META-INF/errors.txt (from G:\ceylon\modules\testmod\1.0.0\testmod-1.0.0.car) already added: skipping
Warning: duplicate entry META-INF/hashes.txt (from G:\ceylon\modules\testmod\1.0.0\testmod-1.0.0.car) already added: skipping

G:\ceylon>java -jar testmod-1.0.0.jar
TESTING...OTHER MODULES

I moved the modhello.ceylon into the testmod folder. That's all I did...works now.
Gavin King
@gavinking
Dec 01 2016 10:59
@pkkamos_twitter so all the source code belonging to a module has to live in that module’s folder
just like how in Java the source code has to be in the folder corresponding to the package it belongs to
it’s the same
PKK Amos
@pkkamos_twitter
Dec 01 2016 11:00
Right.
Thank you once again! Will be looking out for the "fat-jar" on Eclipse as well.
David Festal
@davidfestal
Dec 01 2016 11:03
on Eclipse, the fat-jar run configuration only works with the default run method of the module
the --run option isn't supported for now
PKK Amos
@pkkamos_twitter
Dec 01 2016 11:03
Okay.
David Festal
@davidfestal
Dec 01 2016 11:03
but it will be
PKK Amos
@pkkamos_twitter
Dec 01 2016 11:04
Yes Sir.
David Festal
@davidfestal
Dec 01 2016 11:04
if you need it please open an issue on ceylon-ide-eclipse
PKK Amos
@pkkamos_twitter
Dec 01 2016 11:04
Okay...Please, what's the exact link/url?
Gavin King
@gavinking
Dec 01 2016 11:05
@davidfestal are you sure about that?
i seem to be able to select any method
oh i can select the method but then it fails
is there an issue for that already?
David Festal
@davidfestal
Dec 01 2016 11:06
select, you mean, in the Ceylon Explorer ?
Gavin King
@gavinking
Dec 01 2016 11:06
in the source file
David Festal
@davidfestal
Dec 01 2016 11:06
no, no issue for now
globally for the moment it's made to be called on a module
the call from inside an editor will simply call it on the module of the edited file
but still with the default run function
but sure we can enhance this to get the method name when the command is started from a context that designates a method
Gavin King
@gavinking
Dec 01 2016 11:09
ceylon/ceylon-ide-eclipse#1857
David Festal
@davidfestal
Dec 01 2016 11:11
Thanks !