@@ -602,16 +602,26 @@ public class Jsonschema2PojoMojo extends AbstractMojo implements GenerationConfi
602
602
* create public fields instead
603
603
*
604
604
*/
605
- @ Parameter (property = "jsonschame2pojo .includeSetters" , defaultValue = "true" )
605
+ @ Parameter (property = "jsonschema2pojo .includeSetters" , defaultValue = "true" )
606
606
private boolean includeSetters = true ;
607
607
608
608
/**
609
- * The target version for generated source files.
610
- *
611
- * @since 0.4.17
609
+ * The target version for generated source files, used whenever decisions are made
610
+ * about generating source code that may be incompatible with older JVMs. Acceptable values
611
+ * include e.g. 1.6, 1.8, 8, 9, 10, 11.
612
+ * <p/>
613
+ * If not set, the value of targetVersion is auto-detected. For auto-detection, the first
614
+ * value found in the following list will be used:
615
+ * <ol>
616
+ * <li>maven.compiler.source property</li>
617
+ * <li>maven.compiler.release property</li>
618
+ * <li>maven-compiler-plugin 'source' configuration option</li>
619
+ * <li>maven-compiler-plugin 'release' configuration option</li>
620
+ * <li>the current JVM version</li>
621
+ * </ol>
612
622
*/
613
- @ Parameter (property = "jsonschema2pojo.targetJavaVersion" , defaultValue = "${maven.compiler.target} " )
614
- private String targetVersion = "" ;
623
+ @ Parameter (property = "jsonschema2pojo.targetVersion " )
624
+ private String targetVersion ;
615
625
616
626
/**
617
627
* Whether to include dynamic getters, setters, and builders or to omit
@@ -1125,11 +1135,13 @@ private void setTargetVersion() {
1125
1135
1126
1136
if (project .getProperties () != null && project .getProperties ().containsKey ("maven.compiler.source" )) {
1127
1137
this .targetVersion = project .getProperties ().get ("maven.compiler.source" ).toString ();
1138
+ getLog ().debug ("Using maven.compiler.source to set targetVersion for generated sources (" + this .targetVersion + ")" );
1128
1139
return ;
1129
1140
}
1130
1141
1131
1142
if (project .getProperties () != null && project .getProperties ().containsKey ("maven.compiler.release" )) {
1132
1143
this .targetVersion = project .getProperties ().get ("maven.compiler.release" ).toString ();
1144
+ getLog ().debug ("Using maven.compiler.release to set targetVersion for generated sources (" + this .targetVersion + ")" );
1133
1145
return ;
1134
1146
}
1135
1147
@@ -1138,18 +1150,21 @@ private void setTargetVersion() {
1138
1150
final Xpp3Dom compilerSourceConfig = ((Xpp3Dom ) p .getConfiguration ()).getChild ("source" );
1139
1151
if (compilerSourceConfig != null ) {
1140
1152
this .targetVersion = compilerSourceConfig .getValue ();
1153
+ getLog ().debug ("Using maven-compiler-plugin 'source' to set targetVersion for generated sources (" + this .targetVersion + ")" );
1141
1154
return ;
1142
1155
}
1143
1156
1144
1157
final Xpp3Dom compilerReleaseConfig = ((Xpp3Dom ) p .getConfiguration ()).getChild ("release" );
1145
1158
if (compilerReleaseConfig != null ) {
1146
1159
this .targetVersion = compilerReleaseConfig .getValue ();
1160
+ getLog ().debug ("Using maven-compiler-plugin 'release' to set targetVersion for generated sources (" + this .targetVersion + ")" );
1147
1161
return ;
1148
1162
}
1149
1163
}
1150
1164
}
1151
1165
1152
1166
this .targetVersion = JavaVersion .parse (System .getProperty ("java.version" ));
1167
+ getLog ().debug ("Using JVM to set targetVersion for generated sources (" + this .targetVersion + ")" );
1153
1168
}
1154
1169
1155
1170
@ Override
0 commit comments