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

developmentOnly dependencies are included in the AOT processing classpath #35433

Closed
philwebb opened this issue May 15, 2023 · 4 comments
Closed
Assignees
Labels
type: bug A general bug
Milestone

Comments

@philwebb
Copy link
Member

As discovered by @joshlong during a demo:

18:25:01: Executing ':classes :testClasses :aotClasses :aotTestClasses'...

> Task :compileJava
> Task :processResources UP-TO-DATE
> Task :classes
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :resolveMainClassName

> Task :processAot FAILED

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v3.1.0-SNAPSHOT)

2023-05-15T18:25:02.998+02:00  INFO 31731 --- [           main] com.example.service.ServiceApplication   : Starting ServiceApplication using Java 17.0.5 with PID 31731 (/Users/jlong/Downloads/service/build/classes/java/main started by jlong in /Users/jlong/Downloads/service)
2023-05-15T18:25:03.000+02:00  INFO 31731 --- [           main] com.example.service.ServiceApplication   : No active profile set, falling back to 1 default profile: "default"
2023-05-15T18:25:03.036+02:00  INFO 31731 --- [           main] .s.b.d.c.l.DockerComposeLifecycleManager : Using Docker Compose file '/Users/jlong/Downloads/service/docker-compose.yml'
2023-05-15T18:25:04.018+02:00  INFO 31731 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
2023-05-15T18:25:04.040+02:00  INFO 31731 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 19 ms. Found 1 JDBC repository interfaces.
5 actionable tasks: 4 executed, 1 up-to-date
Exception in thread "main" java.lang.IllegalArgumentException: Code generation is not supported for bean definitions declaring an instance supplier callback : Root bean: class [org.springframework.boot.docker.compose.service.connection.postgres.PostgresJdbcDockerComposeConnectionDetailsFactory$PostgresJdbcDockerComposeConnectionDetails]; scope=singleton; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodNames=null; destroyMethodNames=null
	at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.<init>(BeanDefinitionMethodGenerator.java:82)
	at org.springframework.beans.factory.aot.BeanDefinitionMethodGeneratorFactory.getBeanDefinitionMethodGenerator(BeanDefinitionMethodGeneratorFactory.java:100)
	at org.springframework.beans.factory.aot.BeanDefinitionMethodGeneratorFactory.getBeanDefinitionMethodGenerator(BeanDefinitionMethodGeneratorFactory.java:115)
	at org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor.processAheadOfTime(BeanRegistrationsAotProcessor.java:49)
	at org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor.processAheadOfTime(BeanRegistrationsAotProcessor.java:37)
	at org.springframework.context.aot.BeanFactoryInitializationAotContributions.getContributions(BeanFactoryInitializationAotContributions.java:67)
	at org.springframework.context.aot.BeanFactoryInitializationAotContributions.<init>(BeanFactoryInitializationAotContributions.java:49)
	at org.springframework.context.aot.BeanFactoryInitializationAotContributions.<init>(BeanFactoryInitializationAotContributions.java:44)
	at org.springframework.context.aot.ApplicationContextAotGenerator.lambda$processAheadOfTime$0(ApplicationContextAotGenerator.java:58)
	at org.springframework.context.aot.ApplicationContextAotGenerator.withCglibClassHandler(ApplicationContextAotGenerator.java:67)
	at org.springframework.context.aot.ApplicationContextAotGenerator.processAheadOfTime(ApplicationContextAotGenerator.java:53)
	at org.springframework.context.aot.ContextAotProcessor.performAotProcessing(ContextAotProcessor.java:106)
	at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:84)
	at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:49)
	at org.springframework.context.aot.AbstractAotProcessor.process(AbstractAotProcessor.java:82)
	at org.springframework.boot.SpringApplicationAotProcessor.main(SpringApplicationAotProcessor.java:80)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processAot'.
> Process 'command '/Users/jlong/.sdkman/candidates/java/22.3.r17-grl/bin/java'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org/

BUILD FAILED in 2s
18:25:04: Execution finished ':classes :testClasses :aotClasses :aotTestClasses'.
@philwebb philwebb added this to the 3.1.x milestone May 15, 2023
@philwebb philwebb added type: bug A general bug theme: containers Testcontainers and Docker Compose features labels May 15, 2023
@philwebb philwebb self-assigned this May 15, 2023
@joshlong
Copy link
Member

Basically the Docker compose stuff is included and causes pain when doing GraalVM native image builds

@philwebb philwebb removed their assignment May 15, 2023
@wilkinsona
Copy link
Member

@joshlong Did you have the spring-boot-docker-compose dependency in the developmentOnly configuration? If so, it shouldn't have been included in AOT processing or the native image build.

@joshlong
Copy link
Member

@joshlong Did you have the spring-boot-docker-compose dependency in the developmentOnly configuration? If so, it shouldn't have been included in AOT processing or the native image build.

Yah it's a mystery https://github.com/spring-tips/development-containers-with-docker-compose-and-testcontainers/blob/main/build.gradle

@wilkinsona
Copy link
Member

If so, it shouldn't have been included in AOT processing or the native image build.

This was true for a while, but it looks like I broke it in the changes for #32930.

@wilkinsona wilkinsona modified the milestones: 3.1.x, 3.0.x May 16, 2023
@wilkinsona wilkinsona removed the theme: containers Testcontainers and Docker Compose features label May 16, 2023
@wilkinsona wilkinsona changed the title Projects with a spring-boot-docker-compose dependency cannot be AOT processed developmentOnly dependencies are included in the AOT processing classpath May 16, 2023
@wilkinsona wilkinsona self-assigned this May 16, 2023
@wilkinsona wilkinsona modified the milestones: 3.0.x, 3.0.7 May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants