diff --git a/plantuml-plugin/src/main/java/io/freefair/gradle/plugins/plantuml/PlantumlTask.java b/plantuml-plugin/src/main/java/io/freefair/gradle/plugins/plantuml/PlantumlTask.java index b3841cf5..e7a32434 100644 --- a/plantuml-plugin/src/main/java/io/freefair/gradle/plugins/plantuml/PlantumlTask.java +++ b/plantuml-plugin/src/main/java/io/freefair/gradle/plugins/plantuml/PlantumlTask.java @@ -42,6 +42,10 @@ public class PlantumlTask extends SourceTask { @Input private final Property includePattern = getProject().getObjects().property(String.class).convention("**/*.puml"); + @Getter + @Input + private final Property deleteOutputBeforeBuild = getProject().getObjects().property(Boolean.class).convention(true); + @Inject public PlantumlTask(WorkerExecutor workerExecutor, FileSystemOperations fileSystemOperations) { this.fileSystemOperations = fileSystemOperations; @@ -52,7 +56,9 @@ public PlantumlTask(WorkerExecutor workerExecutor, FileSystemOperations fileSyst @TaskAction public void execute() { - fileSystemOperations.delete(deleteSpec -> deleteSpec.delete(outputDirectory)); + if(deleteOutputBeforeBuild.get()) { + fileSystemOperations.delete(deleteSpec -> deleteSpec.delete(outputDirectory)); + } WorkQueue workQueue = workerExecutor.processIsolation(process -> { process.getClasspath().from(plantumlClasspath);