Reload is required for plugin development.

Answered

The doc below is what i have tried:

https://plugins.jetbrains.com/docs/intellij/ide-development-instance.html#enabling-auto-reload 

But when i run buildPlugin in gradle, execution failed at prepareSandbox: Could not copy file

What i have tried:

1.Enable autoReloadPlugin BY:

2. Disable buildSearchableOptions BY:

 

After code changed, when run buildPlugin, what do i get:

6 comments
Comment actions Permalink

Hi,

1. Your plugin uses Gradle as far as I understand. Why do you set system property for auto-reloading in run configuration? System property is needed only for the DevKit approach. In Gradle projects it is enabled by default from 2020.2, but in case it has to be set manually, it should be done in runIde task in your gradle.build file.

2. What file cannot be copied and why? Are there any details? Did you try to run it with --stacktrace option?

 

 

0
Comment actions Permalink

I run into the same problem on Windows 10. On macOS it runs fine.

The error message says (german): 

Der Vorgang ist bei einer Datei mit einem geöffneten Bereich, der einem Benutzer zugeordnet ist, nicht anwendbar

Which translates to:

The operation is not applicable to a file with an open area assigned to a user

Here is the stack trace. I deleted most of gradle calls to make it short.

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':prepareSandbox'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:188)
    [...]
Caused by: org.gradle.api.internal.file.AbstractFileTreeElement$CopyFileElementException: Could not copy file '<project-root>\build\libs\<project-name>-1.0-SNAPSHOT.jar' to '<project-root>\build\idea-sandbox\plugins\<project-name>\lib\<project-name>-1.0-SNAPSHOT.jar'.
    at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(AbstractFileTreeElement.java:88)
    [...]
    at org.gradle.api.tasks.AbstractCopyTask.copy(AbstractCopyTask.java:148)
    at org.jetbrains.intellij.tasks.PrepareSandboxTask.copy(PrepareSandboxTask.kt:64)
  [...]
Caused by: java.io.FileNotFoundException: <project-root>\build\idea-sandbox\plugins\<project-name>\lib\<project-name>-1.0-SNAPSHOT.jar (Der Vorgang ist bei einer Datei mit einem geöffneten Bereich, der einem Benutzer zugeordnet ist, nicht anwendbar)
    at org.gradle.api.internal.file.AbstractFileTreeElement.copyFile(AbstractFileTreeElement.java:100)
    at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(AbstractFileTreeElement.java:83)
    ... 152 more
0
Comment actions Permalink

Hi, there. Delayed response for a long vacation.

The problem is same as that the post above presented.

1. I run the Plugin build on Windows and haven't tried it on MacOS.

2. After run with --stacktrace, stacktrace shows FileNotFoundException while the error message still in messy.

3. Where to set auto-reloading in gradle? 

0
Comment actions Permalink

Hi Xean,

It may be caused by antivirus. Please exclude the sandbox directory from scanning and see if it solves the problem.

0
Comment actions Permalink

Hi Cesare,

It should be enabled by default for platforms >= 2020.2 according to Enabling Auto-Reload docs.

If your plugin still can't auto-reload, please make sure that all of your extensions registered in the plugin.xml file are dynamic. See Dynamic Plugins for details.

0
Comment actions Permalink

I'm having a similar problem but in my case the plugin jar is locked by the JBR java executable (on windows):

Execution failed for task ':prepareSandbox'.
> Could not copy file 'G:\tph-toolbox\build\libs\tphToolbox-2.11.0.jar' to 'G:\tph-toolbox\build\idea-sandbox\plugins\TPH Toolbox\lib\tphToolbox-2.11.0.jar'.
   > G:\tph-toolbox\build\idea-sandbox\plugins\TPH Toolbox\lib\tphToolbox-2.11.0.jar (The requested operation cannot be performed on a file with a user-mapped section open)

 

Is this perhaps something that doesn't work on windows?

0

Please sign in to leave a comment.