Developing groovyScripts in the IDE

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Developing groovyScripts in the IDE

Daniel Watford
Hello,

I use IntelliJ for ofbiz development, but have found it awkward to work
with groovyScript files.

Each time I would view a groovyScript file IntelliJ would display a warning
that the file was not associated with a Groovy SDK and prompt me to select
one. Further, I couldn't navigate from a groovyScript file to other ofbiz
classes.

IntelliJ imports the project script from the build.gradle file, so any
changes I might have manually made to ease IDE development of groovyScript
files were lost as soon as I reimported build.gradle.

To address this I needed to add the groovyScript files to the gradle build
in some way, while at the same time preventing the files from being built
and turned into classes.

Some minor changes to the build.gradle file have been added to a branch
here -
https://github.com/danwatford/ofbiz-framework/tree/groovyScript-gradle

I have tested these build.gradle changes in IntelliJ and can now navigate
from groovyScript to ofbiz classes.

Please could other IDE users (eclipse, netbeans, etc0 try out the changes
in the branch to see if the developer experience is improved when importing
the ofbiz project structure from the gradle build file.

Thanks,

Dan.

--
Daniel Watford
Reply | Threaded
Open this post in threaded view
|

Re: Developing groovyScripts in the IDE

Pritam Kute
Hello Emad,

I have tried those changes and can confirm that those are working as
expected. Thanks!

Kind Regards,
--
Pritam Kute


On Sun, Jan 17, 2021 at 9:01 PM Daniel Watford <[hidden email]> wrote:

> Hello,
>
> I use IntelliJ for ofbiz development, but have found it awkward to work
> with groovyScript files.
>
> Each time I would view a groovyScript file IntelliJ would display a warning
> that the file was not associated with a Groovy SDK and prompt me to select
> one. Further, I couldn't navigate from a groovyScript file to other ofbiz
> classes.
>
> IntelliJ imports the project script from the build.gradle file, so any
> changes I might have manually made to ease IDE development of groovyScript
> files were lost as soon as I reimported build.gradle.
>
> To address this I needed to add the groovyScript files to the gradle build
> in some way, while at the same time preventing the files from being built
> and turned into classes.
>
> Some minor changes to the build.gradle file have been added to a branch
> here -
> https://github.com/danwatford/ofbiz-framework/tree/groovyScript-gradle
>
> I have tested these build.gradle changes in IntelliJ and can now navigate
> from groovyScript to ofbiz classes.
>
> Please could other IDE users (eclipse, netbeans, etc0 try out the changes
> in the branch to see if the developer experience is improved when importing
> the ofbiz project structure from the gradle build file.
>
> Thanks,
>
> Dan.
>
> --
> Daniel Watford
>
grv
Reply | Threaded
Open this post in threaded view
|

Re: Developing groovyScripts in the IDE

grv
Hi Daniel

I am on Eclipse most of the time and use the gradle eclipse plug-in to just
build the classpath. I have not faced this issue on Eclipse so can't speak
to that.

That said, I see no issues with selecting SDK or compiler for the Groovy
files. I do it on eclipse and it works without generating dupes. I launch
OFBiz from within IDE and can navigate to other OFBiz classes as well.

I'll also give it a try on IntelliJ and let you know how it goes.

Best,
Girish




On Mon, Jan 18, 2021 at 1:32 PM Pritam Kute <[hidden email]>
wrote:

> Hello Emad,
>
> I have tried those changes and can confirm that those are working as
> expected. Thanks!
>
> Kind Regards,
> --
> Pritam Kute
>
>
> On Sun, Jan 17, 2021 at 9:01 PM Daniel Watford <[hidden email]> wrote:
>
> > Hello,
> >
> > I use IntelliJ for ofbiz development, but have found it awkward to work
> > with groovyScript files.
> >
> > Each time I would view a groovyScript file IntelliJ would display a
> warning
> > that the file was not associated with a Groovy SDK and prompt me to
> select
> > one. Further, I couldn't navigate from a groovyScript file to other ofbiz
> > classes.
> >
> > IntelliJ imports the project script from the build.gradle file, so any
> > changes I might have manually made to ease IDE development of
> groovyScript
> > files were lost as soon as I reimported build.gradle.
> >
> > To address this I needed to add the groovyScript files to the gradle
> build
> > in some way, while at the same time preventing the files from being built
> > and turned into classes.
> >
> > Some minor changes to the build.gradle file have been added to a branch
> > here -
> > https://github.com/danwatford/ofbiz-framework/tree/groovyScript-gradle
> >
> > I have tested these build.gradle changes in IntelliJ and can now navigate
> > from groovyScript to ofbiz classes.
> >
> > Please could other IDE users (eclipse, netbeans, etc0 try out the changes
> > in the branch to see if the developer experience is improved when
> importing
> > the ofbiz project structure from the gradle build file.
> >
> > Thanks,
> >
> > Dan.
> >
> > --
> > Daniel Watford
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Developing groovyScripts in the IDE

Jacques Le Roux
Administrator
Hi Daniel, All,

I use only Eclipse (for 15+ years and 2020-12 currently) with[1]+[2] and I have no problems with classpath nor navigation to Java classes from Groovy
scripts

[1] Buildship: Eclipse Plug-ins for Gradle, provided as part of the Gradle Platform.
[2] Eclipse Groovy Development Tools. Provides the main plug-ins to create and work with Groovy artifacts. It provides a powerful editor, code
completion, syntax-highlighting, JUnit support, wizards and a seamless integration into the Java development functionality.

FWIW, HTH

Jacques

Le 18/01/2021 à 09:54, Girish Vasmatkar a écrit :

> Hi Daniel
>
> I am on Eclipse most of the time and use the gradle eclipse plug-in to just
> build the classpath. I have not faced this issue on Eclipse so can't speak
> to that.
>
> That said, I see no issues with selecting SDK or compiler for the Groovy
> files. I do it on eclipse and it works without generating dupes. I launch
> OFBiz from within IDE and can navigate to other OFBiz classes as well.
>
> I'll also give it a try on IntelliJ and let you know how it goes.
>
> Best,
> Girish
>
>
>
>
> On Mon, Jan 18, 2021 at 1:32 PM Pritam Kute <[hidden email]>
> wrote:
>
>> Hello Emad,
>>
>> I have tried those changes and can confirm that those are working as
>> expected. Thanks!
>>
>> Kind Regards,
>> --
>> Pritam Kute
>>
>>
>> On Sun, Jan 17, 2021 at 9:01 PM Daniel Watford <[hidden email]> wrote:
>>
>>> Hello,
>>>
>>> I use IntelliJ for ofbiz development, but have found it awkward to work
>>> with groovyScript files.
>>>
>>> Each time I would view a groovyScript file IntelliJ would display a
>> warning
>>> that the file was not associated with a Groovy SDK and prompt me to
>> select
>>> one. Further, I couldn't navigate from a groovyScript file to other ofbiz
>>> classes.
>>>
>>> IntelliJ imports the project script from the build.gradle file, so any
>>> changes I might have manually made to ease IDE development of
>> groovyScript
>>> files were lost as soon as I reimported build.gradle.
>>>
>>> To address this I needed to add the groovyScript files to the gradle
>> build
>>> in some way, while at the same time preventing the files from being built
>>> and turned into classes.
>>>
>>> Some minor changes to the build.gradle file have been added to a branch
>>> here -
>>> https://github.com/danwatford/ofbiz-framework/tree/groovyScript-gradle
>>>
>>> I have tested these build.gradle changes in IntelliJ and can now navigate
>>> from groovyScript to ofbiz classes.
>>>
>>> Please could other IDE users (eclipse, netbeans, etc0 try out the changes
>>> in the branch to see if the developer experience is improved when
>> importing
>>> the ofbiz project structure from the gradle build file.
>>>
>>> Thanks,
>>>
>>> Dan.
>>>
>>> --
>>> Daniel Watford
>>>
Reply | Threaded
Open this post in threaded view
|

Re: Developing groovyScripts in the IDE

Daniel Watford
Hello,

I spent some more time trying to see if I could get IntelliJ to handle
groovyScript files without making changes to build.gradle, but cannot find
any other workarounds.

Although we don't generally want to put lots of IDE specific code into our
sources, we do seem to do this occasionally since we include
OfbizDslDescriptorForIntelliJ.gdsl and OfbizDslDescriptorForEclipse.dsld to
improve the developer experience.

Further, the change I'm proposing isn't really IntelliJ specific, it is
just the only way I can get IntelliJ to recognise groovyScript files.

Therefore if there are no objections to this change, and if no issues are
reported by other IDE users, I'll merge it in a few days.

Thanks,

Dan.

On Wed, 20 Jan 2021 at 10:31, Jacques Le Roux <[hidden email]>
wrote:

> Hi Daniel, All,
>
> I use only Eclipse (for 15+ years and 2020-12 currently) with[1]+[2] and I
> have no problems with classpath nor navigation to Java classes from Groovy
> scripts
>
> [1] Buildship: Eclipse Plug-ins for Gradle, provided as part of the Gradle
> Platform.
> [2] Eclipse Groovy Development Tools. Provides the main plug-ins to create
> and work with Groovy artifacts. It provides a powerful editor, code
> completion, syntax-highlighting, JUnit support, wizards and a seamless
> integration into the Java development functionality.
>
> FWIW, HTH
>
> Jacques
>
> Le 18/01/2021 à 09:54, Girish Vasmatkar a écrit :
> > Hi Daniel
> >
> > I am on Eclipse most of the time and use the gradle eclipse plug-in to
> just
> > build the classpath. I have not faced this issue on Eclipse so can't
> speak
> > to that.
> >
> > That said, I see no issues with selecting SDK or compiler for the Groovy
> > files. I do it on eclipse and it works without generating dupes. I launch
> > OFBiz from within IDE and can navigate to other OFBiz classes as well.
> >
> > I'll also give it a try on IntelliJ and let you know how it goes.
> >
> > Best,
> > Girish
> >
> >
> >
> >
> > On Mon, Jan 18, 2021 at 1:32 PM Pritam Kute <
> [hidden email]>
> > wrote:
> >
> >> Hello Emad,
> >>
> >> I have tried those changes and can confirm that those are working as
> >> expected. Thanks!
> >>
> >> Kind Regards,
> >> --
> >> Pritam Kute
> >>
> >>
> >> On Sun, Jan 17, 2021 at 9:01 PM Daniel Watford <[hidden email]>
> wrote:
> >>
> >>> Hello,
> >>>
> >>> I use IntelliJ for ofbiz development, but have found it awkward to work
> >>> with groovyScript files.
> >>>
> >>> Each time I would view a groovyScript file IntelliJ would display a
> >> warning
> >>> that the file was not associated with a Groovy SDK and prompt me to
> >> select
> >>> one. Further, I couldn't navigate from a groovyScript file to other
> ofbiz
> >>> classes.
> >>>
> >>> IntelliJ imports the project script from the build.gradle file, so any
> >>> changes I might have manually made to ease IDE development of
> >> groovyScript
> >>> files were lost as soon as I reimported build.gradle.
> >>>
> >>> To address this I needed to add the groovyScript files to the gradle
> >> build
> >>> in some way, while at the same time preventing the files from being
> built
> >>> and turned into classes.
> >>>
> >>> Some minor changes to the build.gradle file have been added to a branch
> >>> here -
> >>> https://github.com/danwatford/ofbiz-framework/tree/groovyScript-gradle
> >>>
> >>> I have tested these build.gradle changes in IntelliJ and can now
> navigate
> >>> from groovyScript to ofbiz classes.
> >>>
> >>> Please could other IDE users (eclipse, netbeans, etc0 try out the
> changes
> >>> in the branch to see if the developer experience is improved when
> >> importing
> >>> the ofbiz project structure from the gradle build file.
> >>>
> >>> Thanks,
> >>>
> >>> Dan.
> >>>
> >>> --
> >>> Daniel Watford
> >>>
>


--
Daniel Watford
Reply | Threaded
Open this post in threaded view
|

Re: Developing groovyScripts in the IDE

Pawan Verma
Hi Dan,

I use IntelliJ 2019.1 Ultimate Edition(I know it's too old) and have a
Groovy SDK setup(groovy-2.5.7). For me it works well, I am also able to
navigate between other OFBiz Classes from GroovyScript files.

I've tried removing the Groovy SDK and set it up as a fresh one and
recorded a short video for your reference. Please have a look and let me
know if it works for you.

Video Link:
https://drive.google.com/file/d/1mhR28dn_buIaiB0vDs7a714PV05H_Bin/view?usp=sharing
--
Thanks & Regards
Pawan Verma
Technical Consultant
*HotWax Systems*
*Enterprise open source experts*
http://www.hotwaxsystems.com


On Wed, Jan 20, 2021 at 9:23 PM Daniel Watford <[hidden email]> wrote:

> Hello,
>
> I spent some more time trying to see if I could get IntelliJ to handle
> groovyScript files without making changes to build.gradle, but cannot find
> any other workarounds.
>
> Although we don't generally want to put lots of IDE specific code into our
> sources, we do seem to do this occasionally since we include
> OfbizDslDescriptorForIntelliJ.gdsl and OfbizDslDescriptorForEclipse.dsld to
> improve the developer experience.
>
> Further, the change I'm proposing isn't really IntelliJ specific, it is
> just the only way I can get IntelliJ to recognise groovyScript files.
>
> Therefore if there are no objections to this change, and if no issues are
> reported by other IDE users, I'll merge it in a few days.
>
> Thanks,
>
> Dan.
>
> On Wed, 20 Jan 2021 at 10:31, Jacques Le Roux <
> [hidden email]>
> wrote:
>
> > Hi Daniel, All,
> >
> > I use only Eclipse (for 15+ years and 2020-12 currently) with[1]+[2] and
> I
> > have no problems with classpath nor navigation to Java classes from
> Groovy
> > scripts
> >
> > [1] Buildship: Eclipse Plug-ins for Gradle, provided as part of the
> Gradle
> > Platform.
> > [2] Eclipse Groovy Development Tools. Provides the main plug-ins to
> create
> > and work with Groovy artifacts. It provides a powerful editor, code
> > completion, syntax-highlighting, JUnit support, wizards and a seamless
> > integration into the Java development functionality.
> >
> > FWIW, HTH
> >
> > Jacques
> >
> > Le 18/01/2021 à 09:54, Girish Vasmatkar a écrit :
> > > Hi Daniel
> > >
> > > I am on Eclipse most of the time and use the gradle eclipse plug-in to
> > just
> > > build the classpath. I have not faced this issue on Eclipse so can't
> > speak
> > > to that.
> > >
> > > That said, I see no issues with selecting SDK or compiler for the
> Groovy
> > > files. I do it on eclipse and it works without generating dupes. I
> launch
> > > OFBiz from within IDE and can navigate to other OFBiz classes as well.
> > >
> > > I'll also give it a try on IntelliJ and let you know how it goes.
> > >
> > > Best,
> > > Girish
> > >
> > >
> > >
> > >
> > > On Mon, Jan 18, 2021 at 1:32 PM Pritam Kute <
> > [hidden email]>
> > > wrote:
> > >
> > >> Hello Emad,
> > >>
> > >> I have tried those changes and can confirm that those are working as
> > >> expected. Thanks!
> > >>
> > >> Kind Regards,
> > >> --
> > >> Pritam Kute
> > >>
> > >>
> > >> On Sun, Jan 17, 2021 at 9:01 PM Daniel Watford <[hidden email]>
> > wrote:
> > >>
> > >>> Hello,
> > >>>
> > >>> I use IntelliJ for ofbiz development, but have found it awkward to
> work
> > >>> with groovyScript files.
> > >>>
> > >>> Each time I would view a groovyScript file IntelliJ would display a
> > >> warning
> > >>> that the file was not associated with a Groovy SDK and prompt me to
> > >> select
> > >>> one. Further, I couldn't navigate from a groovyScript file to other
> > ofbiz
> > >>> classes.
> > >>>
> > >>> IntelliJ imports the project script from the build.gradle file, so
> any
> > >>> changes I might have manually made to ease IDE development of
> > >> groovyScript
> > >>> files were lost as soon as I reimported build.gradle.
> > >>>
> > >>> To address this I needed to add the groovyScript files to the gradle
> > >> build
> > >>> in some way, while at the same time preventing the files from being
> > built
> > >>> and turned into classes.
> > >>>
> > >>> Some minor changes to the build.gradle file have been added to a
> branch
> > >>> here -
> > >>>
> https://github.com/danwatford/ofbiz-framework/tree/groovyScript-gradle
> > >>>
> > >>> I have tested these build.gradle changes in IntelliJ and can now
> > navigate
> > >>> from groovyScript to ofbiz classes.
> > >>>
> > >>> Please could other IDE users (eclipse, netbeans, etc0 try out the
> > changes
> > >>> in the branch to see if the developer experience is improved when
> > >> importing
> > >>> the ofbiz project structure from the gradle build file.
> > >>>
> > >>> Thanks,
> > >>>
> > >>> Dan.
> > >>>
> > >>> --
> > >>> Daniel Watford
> > >>>
> >
>
>
> --
> Daniel Watford
>
Reply | Threaded
Open this post in threaded view
|

Re: Developing groovyScripts in the IDE

Daniel Watford
Hi Pawan,

I had to carry out one more step to get your solution to work for me.

I'm running IntelliJ Ultimate 2020.3.1.

I find that I get asked to configure a Groovy SDK for the first
groovyScript file that I open in the IDE for any particular module.

I tried two Groovy SDKs, 'Gradle: org.codehaus.groovy:groovy:2.5.11' and
'groovy-3.0.7' that I already had installed locally.

Choosing the SDKs didn't allow me to navigate to java source files.

However in the case of the non-gradle provided Groovy SDK (3.07) I could
add additional sources to the library. Adding the ofbiz-framework project
directory as a location of the groovy-3.0.7 library's sources meant I could
navigate to java classes and methods from groovy scripts.

I've since downloaded and installed groovy-2.5.11 and created a global SDK
for it along with ofbiz-framework sources, however I still have to
configure each module for use with the library manually.

Further, re-importing the gradle build resets the libraries configured for
the project, meaning I have manually reconfigure the Groovy SDK for use
with a groovyScript the first time I open that module.

I tried to come up with some pros and cons for the global library approach
when working in IntelliJ.

PRO:
- No modification to the gradle build configuration for the purpose of IDE
support.
- No complications with ensuring the groovyScripts build step is skipped.

CON:
- Developer needs to manually install groovy, rather than use the version
automatically included with ofbiz-framework as a dependency.
- Developer needs to configure the library with ofbiz-framework source
directories, and ensure the list of directories is refreshed from time to
time.
- Developer should keep installed groovy version in sync with version used
by ofbiz-framework.
- Developer needs to manually select the groovy SDK to use with a
groovyScript, and reselect the SDK following any import of the gradle build
by the IDE.

If possible, I'd rather describe the gradle build in such a way as the IDE
can configure itself with all dependencies it needs rather than have the
developer manually apply (and repeatedly re-apply) configuration.

Pawan, if you are not experiencing the CONs I've listed, please let me know
as there may be some configuration item in IntelliJ I've missed somewhere.

Thanks,

Dan.


On Thu, 21 Jan 2021 at 11:08, Pawan Verma <[hidden email]>
wrote:

> Hi Dan,
>
> I use IntelliJ 2019.1 Ultimate Edition(I know it's too old) and have a
> Groovy SDK setup(groovy-2.5.7). For me it works well, I am also able to
> navigate between other OFBiz Classes from GroovyScript files.
>
> I've tried removing the Groovy SDK and set it up as a fresh one and
> recorded a short video for your reference. Please have a look and let me
> know if it works for you.
>
> Video Link:
>
> https://drive.google.com/file/d/1mhR28dn_buIaiB0vDs7a714PV05H_Bin/view?usp=sharing
> --
> Thanks & Regards
> Pawan Verma
> Technical Consultant
> *HotWax Systems*
> *Enterprise open source experts*
> http://www.hotwaxsystems.com
>
>
> On Wed, Jan 20, 2021 at 9:23 PM Daniel Watford <[hidden email]> wrote:
>
> > Hello,
> >
> > I spent some more time trying to see if I could get IntelliJ to handle
> > groovyScript files without making changes to build.gradle, but cannot
> find
> > any other workarounds.
> >
> > Although we don't generally want to put lots of IDE specific code into
> our
> > sources, we do seem to do this occasionally since we include
> > OfbizDslDescriptorForIntelliJ.gdsl and OfbizDslDescriptorForEclipse.dsld
> to
> > improve the developer experience.
> >
> > Further, the change I'm proposing isn't really IntelliJ specific, it is
> > just the only way I can get IntelliJ to recognise groovyScript files.
> >
> > Therefore if there are no objections to this change, and if no issues are
> > reported by other IDE users, I'll merge it in a few days.
> >
> > Thanks,
> >
> > Dan.
> >
> > On Wed, 20 Jan 2021 at 10:31, Jacques Le Roux <
> > [hidden email]>
> > wrote:
> >
> > > Hi Daniel, All,
> > >
> > > I use only Eclipse (for 15+ years and 2020-12 currently) with[1]+[2]
> and
> > I
> > > have no problems with classpath nor navigation to Java classes from
> > Groovy
> > > scripts
> > >
> > > [1] Buildship: Eclipse Plug-ins for Gradle, provided as part of the
> > Gradle
> > > Platform.
> > > [2] Eclipse Groovy Development Tools. Provides the main plug-ins to
> > create
> > > and work with Groovy artifacts. It provides a powerful editor, code
> > > completion, syntax-highlighting, JUnit support, wizards and a seamless
> > > integration into the Java development functionality.
> > >
> > > FWIW, HTH
> > >
> > > Jacques
> > >
> > > Le 18/01/2021 à 09:54, Girish Vasmatkar a écrit :
> > > > Hi Daniel
> > > >
> > > > I am on Eclipse most of the time and use the gradle eclipse plug-in
> to
> > > just
> > > > build the classpath. I have not faced this issue on Eclipse so can't
> > > speak
> > > > to that.
> > > >
> > > > That said, I see no issues with selecting SDK or compiler for the
> > Groovy
> > > > files. I do it on eclipse and it works without generating dupes. I
> > launch
> > > > OFBiz from within IDE and can navigate to other OFBiz classes as
> well.
> > > >
> > > > I'll also give it a try on IntelliJ and let you know how it goes.
> > > >
> > > > Best,
> > > > Girish
> > > >
> > > >
> > > >
> > > >
> > > > On Mon, Jan 18, 2021 at 1:32 PM Pritam Kute <
> > > [hidden email]>
> > > > wrote:
> > > >
> > > >> Hello Emad,
> > > >>
> > > >> I have tried those changes and can confirm that those are working as
> > > >> expected. Thanks!
> > > >>
> > > >> Kind Regards,
> > > >> --
> > > >> Pritam Kute
> > > >>
> > > >>
> > > >> On Sun, Jan 17, 2021 at 9:01 PM Daniel Watford <[hidden email]>
> > > wrote:
> > > >>
> > > >>> Hello,
> > > >>>
> > > >>> I use IntelliJ for ofbiz development, but have found it awkward to
> > work
> > > >>> with groovyScript files.
> > > >>>
> > > >>> Each time I would view a groovyScript file IntelliJ would display a
> > > >> warning
> > > >>> that the file was not associated with a Groovy SDK and prompt me to
> > > >> select
> > > >>> one. Further, I couldn't navigate from a groovyScript file to other
> > > ofbiz
> > > >>> classes.
> > > >>>
> > > >>> IntelliJ imports the project script from the build.gradle file, so
> > any
> > > >>> changes I might have manually made to ease IDE development of
> > > >> groovyScript
> > > >>> files were lost as soon as I reimported build.gradle.
> > > >>>
> > > >>> To address this I needed to add the groovyScript files to the
> gradle
> > > >> build
> > > >>> in some way, while at the same time preventing the files from being
> > > built
> > > >>> and turned into classes.
> > > >>>
> > > >>> Some minor changes to the build.gradle file have been added to a
> > branch
> > > >>> here -
> > > >>>
> > https://github.com/danwatford/ofbiz-framework/tree/groovyScript-gradle
> > > >>>
> > > >>> I have tested these build.gradle changes in IntelliJ and can now
> > > navigate
> > > >>> from groovyScript to ofbiz classes.
> > > >>>
> > > >>> Please could other IDE users (eclipse, netbeans, etc0 try out the
> > > changes
> > > >>> in the branch to see if the developer experience is improved when
> > > >> importing
> > > >>> the ofbiz project structure from the gradle build file.
> > > >>>
> > > >>> Thanks,
> > > >>>
> > > >>> Dan.
> > > >>>
> > > >>> --
> > > >>> Daniel Watford
> > > >>>
> > >
> >
> >
> > --
> > Daniel Watford
> >
>


--
Daniel Watford
Reply | Threaded
Open this post in threaded view
|

Re: Developing groovyScripts in the IDE

Daniel Watford
Another CON to the global library approach, I'm afraid.

When using a global Groovy SDK I can no longer hit break points in groovy
script files when debugging.
If I remove the global library, even while ofbiz is running, I can hit
break points again.

Thanks,

Dan.

On Thu, 21 Jan 2021 at 12:44, Daniel Watford <[hidden email]> wrote:

> Hi Pawan,
>
> I had to carry out one more step to get your solution to work for me.
>
> I'm running IntelliJ Ultimate 2020.3.1.
>
> I find that I get asked to configure a Groovy SDK for the first
> groovyScript file that I open in the IDE for any particular module.
>
> I tried two Groovy SDKs, 'Gradle: org.codehaus.groovy:groovy:2.5.11' and
> 'groovy-3.0.7' that I already had installed locally.
>
> Choosing the SDKs didn't allow me to navigate to java source files.
>
> However in the case of the non-gradle provided Groovy SDK (3.07) I could
> add additional sources to the library. Adding the ofbiz-framework project
> directory as a location of the groovy-3.0.7 library's sources meant I could
> navigate to java classes and methods from groovy scripts.
>
> I've since downloaded and installed groovy-2.5.11 and created a global SDK
> for it along with ofbiz-framework sources, however I still have to
> configure each module for use with the library manually.
>
> Further, re-importing the gradle build resets the libraries configured for
> the project, meaning I have manually reconfigure the Groovy SDK for use
> with a groovyScript the first time I open that module.
>
> I tried to come up with some pros and cons for the global library approach
> when working in IntelliJ.
>
> PRO:
> - No modification to the gradle build configuration for the purpose of IDE
> support.
> - No complications with ensuring the groovyScripts build step is skipped.
>
> CON:
> - Developer needs to manually install groovy, rather than use the version
> automatically included with ofbiz-framework as a dependency.
> - Developer needs to configure the library with ofbiz-framework source
> directories, and ensure the list of directories is refreshed from time to
> time.
> - Developer should keep installed groovy version in sync with version used
> by ofbiz-framework.
> - Developer needs to manually select the groovy SDK to use with a
> groovyScript, and reselect the SDK following any import of the gradle build
> by the IDE.
>
> If possible, I'd rather describe the gradle build in such a way as the IDE
> can configure itself with all dependencies it needs rather than have the
> developer manually apply (and repeatedly re-apply) configuration.
>
> Pawan, if you are not experiencing the CONs I've listed, please let me
> know as there may be some configuration item in IntelliJ I've missed
> somewhere.
>
> Thanks,
>
> Dan.
>
>
> On Thu, 21 Jan 2021 at 11:08, Pawan Verma <[hidden email]>
> wrote:
>
>> Hi Dan,
>>
>> I use IntelliJ 2019.1 Ultimate Edition(I know it's too old) and have a
>> Groovy SDK setup(groovy-2.5.7). For me it works well, I am also able to
>> navigate between other OFBiz Classes from GroovyScript files.
>>
>> I've tried removing the Groovy SDK and set it up as a fresh one and
>> recorded a short video for your reference. Please have a look and let me
>> know if it works for you.
>>
>> Video Link:
>>
>> https://drive.google.com/file/d/1mhR28dn_buIaiB0vDs7a714PV05H_Bin/view?usp=sharing
>> --
>> Thanks & Regards
>> Pawan Verma
>> Technical Consultant
>> *HotWax Systems*
>> *Enterprise open source experts*
>> http://www.hotwaxsystems.com
>>
>>
>> On Wed, Jan 20, 2021 at 9:23 PM Daniel Watford <[hidden email]> wrote:
>>
>> > Hello,
>> >
>> > I spent some more time trying to see if I could get IntelliJ to handle
>> > groovyScript files without making changes to build.gradle, but cannot
>> find
>> > any other workarounds.
>> >
>> > Although we don't generally want to put lots of IDE specific code into
>> our
>> > sources, we do seem to do this occasionally since we include
>> > OfbizDslDescriptorForIntelliJ.gdsl and
>> OfbizDslDescriptorForEclipse.dsld to
>> > improve the developer experience.
>> >
>> > Further, the change I'm proposing isn't really IntelliJ specific, it is
>> > just the only way I can get IntelliJ to recognise groovyScript files.
>> >
>> > Therefore if there are no objections to this change, and if no issues
>> are
>> > reported by other IDE users, I'll merge it in a few days.
>> >
>> > Thanks,
>> >
>> > Dan.
>> >
>> > On Wed, 20 Jan 2021 at 10:31, Jacques Le Roux <
>> > [hidden email]>
>> > wrote:
>> >
>> > > Hi Daniel, All,
>> > >
>> > > I use only Eclipse (for 15+ years and 2020-12 currently) with[1]+[2]
>> and
>> > I
>> > > have no problems with classpath nor navigation to Java classes from
>> > Groovy
>> > > scripts
>> > >
>> > > [1] Buildship: Eclipse Plug-ins for Gradle, provided as part of the
>> > Gradle
>> > > Platform.
>> > > [2] Eclipse Groovy Development Tools. Provides the main plug-ins to
>> > create
>> > > and work with Groovy artifacts. It provides a powerful editor, code
>> > > completion, syntax-highlighting, JUnit support, wizards and a seamless
>> > > integration into the Java development functionality.
>> > >
>> > > FWIW, HTH
>> > >
>> > > Jacques
>> > >
>> > > Le 18/01/2021 à 09:54, Girish Vasmatkar a écrit :
>> > > > Hi Daniel
>> > > >
>> > > > I am on Eclipse most of the time and use the gradle eclipse plug-in
>> to
>> > > just
>> > > > build the classpath. I have not faced this issue on Eclipse so can't
>> > > speak
>> > > > to that.
>> > > >
>> > > > That said, I see no issues with selecting SDK or compiler for the
>> > Groovy
>> > > > files. I do it on eclipse and it works without generating dupes. I
>> > launch
>> > > > OFBiz from within IDE and can navigate to other OFBiz classes as
>> well.
>> > > >
>> > > > I'll also give it a try on IntelliJ and let you know how it goes.
>> > > >
>> > > > Best,
>> > > > Girish
>> > > >
>> > > >
>> > > >
>> > > >
>> > > > On Mon, Jan 18, 2021 at 1:32 PM Pritam Kute <
>> > > [hidden email]>
>> > > > wrote:
>> > > >
>> > > >> Hello Emad,
>> > > >>
>> > > >> I have tried those changes and can confirm that those are working
>> as
>> > > >> expected. Thanks!
>> > > >>
>> > > >> Kind Regards,
>> > > >> --
>> > > >> Pritam Kute
>> > > >>
>> > > >>
>> > > >> On Sun, Jan 17, 2021 at 9:01 PM Daniel Watford <[hidden email]>
>> > > wrote:
>> > > >>
>> > > >>> Hello,
>> > > >>>
>> > > >>> I use IntelliJ for ofbiz development, but have found it awkward to
>> > work
>> > > >>> with groovyScript files.
>> > > >>>
>> > > >>> Each time I would view a groovyScript file IntelliJ would display
>> a
>> > > >> warning
>> > > >>> that the file was not associated with a Groovy SDK and prompt me
>> to
>> > > >> select
>> > > >>> one. Further, I couldn't navigate from a groovyScript file to
>> other
>> > > ofbiz
>> > > >>> classes.
>> > > >>>
>> > > >>> IntelliJ imports the project script from the build.gradle file, so
>> > any
>> > > >>> changes I might have manually made to ease IDE development of
>> > > >> groovyScript
>> > > >>> files were lost as soon as I reimported build.gradle.
>> > > >>>
>> > > >>> To address this I needed to add the groovyScript files to the
>> gradle
>> > > >> build
>> > > >>> in some way, while at the same time preventing the files from
>> being
>> > > built
>> > > >>> and turned into classes.
>> > > >>>
>> > > >>> Some minor changes to the build.gradle file have been added to a
>> > branch
>> > > >>> here -
>> > > >>>
>> > https://github.com/danwatford/ofbiz-framework/tree/groovyScript-gradle
>> > > >>>
>> > > >>> I have tested these build.gradle changes in IntelliJ and can now
>> > > navigate
>> > > >>> from groovyScript to ofbiz classes.
>> > > >>>
>> > > >>> Please could other IDE users (eclipse, netbeans, etc0 try out the
>> > > changes
>> > > >>> in the branch to see if the developer experience is improved when
>> > > >> importing
>> > > >>> the ofbiz project structure from the gradle build file.
>> > > >>>
>> > > >>> Thanks,
>> > > >>>
>> > > >>> Dan.
>> > > >>>
>> > > >>> --
>> > > >>> Daniel Watford
>> > > >>>
>> > >
>> >
>> >
>> > --
>> > Daniel Watford
>> >
>>
>
>
> --
> Daniel Watford
>


--
Daniel Watford
Reply | Threaded
Open this post in threaded view
|

Re: Developing groovyScripts in the IDE

Pawan Verma
Thanks dan for the details, I am also more inclined to have an automated
way. Looking forward for the solution.

Have a great day, buddy👍

On Thu, Jan 21, 2021, 7:13 PM Daniel Watford <[hidden email]> wrote:

> Another CON to the global library approach, I'm afraid.
>
> When using a global Groovy SDK I can no longer hit break points in groovy
> script files when debugging.
> If I remove the global library, even while ofbiz is running, I can hit
> break points again.
>
> Thanks,
>
> Dan.
>
> On Thu, 21 Jan 2021 at 12:44, Daniel Watford <[hidden email]> wrote:
>
> > Hi Pawan,
> >
> > I had to carry out one more step to get your solution to work for me.
> >
> > I'm running IntelliJ Ultimate 2020.3.1.
> >
> > I find that I get asked to configure a Groovy SDK for the first
> > groovyScript file that I open in the IDE for any particular module.
> >
> > I tried two Groovy SDKs, 'Gradle: org.codehaus.groovy:groovy:2.5.11' and
> > 'groovy-3.0.7' that I already had installed locally.
> >
> > Choosing the SDKs didn't allow me to navigate to java source files.
> >
> > However in the case of the non-gradle provided Groovy SDK (3.07) I could
> > add additional sources to the library. Adding the ofbiz-framework project
> > directory as a location of the groovy-3.0.7 library's sources meant I
> could
> > navigate to java classes and methods from groovy scripts.
> >
> > I've since downloaded and installed groovy-2.5.11 and created a global
> SDK
> > for it along with ofbiz-framework sources, however I still have to
> > configure each module for use with the library manually.
> >
> > Further, re-importing the gradle build resets the libraries configured
> for
> > the project, meaning I have manually reconfigure the Groovy SDK for use
> > with a groovyScript the first time I open that module.
> >
> > I tried to come up with some pros and cons for the global library
> approach
> > when working in IntelliJ.
> >
> > PRO:
> > - No modification to the gradle build configuration for the purpose of
> IDE
> > support.
> > - No complications with ensuring the groovyScripts build step is skipped.
> >
> > CON:
> > - Developer needs to manually install groovy, rather than use the version
> > automatically included with ofbiz-framework as a dependency.
> > - Developer needs to configure the library with ofbiz-framework source
> > directories, and ensure the list of directories is refreshed from time to
> > time.
> > - Developer should keep installed groovy version in sync with version
> used
> > by ofbiz-framework.
> > - Developer needs to manually select the groovy SDK to use with a
> > groovyScript, and reselect the SDK following any import of the gradle
> build
> > by the IDE.
> >
> > If possible, I'd rather describe the gradle build in such a way as the
> IDE
> > can configure itself with all dependencies it needs rather than have the
> > developer manually apply (and repeatedly re-apply) configuration.
> >
> > Pawan, if you are not experiencing the CONs I've listed, please let me
> > know as there may be some configuration item in IntelliJ I've missed
> > somewhere.
> >
> > Thanks,
> >
> > Dan.
> >
> >
> > On Thu, 21 Jan 2021 at 11:08, Pawan Verma <[hidden email]
> >
> > wrote:
> >
> >> Hi Dan,
> >>
> >> I use IntelliJ 2019.1 Ultimate Edition(I know it's too old) and have a
> >> Groovy SDK setup(groovy-2.5.7). For me it works well, I am also able to
> >> navigate between other OFBiz Classes from GroovyScript files.
> >>
> >> I've tried removing the Groovy SDK and set it up as a fresh one and
> >> recorded a short video for your reference. Please have a look and let me
> >> know if it works for you.
> >>
> >> Video Link:
> >>
> >>
> https://drive.google.com/file/d/1mhR28dn_buIaiB0vDs7a714PV05H_Bin/view?usp=sharing
> >> --
> >> Thanks & Regards
> >> Pawan Verma
> >> Technical Consultant
> >> *HotWax Systems*
> >> *Enterprise open source experts*
> >> http://www.hotwaxsystems.com
> >>
> >>
> >> On Wed, Jan 20, 2021 at 9:23 PM Daniel Watford <[hidden email]>
> wrote:
> >>
> >> > Hello,
> >> >
> >> > I spent some more time trying to see if I could get IntelliJ to handle
> >> > groovyScript files without making changes to build.gradle, but cannot
> >> find
> >> > any other workarounds.
> >> >
> >> > Although we don't generally want to put lots of IDE specific code into
> >> our
> >> > sources, we do seem to do this occasionally since we include
> >> > OfbizDslDescriptorForIntelliJ.gdsl and
> >> OfbizDslDescriptorForEclipse.dsld to
> >> > improve the developer experience.
> >> >
> >> > Further, the change I'm proposing isn't really IntelliJ specific, it
> is
> >> > just the only way I can get IntelliJ to recognise groovyScript files.
> >> >
> >> > Therefore if there are no objections to this change, and if no issues
> >> are
> >> > reported by other IDE users, I'll merge it in a few days.
> >> >
> >> > Thanks,
> >> >
> >> > Dan.
> >> >
> >> > On Wed, 20 Jan 2021 at 10:31, Jacques Le Roux <
> >> > [hidden email]>
> >> > wrote:
> >> >
> >> > > Hi Daniel, All,
> >> > >
> >> > > I use only Eclipse (for 15+ years and 2020-12 currently) with[1]+[2]
> >> and
> >> > I
> >> > > have no problems with classpath nor navigation to Java classes from
> >> > Groovy
> >> > > scripts
> >> > >
> >> > > [1] Buildship: Eclipse Plug-ins for Gradle, provided as part of the
> >> > Gradle
> >> > > Platform.
> >> > > [2] Eclipse Groovy Development Tools. Provides the main plug-ins to
> >> > create
> >> > > and work with Groovy artifacts. It provides a powerful editor, code
> >> > > completion, syntax-highlighting, JUnit support, wizards and a
> seamless
> >> > > integration into the Java development functionality.
> >> > >
> >> > > FWIW, HTH
> >> > >
> >> > > Jacques
> >> > >
> >> > > Le 18/01/2021 à 09:54, Girish Vasmatkar a écrit :
> >> > > > Hi Daniel
> >> > > >
> >> > > > I am on Eclipse most of the time and use the gradle eclipse
> plug-in
> >> to
> >> > > just
> >> > > > build the classpath. I have not faced this issue on Eclipse so
> can't
> >> > > speak
> >> > > > to that.
> >> > > >
> >> > > > That said, I see no issues with selecting SDK or compiler for the
> >> > Groovy
> >> > > > files. I do it on eclipse and it works without generating dupes. I
> >> > launch
> >> > > > OFBiz from within IDE and can navigate to other OFBiz classes as
> >> well.
> >> > > >
> >> > > > I'll also give it a try on IntelliJ and let you know how it goes.
> >> > > >
> >> > > > Best,
> >> > > > Girish
> >> > > >
> >> > > >
> >> > > >
> >> > > >
> >> > > > On Mon, Jan 18, 2021 at 1:32 PM Pritam Kute <
> >> > > [hidden email]>
> >> > > > wrote:
> >> > > >
> >> > > >> Hello Emad,
> >> > > >>
> >> > > >> I have tried those changes and can confirm that those are working
> >> as
> >> > > >> expected. Thanks!
> >> > > >>
> >> > > >> Kind Regards,
> >> > > >> --
> >> > > >> Pritam Kute
> >> > > >>
> >> > > >>
> >> > > >> On Sun, Jan 17, 2021 at 9:01 PM Daniel Watford <[hidden email]
> >
> >> > > wrote:
> >> > > >>
> >> > > >>> Hello,
> >> > > >>>
> >> > > >>> I use IntelliJ for ofbiz development, but have found it awkward
> to
> >> > work
> >> > > >>> with groovyScript files.
> >> > > >>>
> >> > > >>> Each time I would view a groovyScript file IntelliJ would
> display
> >> a
> >> > > >> warning
> >> > > >>> that the file was not associated with a Groovy SDK and prompt me
> >> to
> >> > > >> select
> >> > > >>> one. Further, I couldn't navigate from a groovyScript file to
> >> other
> >> > > ofbiz
> >> > > >>> classes.
> >> > > >>>
> >> > > >>> IntelliJ imports the project script from the build.gradle file,
> so
> >> > any
> >> > > >>> changes I might have manually made to ease IDE development of
> >> > > >> groovyScript
> >> > > >>> files were lost as soon as I reimported build.gradle.
> >> > > >>>
> >> > > >>> To address this I needed to add the groovyScript files to the
> >> gradle
> >> > > >> build
> >> > > >>> in some way, while at the same time preventing the files from
> >> being
> >> > > built
> >> > > >>> and turned into classes.
> >> > > >>>
> >> > > >>> Some minor changes to the build.gradle file have been added to a
> >> > branch
> >> > > >>> here -
> >> > > >>>
> >> >
> https://github.com/danwatford/ofbiz-framework/tree/groovyScript-gradle
> >> > > >>>
> >> > > >>> I have tested these build.gradle changes in IntelliJ and can now
> >> > > navigate
> >> > > >>> from groovyScript to ofbiz classes.
> >> > > >>>
> >> > > >>> Please could other IDE users (eclipse, netbeans, etc0 try out
> the
> >> > > changes
> >> > > >>> in the branch to see if the developer experience is improved
> when
> >> > > >> importing
> >> > > >>> the ofbiz project structure from the gradle build file.
> >> > > >>>
> >> > > >>> Thanks,
> >> > > >>>
> >> > > >>> Dan.
> >> > > >>>
> >> > > >>> --
> >> > > >>> Daniel Watford
> >> > > >>>
> >> > >
> >> >
> >> >
> >> > --
> >> > Daniel Watford
> >> >
> >>
> >
> >
> > --
> > Daniel Watford
> >
>
>
> --
> Daniel Watford
>