IDEA settings do not saves between plugin runs

Answered

I develop a plugin. Test it in IDEA Ultimate. 

With every plugin run I need select project, confirming Trust folder e.t.c.

I got this window with every run:

Why?

0
4 comments

That happens because your sandbox directory is cleaned up. Do you run the clean task before each run?

0

No.I think I found a problem. 

I remove downloadSources.set(true) from Gradle IntelliJ Plugin Configuration in build.gradle.kts and all works correctly.

 

0

I have a similar problem, but not exactly. If my plugin is re-built, then all manually installed plugins in the sandbox are cleared.

Is there a way to not have other installed plugins cleared?

Sometimes I install other plugins to see if there are any adverse interactions or to test optional dependencies. 

Having to redo it every time my plugin code is built is inconvenient, diplomatically speaking.

0

If anyone else is interested and has not gone to the trouble of doing it, here is a "simple" way:

1. add a copy task to build.gradle (here is a groovy example):

tasks.register("copyBuildRunIdeSandbox", Copy) {
    dependsOn "prepareSandbox"
    from("buildRunIdeSandbox") 
    into("build/idea-sandbox")
}

2. Add a dependency to runIde task in the build file:

tasks {
    ...    
    runIde {
        // make sure to initialize the sandbox with custom settings and plugins before running IDE
        dependsOn "copyBuildRunIdeSandbox"
    }

3. create the buildRunIdeSandbox in your project directory.

4. run your plugin and add all the plugins, settings, config you want in the sandbox

5. from your build/idea-sandbox copy directories/files to the buildRunIdeSandbox for plugins (excluding plugin being built), config and system (excluding the caches and logs) below, the purple shows directories and files not to copy from idea-sandbox:

The copy task will run after prepareSandbox and before runIde, so make sure you do not have the plugin under debugging in your buildRunIdeSandbox/plugins directory. Its an easy mistake to make when copying a lot of files.

I found using a visual directory diff app, either in the IDE or external is an easy way to update the buildRunIdeSandbox if you make changes to the configuration and want to persist it for future runs.

 

0

Please sign in to leave a comment.