...
Micronaut applications can be run in automatic restart (Continuous Run) mode. In this mode, a change to a project source will trigger
...
- gradle supports continous build mode with -t parameter to the gradle launcher
- maven is extended by micronaut plugin and goal mn:run to do the same
Project Action or Configuration
That's a question. The "Continuous run" is essentially a flavour, or variant of "Run" actions. With Gradle, "dev mode" can be applied to variety of actions:
- Run (application)
- Run single (specific class)
- Test
- Test single
With Micronaut Maven plugin, however, only Run actions are supported.
Separate Project Action
A new project action Continuous Run will can be defined to handle this special action. Both Maven and Gradle project support action configuration mapping, so implementation in both Gradle and Maven will just provide an action mapping for the new project action. The project action itself should be defined in
...
Code Block | ||
---|---|---|
| ||
<action> <actionName>run.continuous</actionName> <packagings> <packaging>jar</packaging> </packagings> <!-- Maybe not necessary to add, if the MavenActionsProvider itself are registered specifically per-plugin <activation> <plugin>io.micronaut.build:micronaut-maven-plugin</plugin> </activation> --> <goals> <goal>process-classes</goal> <goal>io.micronaut.build:micronaut-maven-plugin:2.0.0:run</goal> </goals> <properties> <mn.jvmArgs>${exec.vmArgs} -classpath %classpath</mn.jvmArgs> <mn.appArgs>${exec.appArgs</mn.appArgs> <exec.mainClass>${packageClassName}</exec.mainClass> <exec.executable>java</exec.executable> </properties> </action> |
Definition for Gradle
Display Action in the IDE
Neither Gradle or Maven support adding technology-specific actions in the project UI. Even if the action is defined in nbactions.xml, it will not appear anywhere in the popup menu, except for custom actions (having CUSTOM- prefix in their action name; maven only). In this case, I would like to display the Continuous Run action alongside the Run and Debug.
...
Allowing to extend the main project menu may lead to its explosion with many added actions for each technology. A standard grouping action should be created in the OpenAPI and documented, so a technology may eventually add its action into a subgroup. This will not be part of the initial implementation, but could be added later. Note that by default, the Lookups.forPath() collects the whole .../Actions subtree (traversing into subfolders).
...
Access to "action" in LSP clients
Run-style actions should be handled by Debugger Adapter Protocol, and its Launch Request: this ensures the client is aware of the running process and can control (somwhat) the process' execution. From the client's point of view, the execution terminates only if the application fails, not until the process exits, which is consistent with how mn:run or gradle -t works. The Continuous Run feature will be specified by argument continuousExecution=true. The Launch handler should then modify the invoked project action from COMMAND_RUN to COMMAND_RUN_CONTINUOUS.
...