Repository navigation
[NETBEANS-2044] Use gradle.properties to store project build actions. - #1116
Conversation
| public class GradleAuxiliaryPropertiesImpl implements AuxiliaryProperties { | ||
|
|
||
| private static final String PROP_PREFIX = "nb-config."; //NOI18N |
There was a problem hiding this comment.
One of the motivations for avoiding the nbactions.xml file was to decouple this configuration from NetBeans. Using nb-config. or nb-actions. prefixes still references NetBeans.
Can't the support be done in a generic way? Call it a generic Gradle "actions" support that allow one to invoke well defined actions ("run", "debug", etc.) on a project from a command line and (accidentally ;-) also in NetBeans?
Or somehow reuse what is available in Gradle? Maybe there has to be a task "debug" that will be invoked when the IDE wants to debug? Maybe show all tasks that have description in the build.gradle file, etc.?
There was a problem hiding this comment.
I'm sorry, but I'm not sure that I understand.
Right now the IDE recognize the internal plugins and assigns default actions for them. Like if you have an "application" plugin used in gradle then the run action would call the run Gradle task and the debug action would call "run --debug-jvm". Even if there is no application plugin used these special actions are checked if they are available as a gradle task, if yes they will be mapped into the IDE by default. There is no change required on the Gradle side, everything works out of the box.
However there are other cases, like spring boot.If you use spring boot plugin then you get a task named "bootRun" that is not mapped to run action. Without PR #1114 you can invoke the bootRun through Navigator or context menu. Though with defining an action in Build Actions you can map the run action to bootRun task. That mapping has to be stored somewhere and preferably this setting is shared between the team. Prior this PR this customization was done through the nb-actions.xml, so users could decide to put that into the source control or just put that file to the ignore list. with this PR it is a new property in the gradle.properties of the project like:
nb-action.run.args=bootRun
So this feature make not (yet) supported projects actually work in NetBeans.
Though the format of the build.gradle is really configurable. It does not allow to add some additional well formed part on it's own like actions {...} there has to be a plugin supporting that. Adding a plugin for this purpose is definitely against the seamless integration.
This specific referenced part of the code is the support for auxiliary properties which is stored in the project's cache dir under the root project's .gradle/nb-cache as the .gradle is supposed to be on ignore list. That stores the Java Platform to be used for build execution and the "augmented build" flag.
There was a problem hiding this comment.
I see. All is fine, I'd just be happier if the action in gradle.properties was named action.run.args or ide.action.run.args, but not nb*.
|
@lkishalmi does this PR supersede #1114 with regard to Spring Boot gradle projects? Or can they co-exist? In NBSpringBoot plugin I actually used the action mapping feature for maven projects in order to map the run and debug actions to different maven goals (i.e. use |
JaroslavTulach
left a comment
There was a problem hiding this comment.
Consider dropping the nb-* prefix of the properties.
The #1114 is for Gradle SpringBoot projects, where the main task is named as "bootRun" and yes these two PR-s are independent and can coexist in the main code. |
e20df32 to
59058c3
Compare
|
The "nb-" prefix has been removed from the properties. |
No description provided.