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

Potentially exclude project build test scope from 'compiledWithoutParameters' validation #40318

Closed
holgerstolzenberg opened this issue Apr 11, 2024 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@holgerstolzenberg
Copy link

I am working on a Spring Boot project using native image support via Spring Boot Gradle plugin.

I wanted to use Playtika Testcontainers framework in order provide infrastructure to the integration tests.
Due to this 'com.github.docker-java:docker-java-*' transitive dependencies are occuring in testClasspath.

The docker-java stuff has not been compiled with the '-parameters' option set, which causes the build now to fail fast, throwing MissingParametersCompilerArgumentException:

[...]
Caused by: org.springframework.boot.context.properties.bind.MissingParametersCompilerArgumentException: Constructor binding in a native image requires compilation with -parameters but the following classes were compiled without it:
        com.github.dockerjava.api.model.Capability

        at org.springframework.boot.context.properties.bind.BindableRuntimeHintsRegistrar.registerHints(BindableRuntimeHintsRegistrar.java:100)
        at org.springframework.boot.context.properties.ConfigurationPropertiesBeanFactoryInitializationAotProcessor$ConfigurationPropertiesReflectionHintsContribution.applyTo(ConfigurationPropertiesBeanFactoryInitializationAotProcessor.java:74)
        at org.springframework.context.aot.BeanFactoryInitializationAotContributions.applyTo(BeanFactoryInitializationAotContributions.java:78)
        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.test.context.aot.TestContextAotGenerator.processAheadOfTime(TestContextAotGenerator.java:319)
        ... 10 more

This is the expected behaviour, as looking into here: 421f2fa

I am trying to already address the issue with the docker-java project, but it will take some time being upstream:
docker-java/docker-java#2317

I tried to work around - but failed - using a custom RuntimeHintsRegistrar as discussed here:
mybatis/spring-boot-starter#776

This is actually not a bug, but I wanted to open a discussion if it makes sense to have that fail fast safe-guard in place for test scope also. The classes/dependencies there will never end up in the final image. Not sure tough how to treat that for test compile.

Do you guys see any option for (the) Spring Boot (Maven/Gradle plugin) to opt out from the safeguard for test scope or lets say non runtime scopes.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 11, 2024
@wilkinsona
Copy link
Member

Duplicates #40051.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2024
@wilkinsona wilkinsona added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants