![](/img/trans.png)
[英]Scalatest building and running in Intellij, but not building the project when run on the command line with maven
[英]In IntelliJ, how do I pass command line variables when building with Maven (TestNG run configuration)?
我正在嘗試執行以下操作,但是在具有TestNG運行配置的IntelliJ中:
mvn clean install -Dfoo=bar
因此,foo系統屬性的值應為bar:
System.out.println(System.getProperty("foo"));
======
bar
我搜索過的所有可能答案都告訴我將變量硬編碼到pom.xml中(我不能這樣做),或者說“ 僅在Edit Configurations ...中進行設置 ”,而不顯示正確設置的變量。 我也瀏覽了IntelliJ手冊。
我在“運行/調試配置/參數”選項卡和“運行/調試配置/環境變量”中都嘗試了“ foo”的所有邏輯名稱,例如Dfoo和-Dfoo 。
使用Maven配置而不是TestNG配置。 您仍然可以從Maven配置中運行TestNG測試:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.