netbeans-gradle-project
netbeans-gradle-project copied to clipboard
[enhancement] Support GRADLE_HOME in Options / Gradle panel
Good afternoon,
On the Gradle panel in the Miscellaneous Options tab, under "Gradle Installation" there is a field called:
- Gradle Installation Directory
The plugin ignores:
- $GRADLE_HOME
- $GRADLE_USER_HOME
When you click to change there are 4 mutually exclusive alternatives
- Autodetect from gradle wrapper
- Downloade from Gradleware
- download from URL
- 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:
- $GRADLE_HOME
- ${GRADLE_HOME}
- "${GRADLE_HOME}"
With very annoying results.
- The $GRADLE_HOME environment variable was not expanded. I don't think the plugin is honouring the $-syntax
- 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.
- 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).
- 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:
- Expand environment and system variables in the dialogue
- Please don't editing the text entered and most especially don't save it after it was changed without giving the user the chance to fix the text. Please don't save stuff in that manner.
- It would be ideal (for me) if the environment variable could be left in situ so that it would expand each time Netbeans runs.
- The current value for strings using environment values could be displayed also on the dialogue
- Check the "Gradle location" before updating the "Gradle Installation" category.
- Issue a warning message when path is missing/wrong
- There may be a use-case to keep a missing file path; that is up to the user
- If I had that message, at least I would have been told the GRADLE_HOME value is an error.
- Also expand the env variables, like $GRADLE_HOME, before the check
- If the $GRADLE_HOME can't be left in place and expanded later; then by all means expanding it to the current value is better than ignoring it.
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.
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.
Actually, I have just realized that the very same thing I have mentioned works for task definitions (not for what you need though).
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?
How do you build the plugin? Do I need to download this project?
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).