0

If I am trying to run my SpringBoot project while it is stored in any folder located on Desktop on my MacBook - build fails.

If I move project to any other directory except Desktop - it builds fine.

What can be the reason?

Error message after maven clean - install:

[INFO] 
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ my-blog-springboot-v1 ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running ua.shamray.myblogspringbootv1.repository.AccountRepositoryTest
17:49:32.502 [main] DEBUG org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [AccountRepositoryTest]: using SpringBootContextLoader
17:49:32.508 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [ua.shamray.myblogspringbootv1.repository.AccountRepositoryTest]: no resource found for suffixes {-context.xml, Context.groovy}.
17:49:32.509 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [ua.shamray.myblogspringbootv1.repository.AccountRepositoryTest]: AccountRepositoryTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.


17:49:32.804 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Failed to complete search in directory [/Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/test-classes/ua/shamray] for files matching pattern [*.class]: java.nio.file.NoSuchFileException: /Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/test-classes/ua/shamray
17:49:32.805 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Failed to complete search in directory [/Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/classes/ua/shamray] for files matching pattern [*.class]: java.nio.file.NoSuchFileException: /Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/classes/ua/shamray
17:49:32.806 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Failed to complete search in directory [/Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/test-classes/ua] for files matching pattern [*.class]: java.nio.file.NoSuchFileException: /Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/test-classes/ua
17:49:32.807 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Failed to complete search in directory [/Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/classes/ua] for files matching pattern [*.class]: java.nio.file.NoSuchFileException: /Users/nikitashamray/Desktop/IDEA%20Projects/my-blog-springboot-v1/target/classes/ua
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.012 s <<< FAILURE! - in ua.shamray.myblogspringbootv1.MyBlogSpringbootV1ApplicationTests
[ERROR] ua.shamray.myblogspringbootv1.MyBlogSpringbootV1ApplicationTests  Time elapsed: 0.012 s  <<< ERROR!
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test
[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   MyBlogSpringbootV1ApplicationTests » IllegalState Unable to find a @SpringBoot...
[ERROR]   AccountControllerTest » IllegalState Unable to find a @SpringBootConfiguration...
[ERROR]   AccountRepositoryTest » IllegalState Unable to find a @SpringBootConfiguration...
[ERROR]   AccountServiceImplUnitTest » IllegalState Unable to find a @SpringBootConfigur...
[ERROR]   MyUserDetailsServiceImplUnitTest » IllegalState Unable to find a @SpringBootCo...
[ERROR]   PostServiceImpUnitTest » IllegalState Unable to find a @SpringBootConfiguratio...
[ERROR]   RoleServiceImplUnitTest » IllegalState Unable to find a @SpringBootConfigurati...
[INFO] 
[ERROR] Tests run: 7, Failures: 0, Errors: 7, Skipped: 0
[INFO] 
  • Can you explain why you need to run the build from a folder on the Desktop? That seems like a strange thing to do. – egeorge Feb 16 '23 at 19:07
  • https://stackoverflow.com/questions/47487609/unable-to-find-a-springbootconfiguration-you-need-to-use-contextconfiguration – F.C.Hsiao Feb 17 '23 at 07:56
  • @egeorge, I am developing an educational small spring boot projects and it is convenient to store them all in a single folder located on a Desktop.. This problem has never happened before. – Nikita Shamrai Feb 17 '23 at 10:29

0 Answers0