SpringBoot 在IDEA中用MAVEN打包报错


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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM