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 生成測試覆蓋率報告的時候自動裝填用的,本地可以去掉。