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