org4idea icon indicating copy to clipboard operation
org4idea copied to clipboard

Cannot install this plugin on latest clion

Open ghost opened this issue 4 years ago • 11 comments

I'm unable to install this plugin on latest clion: https://youtrack.jetbrains.com/issue/CPP-26061

This issue appears only for org4idea plugin.

ghost avatar Aug 03 '21 16:08 ghost

got the same, in logs i've found 2021-08-07 10:56:44,772 [ 32697] INFO - lij.ide.plugins.DynamicPlugins - Plugin Org4Idea is not unload-safe because of extension to non-dynamic EP com.intellij.fileTypeFactory

freeseacher avatar Aug 07 '21 09:08 freeseacher

Same in latest PyCharm 2021.2.3 CE. With same error in logs. Any workaround?

mrkeuz avatar Oct 24 '21 22:10 mrkeuz

you can try this #11 . Run ./gradlew buildPlugin in env JAVA_HOME to java11 version.

Or, you can use https://github.com/huhuang03/org4idea/releases/tag/for_java11 the release I build on my pc.

and install plugin as a zip.

huhuang03 avatar Oct 25 '21 16:10 huhuang03

@huhuang03 hi, thanks for your work, installed from https://github.com/huhuang03/org4idea/releases/tag/for_java11

But have several issues during build from sources:

  1. It needs chmod +x gradlew (this need commit for convenient use)

  2. After, chmod, If I do ./gradlew:

    $   ./gradlew 
    Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
    

    Seems gradlew wrapper not properly configured. You need add org4idea/gradle/wrapper/gradle-wrapper.jar to repository. gradlew uses this jar if gradle not installed in system.

  3. But even I use installed correct version gradle and java in system I cannot build plugin. I got:

    $  gradle buildPlugin                                         
    
    To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.2/userguide/gradle_daemon.html#sec:disabling_the_daemon.
    Daemon will be stopped at the end of the build 
    
    FAILURE: Build failed with an exception.
    
    * Where:
    Build file './org4idea/build.gradle' line: 8
    
    * What went wrong:
    Plugin [id: 'org.jetbrains.intellij', version: '1.2.0'] was not found in any of the following sources:
    
    - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
    - Plugin Repositories (could not resolve plugin artifact 'org.jetbrains.intellij:org.jetbrains.intellij.gradle.plugin:1.2.0')
      Searched in the following repositories:
        Gradle Central Plugin Repository
    
    * 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
    
    BUILD FAILED in 4s
    

    When I added gradle/wrapper/gradle-wrapper.jar file the build start successfully

  4. Another issue, plugin cannot build without jetbrains_token property. It would be good to replace: token = 'jetbrains_token' ?: "" (build.gradle:27) to token = project.findProperty('jetbrains_token') ?: "" for ability build plugin without set any extra variables.

In finally I was able to build the plugin by himself successfully. Hope this help improve you PR. I will help to test changes if you provide some fixes.

Anyway thanks for help, I've installed plugin from zip archive. Seem works as expected.

mrkeuz avatar Nov 01 '21 05:11 mrkeuz

I'm also looking at the PR, the above should indeed work but I'm looking at a different angle: rather than manually adding the wrapper JAR I'd leave the task to gradle itself. Here's what works:

  • set an environment variable to ORG_GRADLE_PROJECT_jetbrains_token to anything, empty string should suffice
  • run gradle wrapper to both update the wrapper as well as downloading the required supporting files

After doing that, ./gradlew buildPlugin should build successfully

skuro avatar Nov 01 '21 09:11 skuro

Yes, it works as you described, but in any case, ./gradlew script especially intended to run gradle-wrapper.jar downloader for gradle on machines where gradle not installed at all. So strictly speaking ./gradlew in repo without gradle-wrapper.jar does not make sense at all (as it describe in tutorial).

Last argument is it's great to have a repeatable build on any machine regardless of the environment. I would also add JVM version check as I got an unobvious error when trying to build a project on JVM 8.

The decision is always yours. But it's always great when a project is being built by one command. With no additional steps required. I'm NOT writing for criticism - just want to improve the build process a little.

mrkeuz avatar Nov 01 '21 10:11 mrkeuz

it's all appreciated, thanks. I'm a bit far away from gradle / java these days so it's all very welcome input

skuro avatar Nov 01 '21 10:11 skuro

@mrkeuz . Thanks for your guide, I have update the PR.

But the java toolchain seems not work

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(11)
    }
}

Still get the error:

              - Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8

huhuang03 avatar Nov 02 '21 01:11 huhuang03

@huhuang03 great, thanks for changes! I also finally way to check java version. I've sent changes to you java11 branch (#1)

UPD: Nope, hurried, not working yet. Will try to fix.

mrkeuz avatar Nov 02 '21 19:11 mrkeuz

@huhuang03 found the trick for check java version (see #2)

mrkeuz avatar Nov 02 '21 20:11 mrkeuz

@mrkeuz Thank you. I have merged.

huhuang03 avatar Nov 03 '21 02:11 huhuang03