diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 5a0c1d15cf..b3f29d57cd 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -388,7 +388,8 @@ public class MavenCli { if (configFile.isFile()) { try (Stream 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); List unrecognized = mavenConfig.getArgList(); if (!unrecognized.isEmpty()) { diff --git a/maven-embedder/src/test/projects/mavenConfigProperties/.mvn/maven.config b/maven-embedder/src/test/projects/mavenConfigProperties/.mvn/maven.config index 82570230fd..7f7a68702f 100644 --- a/maven-embedder/src/test/projects/mavenConfigProperties/.mvn/maven.config +++ b/maven-embedder/src/test/projects/mavenConfigProperties/.mvn/maven.config @@ -1,3 +1,4 @@ +# a comment -T 3 -Drevision=1.3.0