在新公司跑測試類時報了如下異常:
Failed to resolve org.junit.platform:junit-platform-launcher:1.5.2
百度了下,說是:
這里的問題是IntelliJ試圖在不使用IDE中配置的Maven“用戶設置文件”(settings.xml)的情況下解決所需的工件本身孽亲。它將直接連接到Maven Central,但被我的雇主屏蔽了
這里我的情況是一樣的殖告,公司項目屏蔽外網(wǎng)茴肥,使用的是內部提供的maven settings.xml文件,連接settings中未設置的項時會被屏蔽;
解決辦法:
<dependency>?
<!--?this?is?needed?or?IntelliJ?gives?junit.jar?or?junit-platform-launcher:1.3.2?not?found?errors?-->????????????
<groupId>org.junit.platform</groupId>????????????
<artifactId>junit-platform-launcher</artifactId>????????????
<scope>test</scope>
</dependency>
結果:測試案例順利啟動
參考:https://blog.csdn.net/u013761772/article/details/104788290/