今天在打包的時候遇到一個報錯,項目可以正常運行但是就是無法使用MAVEN 的insert和package進行打包
報錯如下
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.262 s <<< FAILURE! - in com.example.demo.IotInterfaceApplicationTests Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.262 s <<< FAILURE! - in com.example.demo.IotInterfaceApplicationTests com.example.demo.IotInterfaceApplicationTests Time elapsed: 0.261 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: Errors: IotInterfaceApplicationTests » IllegalState Unable to find a @SpringBootConfig... [INFO] [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0 Tests run: 1, Failures: 0, Errors: 1, Skipped: 0 [INFO]
解決方法:
在POM.XML添加 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin>