IDEA 運行單元測試報錯 @{argLine}


sentinel是今年阿里開源的高可用防護的流量管理框架

git地址:https://github.com/alibaba/Sentinel

wiki:https://github.com/alibaba/Sentinel/wiki

FAQ:https://github.com/alibaba/Sentinel/wiki/FAQ

--------------------------------------------------------------------------------------------------------------------------------------------------------

工程里有很多單元測試,在IDEA里運行時報錯:

����: �Ҳ������޷��������� @{argLine}

 

錯誤信息有亂碼,VM參數加上-Dfile.encoding=UTF-8,再次運行:

錯誤: 找不到或無法加載主類 @{argLine}

 

解決方法:File->Settings->Build,Execution,Deployment->Build Tools->Maven->Running Tests 去掉argLine的勾選

--------------------------------------------------------------------------------------------------------------------------------------------------------

ctrl+shift+F全局搜索@{argLine},發現在sentinel-parent父工程的pom.xml里,使用了一個maven插件

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <!-- CircleCI build workaround -->
        <argLine>@{argLine} -Xms1024m -Xmx2048m</argLine>         
        <useSystemClassLoader>false</useSystemClassLoader>
    </configuration>
</plugin>

參考maven官方文檔:http://maven.apache.org/surefire/maven-surefire-plugin/faq.html#late-property-evaluation

allows late replacement of properties when the plugin is executed, so properties that have been modified by other plugins will be picked up correctly.

該占位符能讓后面的插件在執行時正確的替換屬性。

sentinel官方團隊也在釘釘群給了說明:

這是 CI 生成測試覆蓋率報告的時候自動裝填用的,本地可以去掉。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM