Summary
All simple-builders compiler options (e.g. skipFormatting, generateJavaDoc, builderAccess, verbose) require a corresponding -Asimplebuilder.<option>=${simplebuilder.<option>} entry in the project's pom.xml <compilerArgs> section to reach the annotation processor. Setting -Dsimplebuilder.<option>=<value> on the Maven command line alone has no effect, because the annotation processor reads from processingEnv.getOptions() (which only receives -A prefixed args), not from JVM system properties.
The documentation at docs/CONFIGURATION.md and docs/DEBUG_LOGGING.md suggests that mvn compile -Dsimplebuilder.skipFormatting=true works, but this is only true for projects that already have the matching -A mapping in their pom.xml. Users who follow the documentation without adding the mapping will find the option silently ignored.
Steps to reproduce
- In any project using simple-builders, run:
mvn clean compile -Dsimplebuilder.generateJavaDoc=DISABLED
- Check the generated builder source — javadoc is still present, the option had no effect.
Expected behaviour
-Dsimplebuilder.<option>=<value> on the command line should work without requiring additional pom.xml configuration, so users can easily test and toggle options from the console.
Proposed solution
Add a System.getProperty() fallback in CompilerArgumentsReader.readValue() so that JVM system properties (-D) are checked when the -A compiler arg is not present:
public String readValue(CompilerArgumentsEnum argument) {
// 1. Try -A compiler arg (highest priority)
String value = processingEnv.getOptions().get(argument.getCompilerArgument());
if (value == null) {
value = processingEnv.getOptions().get(argument.getOptionName());
}
// 2. Fallback: check JVM system property (-D on command line)
if (value == null) {
value = System.getProperty(argument.getCompilerArgument());
}
return value;
}
This establishes a clear priority chain:
- Annotation values (
@SimpleBuilder.Options) — highest priority
-A compiler args — medium priority (explicit, pom-configured)
-D system properties — fallback (command-line convenience)
- Defaults — lowest priority
The -A path remains the canonical mechanism (as documented for Maven/Gradle/IntelliJ), while -D becomes a zero-config convenience for command-line usage.
Affected files
processor/src/main/java/org/javahelpers/simple/builders/processor/processing/CompilerArgumentsReader.java — add system property fallback
docs/CONFIGURATION.md — clarify that -D works as a fallback (no pom.xml change required)
docs/DEBUG_LOGGING.md — already documents the -A requirement; update to mention -D also works
Impact
- No breaking changes — existing
-A mappings continue to take priority
- Improved UX — all options work from command line out of the box
- Documentation becomes accurate —
mvn compile -Dsimplebuilder.skipFormatting=true works as documented
Summary
All simple-builders compiler options (e.g.
skipFormatting,generateJavaDoc,builderAccess,verbose) require a corresponding-Asimplebuilder.<option>=${simplebuilder.<option>}entry in the project'spom.xml<compilerArgs>section to reach the annotation processor. Setting-Dsimplebuilder.<option>=<value>on the Maven command line alone has no effect, because the annotation processor reads fromprocessingEnv.getOptions()(which only receives-Aprefixed args), not from JVM system properties.The documentation at
docs/CONFIGURATION.mdanddocs/DEBUG_LOGGING.mdsuggests thatmvn compile -Dsimplebuilder.skipFormatting=trueworks, but this is only true for projects that already have the matching-Amapping in their pom.xml. Users who follow the documentation without adding the mapping will find the option silently ignored.Steps to reproduce
Expected behaviour
-Dsimplebuilder.<option>=<value>on the command line should work without requiring additional pom.xml configuration, so users can easily test and toggle options from the console.Proposed solution
Add a
System.getProperty()fallback inCompilerArgumentsReader.readValue()so that JVM system properties (-D) are checked when the-Acompiler arg is not present:This establishes a clear priority chain:
@SimpleBuilder.Options) — highest priority-Acompiler args — medium priority (explicit, pom-configured)-Dsystem properties — fallback (command-line convenience)The
-Apath remains the canonical mechanism (as documented for Maven/Gradle/IntelliJ), while-Dbecomes a zero-config convenience for command-line usage.Affected files
processor/src/main/java/org/javahelpers/simple/builders/processor/processing/CompilerArgumentsReader.java— add system property fallbackdocs/CONFIGURATION.md— clarify that-Dworks as a fallback (no pom.xml change required)docs/DEBUG_LOGGING.md— already documents the-Arequirement; update to mention-Dalso worksImpact
-Amappings continue to take prioritymvn compile -Dsimplebuilder.skipFormatting=trueworks as documented