intellij-platform-gradle-plugin
intellij-platform-gradle-plugin copied to clipboard
NoSuchFileException: build/tmp/initializeIntelliJPlugin/coroutines-javaagent.jar
What happened?
I get NoSuchFileException: build/tmp/initializeIntelliJPlugin/coroutines-javaagent.jar when running ./gradlew clean build
multiple times after updating to 1.16, it was introduced in 1.16 though.
This error is persistent, even running clean
does not help, nor deleting the .gradle
or build
folder. Only workaround I found is downgrading to 1.15.
This won't happen on CI because it is only executed once.
Relevant log output or stack trace
Caused by: java.nio.file.NoSuchFileException: /Users/philipwedemann/GitHub/kobol/intellij-plugin/build/tmp/initializeIntelliJPlugin/coroutines-javaagent.jar
at com.jetbrains.plugin.structure.base.utils.FileUtilKt.outputStream(FileUtil.kt:38)
at org.jetbrains.intellij.tasks.InitializeIntelliJPluginTask.createCoroutinesJavaAgentFile(InitializeIntelliJPluginTask.kt:95)
at org.jetbrains.intellij.tasks.InitializeIntelliJPluginTask.initialize(InitializeIntelliJPluginTask.kt:51)
Steps to reproduce
- Checkout https://github.com/hfhbd/kobol/tree/reproducer
- Run
./gradlew clean build
, a compilekotlin error is expected - Run
./gradlew clean build
Don't be afraid of the size of the project, I am just too lazy to delete the code, but other projects are disabled.
Gradle IntelliJ Plugin version
1.16.0
Gradle version
8.4
Operating System
macOS
Link to build, i.e. failing GitHub Action job
No response
Instead of build
, use buildPlugin
task.
This also does not work: https://scans.gradle.com/s/mapibsleenhye
I'm using .\gradlew.bat clean buildPlugin throw the error too: coroutines-javaagent.jar not found
idea U 2023.3 plugin 1.17.1(1.61.1 as same)+gradle 8.5
Change the config from org.gradle.configuration-cache = true to org.gradle.configuration-cache = false (in gradle.properties), the problem resolved.
I also noticed a related problem.
Show Gradle console output
Calculating task graph as configuration cache cannot be reused because the file system entry 'build\classes\java\main\classpath.index' has been created.
> Task :plugins:checkKotlinGradlePluginConfigurationErrors
> Task :plugins:generateExternalPluginSpecBuilders UP-TO-DATE
> Task :plugins:extractPrecompiledScriptPluginPlugins UP-TO-DATE
> Task :plugins:compilePluginsBlocks UP-TO-DATE
> Task :plugins:generatePrecompiledScriptPluginAccessors UP-TO-DATE
> Task :plugins:generateScriptPluginAdapters UP-TO-DATE
> Task :plugins:compileKotlin UP-TO-DATE
> Task :plugins:compileJava NO-SOURCE
> Task :plugins:pluginDescriptors UP-TO-DATE
> Task :plugins:processResources UP-TO-DATE
> Task :plugins:classes UP-TO-DATE
> Task :plugins:jar UP-TO-DATE
> Task :initializeIntelliJPlugin SKIPPED
> Task :clean
> Task :processTestResources NO-SOURCE
> Task :patchPluginXml FROM-CACHE
> Task :generateLexer FROM-CACHE
> Task :verifyPluginConfiguration
> Task :processResources
> Task :generateParser FROM-CACHE
> Task :compileJava FROM-CACHE
> Task :classes
> Task :instrumentCode FROM-CACHE
> Task :instrumentedJar FROM-CACHE
> Task :compileTestJava FROM-CACHE
> Task :testClasses UP-TO-DATE
> Task :instrumentTestCode FROM-CACHE
> Task :classpathIndexCleanup
> Task :jar
> Task :prepareTestingSandbox
> Task :test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':test' (type 'Test').
- Type 'org.gradle.api.tasks.testing.Test' property 'jvmArgumentProviders.$0.coroutinesJavaAgentPath' specifies file 'C:\Users\jojo\Entwicklung\nix-idea\build\tmp\initializeIntelliJPlugin\coroutines-javaagent.jar' which doesn't exist.
Reason: An input file was expected to be present but it doesn't exist.
Possible solutions:
1. Make sure the file exists before the task is called.
2. Make sure that the task which produces the file is declared as an input.
For more information, please refer to https://docs.gradle.org/8.6/userguide/validation_problems.html#input_file_does_not_exist in the Gradle documentation.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
As can be seen in the console output, :clean
may be executed after :initializeIntelliJPlugin
. Since :initializeIntelliJPlugin
is creating the coroutines-javaagent.jar
, the file may be missing during later task executions. I guess the problem is that InitializeIntelliJPluginTask
does not declare any output files, but instead stores the output in the directory returned by Task.getTemporaryDir
. Note that the Javadoc of this method explicitly mentions that you should not use the content of the directory outside the specific task:
There are no guarantees that the contents of this directory will be kept beyond the execution of the task.
@hsz Can you consider re-opening this issue?
After declaring the outputs correctly, maybe you could also enable caching for this task to resolve #1554?
Thanks for reporting and investigating, folks!
Fixed with https://github.com/JetBrains/intellij-platform-gradle-plugin/commit/6fb3b24e75a8d28d00c90e9e852dc58201d3373b and scheduled for 2.0.0-beta9