kelemen / netbeans-gradle-project

This project is a NetBeans plugin able to open Gradle based Java projects. The implementation is based on Geertjan Wielenga's plugin.
170 stars 57 forks source link

[enhancement] Support GRADLE_HOME in Options / Gradle panel #320

Open aplatypus opened 7 years ago

aplatypus commented 7 years ago

Good afternoon,

On the Gradle panel in the Miscellaneous Options tab, under "Gradle Installation" there is a field called:

The plugin ignores:

When you click to change there are 4 mutually exclusive alternatives

  1. Autodetect from gradle wrapper
  2. Downloade from Gradleware
  3. download from URL
  4. Use given local folder

All my scripts and short-cuts are set-up to use the GRADLE_HOME setting. I explicitly do not want to us the wrapper.

Under #4 "Use given local folder" -- I tried:

With very annoying results.

  1. The $GRADLE_HOME environment variable was not expanded. I don't think the plugin is honouring the $-syntax
  2. The dialogue box appears to edit the text entered and puts in a current working directory
    • It should NOT be doing that; if the path given is invalid that ought to be a message or something.
  3. The extra file path the dialogue adds to my text entry is was nothing to do with the project I was working on. It appears to be the starting folder for that netbeans instance.
    • So the text used appears to be largely irrelevant as the gradle runtime doesn't want to be with the folder I'm working in (most of the time).
  4. The text change was changed when I pressed OK, so there was no chance to review a dialog-box error
    • Unfortunately it just keeps prepending a path anyway the rascal

Enhancement:

The default for $GRADLE_USER_HOME is reported as: "~./gradle" which might make sense on Mac and Linux. On windows this appears to throw-up the Documents psudo-folder.

In summary, the Gradle framework has good tooling using these variables I prefer to put my other options into the appropriate config files in $GRADLE_USER_HOME. At the least I feel the Gradle Plugin ought to support these basic attrributes of the Gradle build paradigm. It is fine to add value with the other options in the set-up. But I feel the basics should be provided for as well.

many thanks.

kelemen commented 7 years ago

I don't think there is support anywhere for environmental variable expansion. So, if I add support, I will have to review everything, otherwise it would confuse people why it works in random places. Also, my preferred format would be: ${env.GRADLE_HOME} because that is easier for me to parse. I would probably save strings as is and would not expand such variables immediately.

The ~/.gradle is a lie. It was just convenient to describe it this way (I expect most who cares to know what is meant by that). Anyway, usually the default is just whatever Gradle uses as default. If I need its value for something else than passing to Gradle, then it defaults to Paths.get(System.getProperty("user.home"), ".gradle").

I will have a look at this issue sometime this week.

kelemen commented 7 years ago

Actually, I have just realized that the very same thing I have mentioned works for task definitions (not for what you need though).

kelemen commented 7 years ago

I have done this for the location only but will review what else do I need to update. Can you build the plugin and try if it works for you?

aplatypus commented 7 years ago

How do you build the plugin? Do I need to download this project?

kelemen commented 7 years ago

If you have checked out the source code from this repository, you should be able to simply open the project in NB and build it as any other project in NB (which will produce the nbm). I recommened you to read the wiki page for more convenient way to try the plugin (you should have a version of NB installed on your system with Groovy support for convenience).