diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java index 4946d3182530..038d2cc4a99f 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java @@ -444,7 +444,8 @@ public final class CompileDriver { if (isRebuild) { // if possible, ensure the rebuild starts from the clean state // if CLEAR_OUTPUT_DIRECTORY is allowed, we can clear cached directory completely, otherwise the build won't be able to clean outputs correctly without build caches - boolean canCleanBuildSystemData = Boolean.TRUE.equals(REBUILD_CLEAN.get(scope)) && CompilerWorkspaceConfiguration.getInstance(myProject).CLEAR_OUTPUT_DIRECTORY; + boolean cleanBuildRequested = Boolean.TRUE.equals(REBUILD_CLEAN.get(scope)); + boolean canCleanBuildSystemData = cleanBuildRequested && CompilerWorkspaceConfiguration.getInstance(myProject).CLEAR_OUTPUT_DIRECTORY; CompilerUtil.runInContext(compileContext, JavaCompilerBundle.message("progress.text.clearing.build.system.data"), (ThrowableRunnable)() -> { TaskFuture cancelPreload = canCleanBuildSystemData? buildManager.cancelPreloadedBuilds(myProject) : new TaskFutureAdapter<>(CompletableFuture.completedFuture(Boolean.TRUE)); @@ -458,6 +459,13 @@ public final class CompileDriver { buildSystemDataCleanupTask.set(new TaskFutureAdapter<>(FileUtil.asyncDelete(Arrays.asList(systemFiles)))); } } + else { + if (cleanBuildRequested) { + compileContext.addMessage( + CompilerMessageCategory.INFORMATION, JavaCompilerBundle.message("error.clean.state.rebuild.not.possible"), null, -1, -1 + ); + } + } }); } diff --git a/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties b/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties index d5bab84cead7..07206f0706f6 100644 --- a/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties +++ b/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties @@ -359,4 +359,5 @@ notification.action.install.space.plugin=Install Space plugin notification.action.enable.space.plugin=Enable Space plugin notification.title.git.crlf.config=Wrong Git line-endings configuration notification.content.git.crlf.config=To have working compiler caches you need to execute {0} command and force checkout the project -class.can.be.record.suppress.conversion.if.annotated.description=Specify class names or package wildcards like com.example.* \ No newline at end of file +class.can.be.record.suppress.conversion.if.annotated.description=Specify class names or package wildcards like com.example.* +error.clean.state.rebuild.not.possible=Complete cleaning of build system data is not possible, if option 'Clear output directory on rebuild' is set to 'false'. Build system data will be cleared as a part of project rebuild. \ No newline at end of file