[MNG-7698] Support comments in maven.config (#1134)

This commit is contained in:
Guillaume Nodet 2023-06-04 07:10:57 +02:00 committed by GitHub
parent 84e133df7c
commit c124554316
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -388,7 +388,8 @@ public class MavenCli {
if (configFile.isFile()) { if (configFile.isFile()) {
try (Stream<String> lines = Files.lines(configFile.toPath(), Charset.defaultCharset())) { try (Stream<String> lines = Files.lines(configFile.toPath(), Charset.defaultCharset())) {
String[] args = lines.filter(arg -> !arg.isEmpty()).toArray(String[]::new); String[] args = lines.filter(arg -> !arg.isEmpty() && !arg.startsWith("#"))
.toArray(String[]::new);
mavenConfig = cliManager.parse(args); mavenConfig = cliManager.parse(args);
List<?> unrecognized = mavenConfig.getArgList(); List<?> unrecognized = mavenConfig.getArgList();
if (!unrecognized.isEmpty()) { if (!unrecognized.isEmpty()) {

View File

@ -1,3 +1,4 @@
# a comment
-T -T
3 3
-Drevision=1.3.0 -Drevision=1.3.0