今天在打包的时候遇到一个报错,项目可以正常运行但是就是无法使用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>