Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven build failing due to unrecognized `--settings` option

Tags:

java

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?

like image 546
mxcd Avatar asked Nov 25 '25 09:11

mxcd


2 Answers

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

like image 77
mxcd Avatar answered Nov 27 '25 00:11

mxcd


Also noticed that -s./.mvn/settings.xml works too without any space

like image 38
Rahul Avatar answered Nov 26 '25 23:11

Rahul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!