Skip to content

AOT Repositories: OwnerRepository.json already exists #3354

@mhalbritter

Description

@mhalbritter

I've upgraded Spring Petclinic to use Spring Boot 4.0.0-M2. When building with Maven ./mvnw verify all works. When building with Gradle (./gradlew build), processTestAot fails with:

Exception in thread "main" org.springframework.test.context.aot.TestContextAotException: Failed to generate AOT artifacts for test classes [org.springframework.samples.petclinic.PostgresIntegrationTests] at org.springframework.test.context.aot.TestContextAotGenerator.lambda$processAheadOfTime$3(TestContextAotGenerator.java:286) at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721) at org.springframework.util.MultiValueMapAdapter.forEach(MultiValueMapAdapter.java:174) at org.springframework.test.context.aot.TestContextAotGenerator.processAheadOfTime(TestContextAotGenerator.java:244) at org.springframework.test.context.aot.TestContextAotGenerator.processAheadOfTime(TestContextAotGenerator.java:205) at org.springframework.test.context.aot.TestAotProcessor.performAotProcessing(TestAotProcessor.java:91) at org.springframework.test.context.aot.TestAotProcessor.doProcess(TestAotProcessor.java:72) at org.springframework.test.context.aot.TestAotProcessor.doProcess(TestAotProcessor.java:39) at org.springframework.context.aot.AbstractAotProcessor.process(AbstractAotProcessor.java:84) at org.springframework.boot.test.context.SpringBootTestAotProcessor.main(SpringBootTestAotProcessor.java:63) Caused by: java.lang.IllegalStateException: /home/mhalbritter/Projects/mhalbritter/spring-petclinic/build/generated/aotTestResources/org/springframework/samples/petclinic/owner/OwnerRepository.json 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) at org.springframework.util.function.ThrowingConsumer.accept(ThrowingConsumer.java:60) at org.springframework.util.function.ThrowingConsumer.accept(ThrowingConsumer.java:49) at org.springframework.aot.generate.FileSystemGeneratedFiles.handleFile(FileSystemGeneratedFiles.java:90) at org.springframework.aot.generate.GeneratedFiles.addFile(GeneratedFiles.java:170) at org.springframework.aot.generate.GeneratedFiles.addFile(GeneratedFiles.java:155) at org.springframework.aot.generate.GeneratedFiles.addResourceFile(GeneratedFiles.java:109) at org.springframework.aot.generate.GeneratedFiles.addResourceFile(GeneratedFiles.java:98) at org.springframework.data.repository.aot.generate.RepositoryContributor.lambda$contribute$0(RepositoryContributor.java:135) at org.springframework.aot.generate.GeneratedClass.getBuilder(GeneratedClass.java:153) at org.springframework.aot.generate.GeneratedClass.apply(GeneratedClass.java:143) at org.springframework.aot.generate.GeneratedClass.generateJavaFile(GeneratedClass.java:138) at org.springframework.aot.generate.GeneratedClasses.writeTo(GeneratedClasses.java:199) at org.springframework.aot.generate.DefaultGenerationContext.writeGeneratedContent(DefaultGenerationContext.java:136) at org.springframework.test.context.aot.TestContextAotGenerator.lambda$processAheadOfTime$3(TestContextAotGenerator.java:281) ... 9 more 

I couldn't spot any bugs in the Gradle setup, so I think this is a bug in Spring Data. Maybe related to #3339?

You can find the Spring Petclinic with Boot 4.0.0-M2 in this branch.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions