Skip to content

Commit 6222bb2

Browse files
committed
allow to disable automatic compile source root
1 parent 268702c commit 6222bb2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/main/java/io/openapiprocessor/maven/ProcessMojo.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
/**
2222
* run an openapi-processor.
23-
* Except for id==json the generated sources are added to the compile source roots.
2423
*/
2524
@Mojo (name = "process", defaultPhase = LifecyclePhase.GENERATE_SOURCES)
2625
public class ProcessMojo extends AbstractMojo {
@@ -36,6 +35,9 @@ public class ProcessMojo extends AbstractMojo {
3635
@Parameter(required = false)
3736
private Options options;
3837

38+
@Parameter(required = false, defaultValue = "true")
39+
private boolean addSourceRoot;
40+
3941
@Parameter(readonly = true, required = true, defaultValue = "${project}")
4042
private MavenProject project;
4143

@@ -54,7 +56,7 @@ public void execute () throws MojoExecutionException {
5456

5557
String targetDir = (String) properties.computeIfAbsent (TARGET_DIR, k -> project.getBuild().getDirectory() + File.pathSeparator + "generated-sources" + File.pathSeparator + id);
5658

57-
if (!"json".equals(id)) {
59+
if (addSourceRoot) {
5860
project.addCompileSourceRoot(targetDir);
5961
}
6062

0 commit comments

Comments
 (0)