Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spring-boot-devtools conflict with gradlew runCommand #13523

Open
hellobigbean opened this issue Jun 18, 2024 · 6 comments
Open

spring-boot-devtools conflict with gradlew runCommand #13523

hellobigbean opened this issue Jun 18, 2024 · 6 comments

Comments

@hellobigbean
Copy link

hellobigbean commented Jun 18, 2024

No qualifying bean of type 'grails.plugins.GrailsPluginManager' available

Expected Behavior

grails 6.1.2, 6.2.0 and 7.0.0-SNAPSHOT

gradlew runCommand -Pargs="generate-controller sampleapp.ClassA" --scan
report: https://scans.gradle.com/s/e7wqodd3gnxmk

Actual Behaviour

No response

Steps To Reproduce

No response

Environment Information

No response

Example Application

No response

Version

6.1.2, 6.2.0 and 7.0.0-SNAPSHOT

@matrei
Copy link
Contributor

matrei commented Sep 9, 2024

Hi @hellobigbean,

I haven’t been able to replicate the error on my end. Could you share the project or more details about it?
It would help me investigate further.

Thanks!

@codeconsole
Copy link
Contributor

@matrei the issue occurs when you add spring-boot-devtools to your build.gradle

dependencies {
    // ...
    developmentOnly("org.springframework.boot:spring-boot-devtools")
}

@hellobigbean do you have that dependency? if so, try commenting out temporarily then running the command.

@jamesfredley
Copy link
Contributor

I can confirm that with developmentOnly("org.springframework.boot:spring-boot-devtools") this error occurs on a Grails 6.2.0 project and without it does not occur.

@jamesfredley
Copy link
Contributor

jamesfredley commented Sep 11, 2024

@Override
ConfigurableApplicationContext run(String... args) {
def command = ApplicationContextCommandRegistry.findCommand(commandName)
if(command) {
Object skipBootstrap = command.hasProperty("skipBootstrap")?.getProperty(command)
if (skipBootstrap instanceof Boolean && !System.getProperty(Settings.SETTING_SKIP_BOOTSTRAP)) {
System.setProperty(Settings.SETTING_SKIP_BOOTSTRAP, skipBootstrap.toString())
}
ConfigurableApplicationContext ctx = null
try {
ctx = super.run(args)
} catch (Throwable e) {
System.err.println("Context failed to load: $e.message")
System.exit(1)
}

@Override
ConfigurableApplicationContext run(String... args) {
ConfigurableApplicationContext applicationContext = super.run(args)
Environment environment = Environment.getCurrent()
log.info("Application starting in environment: {}", environment.getName())
log.debug("Application directory discovered as: {}", IOUtils.findApplicationDirectory())
log.debug("Current base directory is [{}]. Reloading base directory is [{}]", new File("."), BuildSettings.BASE_DIR)
if(environment.isReloadEnabled()) {
log.debug("Reloading status: {}", environment.isReloadEnabled())
enableDevelopmentModeWatch(environment, applicationContext)
environment.isDevtoolsRestart()
}
printRunStatus(applicationContext)
return applicationContext
}

@puneetbehl
Copy link
Contributor

I think this might be happening due to some dependency might be missing from the restart classloader. We've faced serveral issues in the past due to JARs or classes while using "spring-boot-devtools". I'll try to look into this and share more details soon.

@puneetbehl
Copy link
Contributor

puneetbehl commented Sep 22, 2024

Also, it seems similar to #13509

@jamesfredley jamesfredley changed the title No qualifying bean of type 'grails.plugins.GrailsPluginManager' available spring-boot-devtools conflict with gradlew runCommand Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

5 participants