Skip to content

AOT Generated Spring Data Repositories clash in process-aot and process-test-aot #46598

@mipo256

Description

@mipo256

Assume the application production code was build with the spring-boot:process-aot goal executed in Maven or equivalent task in Gradle. This production application code contains Spring Data AOT JPA repositories.

If later the tests for this application are compiled via mvn test-compile with the spring-boot:process-test-aot, then the exception occurs, likely due to the fact the Spring Data AOT Repositories were generated in process-aot step already and then process-test-aot tries to do the same.

To reproduce - if we would run basic mvn clear package with process-aot and process-test-aot as parts of the build as well for the Spring PetClinic with the 4.0.0-M1 as the parent (I'll open PR shortly in PetClinic for that), we would get the following error:

Caused by: java.lang.IllegalStateException: /home/user/OpenSource/spring-petclinic/target/spring-aot/test/sources/org/springframework/samples/petclinic/owner/OwnerRepositoryImpl__Aot.java already exists
	at org.springframework.aot.generate.GeneratedFiles$FileHandler.create(GeneratedFiles.java:279)
	at org.springframework.aot.generate.GeneratedFiles.lambda$addFile$1(GeneratedFiles.java:170)

It is not immediately clear how this issue should be even addressed. I'm sorry if this issue should not reside in the Spring Boot domain at all, just created it to keep track of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: external-projectFor an external project and not something we can fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions