Hello everyone, I have created an inline plugin i...
# questions
b
Hello everyone, I have created an inline plugin in my project and moved some existing code into it. The plugin doesn’t have any web components. However, when I run the main app, the plugin’s Application class (entry point) also starts, causing conflicts and breaking the main app. To work around this, I created a Spring profile to prevent the plugin from running in non-test modes. I have a few integration tests that require
GrailsAutoConfiguration
to spin up the Spring container, but I need to ensure the plugin’s
Application
class is disabled in production (non-test) mode. I’ve checked the Grails documentation but couldn’t find a specific solution for this issue. Is there a way to disable the plugin’s Application class from starting in production (non-test) mode? Any clean solutions to address this would be greatly appreciated. Thank you!
Copy code
@PluginSource
class Application extends GrailsAutoConfiguration {
static void main(String[] args) {
     GrailsApp.run(Application, args)
}
g
Did you try setting
bootJar.enabled = false
on
build.gradle
? This should make the plugin stop acting as a standalone application https://docs.grails.org/latest/guide/upgrading.html#_building_executable_jars_for_grails_plugins
b
@Galeno de Melo thank you for your idea. But yes, the setting is already there:
Copy code
bootJar.enabled = false
j
b
Thanks, @James Fredley. I have reviewed the reference. My project is set up as a multi-module project and works fine as long as I “disable” the
Application
(the plugin’s entry point) using the techniques I mentioned earlier (env. variables, spring profiles etc …). I was wondering if there is a more common way to prevent the plugin’s application from starting alongside the main app as a stand along app and interfering with it.
j
What command are you using to run the application?