|
26 | 26 | import java.util.Objects; |
27 | 27 |
|
28 | 28 | import org.apache.maven.api.Project; |
29 | | -import org.apache.maven.api.ProjectScope; |
30 | 29 | import org.apache.maven.api.Session; |
31 | 30 | import org.apache.maven.api.di.Inject; |
32 | | -import org.apache.maven.api.model.Build; |
33 | 31 | import org.apache.maven.api.plugin.Log; |
34 | 32 | import org.apache.maven.api.plugin.MojoException; |
35 | 33 | import org.apache.maven.api.plugin.annotations.Mojo; |
@@ -344,20 +342,9 @@ private List<Path> getDirectories() { |
344 | 342 | if (project != null && session != null) { |
345 | 343 | ProjectManager projectManager = session.getService(ProjectManager.class); |
346 | 344 | if (projectManager != null) { |
347 | | - final Build build = project.getBuild(); |
348 | 345 | projectManager.getSourceRoots(project).forEach((source) -> { |
349 | 346 | source.targetPath().ifPresent((targetPath) -> { |
350 | | - // TODO: we can replace by `Project.getOutputDirectory(scope)` if MVN-11322 is merged. |
351 | | - String base; |
352 | | - ProjectScope scope = source.scope(); |
353 | | - if (scope == ProjectScope.MAIN) { |
354 | | - base = build.getOutputDirectory(); |
355 | | - } else if (scope == ProjectScope.TEST) { |
356 | | - base = build.getTestOutputDirectory(); |
357 | | - } else { |
358 | | - base = build.getDirectory(); |
359 | | - } |
360 | | - Path dir = project.getBasedir().resolve(base); |
| 347 | + Path dir = project.getOutputDirectory(source.scope()); |
361 | 348 | directories.add(dir.resolve(targetPath)); |
362 | 349 | }); |
363 | 350 | }); |
|
0 commit comments