Default added sourceFolder to src/main/java

Fallback to "src/main/java" for added source folder instead of a NullpointerException when no source folder ist configured in the pom
This commit is contained in:
Stephan Wienczny 2016-11-04 15:35:48 +01:00 committed by GitHub
parent 901a981f26
commit 9436ba106c

View File

@ -310,7 +310,10 @@ public class CodeGenMojo extends AbstractMojo {
}
if (addCompileSourceRoot) {
String sourceJavaFolder = output.toString() + "/" + configOptions.get(CodegenConstants.SOURCE_FOLDER);
final Object sourceFolderObject = configOptions.get(CodegenConstants.SOURCE_FOLDER);
final String sourceFolder = sourceFolderObject == null ? "src/main/java" : sourceFolderObject.toString();
String sourceJavaFolder = output.toString() + "/" + sourceFolder;
project.addCompileSourceRoot(sourceJavaFolder);
}
}