groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerald Wiltse <jerrywil...@gmail.com>
Subject Re: Question about GroovyClassLoader, Imoprt, and ContentAssist
Date Wed, 30 Dec 2015 20:52:10 GMT
Thanks for your help Jochen.  I wanted to close the loop on this thread and
state that the problem was that they were not in the correct location
according to the package structure. I also had other problems resulting in
my symptoms, but I got them cleared up.

Gerald R. Wiltse
jerrywiltse@gmail.com
248-893-9110 (c)
888-248-7095 (p)
888-272-6046 (f)

On Sat, Dec 19, 2015 at 3:49 AM, Jochen Theodorou <blackdrag@gmx.org> wrote:

> On 18.12.2015 20:12, Gerald Wiltse wrote:
> [...]
>
>> Problem, This appears to be possible using GroovyClassLoader() (and
>> several people have posted how-tos). However, the problem I have that
>> nobody else seems to reference is that this strategy means that content
>> assist will never be able to identify your classes and methods, and your
>> code will be full of underlines, and receive no error checking. (eclipse
>> and otherwise i would think).
>>
>
> if the scripts are available to the IDE and in the right position (eclipse
> needs them to be in the right folders according to the package structure),
> then it should work
>
> [...]
>
>> As I was building my project, I was creating the scripts and the classes
>> in the package just like normal a program. When I add my import
>> statements for my custom classes, Eclipse recognizes everything and
>> content assist is happy. However, despite content assist being
>> satisfied, it hits a snag when I try to execute a script because eclipse
>> returns: unable to resolve class (presumably because it's still only a
>> groovy file, and not compiled to a class file).
>>
>
> if eclipse tries to execute the class directly, then it won't work, yes.
> You can use GroovyMain#main and the script as first argument for this
> though... I did that all the time. The JVM needs some kind of starter for
> the groovy scripts, since it does not understand groovy sciprts. If that is
> GroovyMain, or something you wrote, which uses GroovyClassLoader does not
> really matter. Eclipse does imho a compilation and then uses the class to
> run the program. The setup with GroovyMain is something I always do
> manually.
>
> So, I looked around and it looks like I have to comment out the import
>> statement, and then use groovyclassloader to parse the groovy file
>> instead. However, this has the negative side effect of breaking content
>> assist.
>>
>
> well, it is a bit unclear to me how you actually start the program now.
>
> Question: Are my conclusions above all basically correct?
>>
>> Suggestion: Is there any known way to have content-assist work
>> along-side with GroovyClassLoader? Maybe some way to tell it to ignore
>> failed imports or something?
>>
>
> failed imports cannot be ignored, no. But I think it is really more a
> problem of your setup. Maybe you should describe the following things:
> (1) how exactly do you start the groovy program?
> (2) what is your file structure?
>
> After that we can maybe help.
>
> bye Jochen
>
>

Mime
View raw message