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.
172 stars 57 forks source link

some built-in tasks definitions can't be adjusted: javadoc, test.single, etc #388

Closed tcfurrer closed 6 years ago

tcfurrer commented 6 years ago

The "built-in tasks" documentation says "Each of these commands can be freely adjusted in the project properties." But this seems to only be true for a subset of them currently. Can the plugin be enhanced to allow all existing built-in tasks to be adjusted?

To be more specific: In the project properties GUI editor "Built-in tasks" category, several of the documented built-in tasks don't appear in the drop-down, such as "Generate Javadoc" and "Test Single". I tried manually editing .nb-gradle-properties to see if it was possible to adjust these task definitions, but this doesn't seem to take effect:

    <task>
      <display-name>javadoc</display-name>
      <non-blocking>yes</non-blocking>
      <task-names>
        <name must-exist="no">${project}:showJavadoc</name>
      </task-names>
      <task-args/>
      <task-jvm-args/>
    </task>
    <task>
      <display-name>test.single</display-name>
      <non-blocking>no</non-blocking>
      <task-names>
        <name must-exist="no">${project}:test</name>
      </task-names>
      <task-args>
        <arg>--tests '${selected-class}'</arg>
        <arg>-Ptest.suites=${test-suites}</arg>
      </task-args>
      <task-jvm-args/>
    </task>
tcfurrer commented 6 years ago

In case it matters: I observed this using plugin version 1.4.3, Netbeans 8.2, both Windows and Linux.

kelemen commented 6 years ago

You can only see Java related tasks on Java projects (i.e., those applying the 'java' plugin), so - unless you have applied the 'java' plugin on the root - you can't see them if you select the project properties on the root project. This is somewhat awkward because projects within the same multi-project share the project properties (though I might consider adding the possiblitly to also adjust the properties per subproject).

kelemen commented 6 years ago

Also, manual changes made to the properties file are not tracked, so you would have to restart NB for that to take effect but I'm quite sure this feature works because I use it very regularly.

tcfurrer commented 6 years ago

Ok. I will try that, and report back here whether this entire issue becomes moot.

I don't actually want to apply the java plugin to my root project (if it can be avoided), but I'm OK with using the workaround you provided in Issue 374, which I hope will be equally applicable here.

tcfurrer commented 6 years ago

Ok, I did end up just applying java plugin to my root project all of the time, and that fixed everything.

I did end up having to fix my test.single task definition to the following (the one shown earlier here was busted):

<task>
  <display-name>test.single</display-name>
  <non-blocking>no</non-blocking>
  <task-names>
    <name must-exist="no">${project}:cleanTest</name>
    <name must-exist="no">${project}:test</name>
  </task-names>
  <task-args>
    <arg>--tests</arg>
    <arg>${selected-class}.*</arg>
    <arg>-Ptest.suites=${test-suites}</arg>
  </task-args>
  <task-jvm-args/>
</task>
tcfurrer commented 6 years ago

Closing, since it was just user error.

kelemen commented 6 years ago

You don't have to apply the java plugin but you have to open the project properties dialog on a java subproject (the properties are shared by all the projects in the build).

tcfurrer commented 6 years ago

Actually, no matter what I do, some built-in tasks never appear in the project properties dialog. I'll file a new issue on that.

tcfurrer commented 6 years ago

Oops, nevermind, all the build-in tasks are there for me now. I'm not sure what change I made that made this start working. I have been making various changes in my gradle scripts, etc recently. Anyway, no need for another issue now. :-)