英文:
Maven build failing due to unrecognized `--settings` option
问题
在我的使用Maven构建的Java项目中,我有一个名为.mvn
的目录,其中包含一个maven.config
文件。该文件的内容如下:
--settings ./.mvn/local-settings.xml
local-settings.xml
文件包含了用于从私有仓库拉取代码的身份验证凭据。
这个设置一直运作正常,直到昨天。现在,CI构建(使用maven:3-amazoncorretto-17
)失败,并显示以下错误消息:
无法解析maven.config文件选项:未识别的选项:--settings ./.mvn/local-settings.xml
我正在使用的maven
镜像是否发生了破坏性的更改?
英文:
In my Java projects building with maven, I have a a .mvn
directory that contains a maven.config
file. Content of that file is as follows:
--settings ./.mvn/local-settings.xml
The local-settings.xml
holds authentication credentials for pulling from a private registry.
This setup worked fine up until yesterday. Now, the CI build (using maven:3-amazoncorretto-17
) is failing with the following error message:
Unable to parse maven.config file options: Unrecognized option: --settings ./.mvn/local-settings.xml
Has there been a breaking change in the maven
image I am using for building?
答案1
得分: 34
自从引入了maven 3.9
,就有一个重大变更影响了maven.config
文件的解析:
https://maven.apache.org/docs/3.9.0/release-notes.html#potentially-breaking-core-changes
.mvn/maven.config
中的每一行现在被解释为一个单独的参数。也就是说,如果文件包含多个参数,现在必须将它们放在不同的行上,参见MNG-7684。
正如评论中@khmarbaise所指出的,向maven.config
添加一个换行符可以正常工作,甚至向下兼容。
--settings
./.mvn/local-settings.xml
**重要提示:**在--settings
后面不能有空格。
英文:
With the introduction of maven 3.9
, there was a BREAKING CHANGE that affects the parsing of the maven.config
file:
https://maven.apache.org/docs/3.9.0/release-notes.html#potentially-breaking-core-changes
> Each line in .mvn/maven.config
is now interpreted as a single argument. That is, if the file contains multiple arguments, these must now be placed on separate lines, see MNG-7684.
As pointed out by @khmarbaise in the comments, adding a newline in the maven.config
works just fine and is even downwards compatible.
--settings
./.mvn/local-settings.xml
IMPORTANT NOTE: There must not be a whitespace after --settings
答案2
得分: 4
"-s./.mvn/settings.xml" 也可以工作,没有任何空格。
英文:
Also noticed that -s./.mvn/settings.xml
works too without any space
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论