|
20 | 20 |
|
21 | 21 | /** |
22 | 22 | * run an openapi-processor. |
| 23 | + * Except for id==json the generated sources are added to the compile source roots. |
23 | 24 | */ |
24 | 25 | @Mojo (name = "process", defaultPhase = LifecyclePhase.GENERATE_SOURCES) |
25 | 26 | public class ProcessMojo extends AbstractMojo { |
@@ -49,12 +50,16 @@ public void execute () throws MojoExecutionException { |
49 | 50 |
|
50 | 51 | File source = apiPath.getParentFile (); |
51 | 52 | String relativeSource = stripBaseDir (source.getAbsolutePath ()); |
52 | | - getLog().info(String.format ("%10s - ${project.basedir}/%s", "apiPath", relativeSource)); |
| 53 | + getLog().info(String.format ("%10s - ${project.basedir}%s%s", "apiPath", File.pathSeparator, relativeSource)); |
| 54 | + |
| 55 | + String targetDir = (String) properties.computeIfAbsent (TARGET_DIR, k -> project.getBuild().getDirectory() + File.pathSeparator + "generated-sources" + File.pathSeparator + id); |
| 56 | + |
| 57 | + if (!"json".equals(id)) { |
| 58 | + project.addCompileSourceRoot(targetDir); |
| 59 | + } |
53 | 60 |
|
54 | | - String targetDir = (String) properties.computeIfAbsent (TARGET_DIR, k -> project.getBuild().getDirectory() + "/generated-sources/" + id); |
55 | | - project.addCompileSourceRoot(targetDir); |
56 | 61 | String relativeTargetDir = stripBaseDir (targetDir); |
57 | | - getLog().info(String.format ("%10s - ${project.basedir}/%s", "targetDir", relativeTargetDir)); |
| 62 | + getLog().info(String.format ("%10s - ${project.basedir}%s%s", "targetDir", File.pathSeparator, relativeTargetDir)); |
58 | 63 |
|
59 | 64 | File targetRoot = new File(targetDir); |
60 | 65 | UpToDateCheck upToDateCheck = new UpToDateCheck (); |
|
0 commit comments