8000 Potentially exclude project build test scope from 'compiledWithoutParameters' validation · Issue #40318 · spring-projects/spring-boot · GitHub
[go: up one dir, main page]

Skip to content
Potentially exclude project build test scope from 'compiledWithoutParameters' validation #40318
@holgerstolzenberg

Description

@holgerstolzenberg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0