compileSourceFiles() — spring-boot Function Reference
Architecture documentation for the compileSourceFiles() function in AbstractAotMojo.java from the spring-boot codebase.
Entity Profile
Dependency Diagram
graph TD de89bf5e_160b_56a9_1ed5_f0de540763f1["compileSourceFiles()"] 2e22c1a4_f0e1_1a04_4d9b_4cfee7d8a129["toString()"] de89bf5e_160b_56a9_1ed5_f0de540763f1 -->|calls| 2e22c1a4_f0e1_1a04_4d9b_4cfee7d8a129 f61eccaa_67fd_c535_fdd4_1c226130cefe["hasReportedErrors()"] de89bf5e_160b_56a9_1ed5_f0de540763f1 -->|calls| f61eccaa_67fd_c535_fdd4_1c226130cefe style de89bf5e_160b_56a9_1ed5_f0de540763f1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractAotMojo.java lines 140–182
protected final void compileSourceFiles(URL[] classPath, File sourcesDirectory, File outputDirectory)
throws Exception {
List<Path> sourceFiles;
try (Stream<Path> pathStream = Files.walk(sourcesDirectory.toPath())) {
sourceFiles = pathStream.filter(Files::isRegularFile).toList();
}
if (sourceFiles.isEmpty()) {
return;
}
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
try (StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null)) {
JavaCompilerPluginConfiguration compilerConfiguration = new JavaCompilerPluginConfiguration(this.project);
List<String> args = new ArrayList<>();
args.addAll(ClassPath.of(classPath).args(false));
args.add("-d");
args.add(outputDirectory.toPath().toAbsolutePath().toString());
String releaseVersion = compilerConfiguration.getReleaseVersion();
if (releaseVersion != null) {
args.add("--release");
args.add(releaseVersion);
}
else {
String source = compilerConfiguration.getSourceMajorVersion();
if (source != null) {
args.add("--source");
args.add(source);
}
String target = compilerConfiguration.getTargetMajorVersion();
if (target != null) {
args.add("--target");
args.add(target);
}
}
args.addAll(new RunArguments(this.compilerArguments).getArgs());
Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromPaths(sourceFiles);
Errors errors = new Errors();
CompilationTask task = compiler.getTask(null, fileManager, errors, args, null, compilationUnits);
boolean result = task.call();
if (!result || errors.hasReportedErrors()) {
throw new IllegalStateException("Unable to compile generated source" + errors);
}
}
}
Domain
Subdomains
Calls
- hasReportedErrors()
- toString()
Source
Frequently Asked Questions
What does compileSourceFiles() do?
compileSourceFiles() is a function in the spring-boot codebase.
What does compileSourceFiles() call?
compileSourceFiles() calls 2 function(s): hasReportedErrors, toString.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free