我正在使用 2.7.4 版本的 Spring Boot Maven 插件,對argumentsset 在pom.xml. 在那里,似乎無法通過在命令列上指定一些來覆寫它們。
根據檔案
應傳遞給應用程式的命令列引數。使用空格分隔多個引數,并確保在引號之間包含多個值。指定時,優先于#arguments。
如果我有這個pom.xml:
<configuration>
<arguments>
<argument>--oh_hello=there</argument>
</arguments>
</configuration>
然后我不能通過例如使用來覆寫它mvn spring-boot:run -Dspring-boot.run.arguments="--hello=world"。
Spring 應用程式啟動時看到的引數卡在pom.xml. 我希望能夠覆寫這一點。是我誤會了,還是這是一個錯誤?
GitHub 上的完整示例。
uj5u.com熱心網友回復:
盡管看起來違反直覺,Maven 插件通常以這種方式運行,配置pom.xml優先于命令列配置。
Spring Boot 的 Maven 插件的參考檔案建議使用專案屬性來允許在命令列上配置設定。在你的情況下,這看起來像這樣:
<properties>
<run.arguments>--hello=there</run.arguments>
</properties>
<configuration>
<arguments>
<argument>${run.arguments}</argument>
</arguments>
</configuration>
mvn spring-boot:run -Drun.arguments="--hello=world"
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/516204.html
標籤:弹簧靴行家
上一篇:生成的war檔案中的空WEB-INF/classes(Springbootmaven專案)
下一篇:PactMaven-Springboot研討會步驟1失敗并出現IllegalStateException:FailedtogetnestedarchiveforentryBOOT-INF/lib/lo
