esteinberg / plantuml4idea

Intellij IDEA plugin for PlantUML
Apache License 2.0
618 stars 111 forks source link

Develop help wanted #387

Closed ytm157 closed 1 year ago

ytm157 commented 1 year ago

Many intellij plugins built with gradle, it's more fashion and convenient. I cannot run this project correctly after many tries, the developer notes in readme is out of date. It'll be grateful if you can give me some advice.

I'm using version 02530c in master branch, after checking the code and plugin.xml, I'm sure use sdk 2022.3.3 - Windows x64 ZIP Archive (zip) and openjdk17 is no problem. Here's what I had done:

  1. Clone the code from 02530c

  2. Open project in idea (I use 2022.1.4 for development)

  3. Add plugin sdk 2022.3 in project structure image image image

  4. Set project and module sdk to 223.88 and language level to default 17 image image

  5. Using plugin useful-actions to Add Dependant Bundled Plugins to IntelliJ Platform Plugin SDK, then reopen the project. After that I can build it successfully. image

  6. But cannot run. image The full runing command and error tips as followning :

    C:\Users\xx\scoop\apps\openjdk17\17.0.2-8\bin\java.exe -Xmx3024m -Xms256m -ea -Didea.is.internal=true -Djava.system.class.loader=com.intellij.util.lang.PathClassLoader -Didea.config.path=C:\Users\xx\AppData\Local\JetBrains\IntelliJIdea2022.1\plugins-sandbox\config -Didea.system.path=C:\Users\xx\AppData\Local\JetBrains\IntelliJIdea2022.1\plugins-sandbox\system -Didea.plugins.path=C:\Users\xx\AppData\Local\JetBrains\IntelliJIdea2022.1\plugins-sandbox\plugins -Didea.classpath.index.enabled=false -Didea.platform.prefix=Idea "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2022.1.4\lib\idea_rt.jar=54243:C:\Program Files\JetBrains\IntelliJ IDEA 2022.1.4\bin" -Dfile.encoding=GBK -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2022.1.4\lib\idea_rt.jar;C:\Program Files\JetBrains\ideaIC-2022.3.3.win\lib\log4j.jar;C:\Program Files\JetBrains\ideaIC-2022.3.3.win\lib\jdom.jar;C:\Program Files\JetBrains\ideaIC-2022.3.3.win\lib\trove4j.jar;C:\Program Files\JetBrains\ideaIC-2022.3.3.win\lib\openapi.jar;C:\Program Files\JetBrains\ideaIC-2022.3.3.win\lib\util.jar;C:\Program Files\JetBrains\ideaIC-2022.3.3.win\lib\util_rt.jar;C:\Program Files\JetBrains\ideaIC-2022.3.3.win\lib\bootstrap.jar;C:\Program Files\JetBrains\ideaIC-2022.3.3.win\lib\idea_rt.jar;C:\Program Files\JetBrains\ideaIC-2022.3.3.win\lib\idea.jar" com.intellij.idea.Main
    OpenJDK 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = "com.intellij.util.lang.PathClassLoader"). To use archived non-system classes, this property must not be set
    错误: 找不到或无法加载主类 com.intellij.idea.Main
    原因: java.lang.ClassNotFoundException: com.intellij.idea.Main

    It said it can't find main class, but after I decompile the app.jar, I can see Main class is just right there. image

So what's the best practice for running this porject, did I miss anything?

aadrian commented 1 year ago

@ytm157 I tried to automate it https://github.com/esteinberg/plantuml4idea/pull/158 , but the authors refused it :( .

krasa commented 1 year ago

Maybe the problem was that 2022 needs JRE 11 (and 2022.3.3 is broken like 2023) Gradle was broken back then, but now it work fine and the old way does not work for 2023. The project is now switched to Gradle, it should work out of box.

ytm157 commented 1 year ago

After pulling the updated code and building it with Gradle, it works now. Thank you for your quick reaction! ❤

ytm157 commented 1 year ago

Well, there's still a question. How do you develop with the hot swap? I want to change my code under debug mode and not restart the whole project. The JReble seems not to work after I change my code, it just changes nothing, and the plugin does not auto-reload. image

And run 'buidPlugin' while 'runIde' will throw an error "The requested operation cannot be performed on a file with a user-mapped section open". There's a same issue here, which seems a problem with Windows.

krasa commented 1 year ago

This should help: image

ytm157 commented 1 year ago

It works! I found the real output classes that sandbox ide will use is in /out/production/classes rather than build/classes. When build and run using Intellij IDEA, it will compile the source to /out/production/classes, after the code is changed, JReble will compile it and hot swap to /out/production/classes too. However, build with default gradle will only out to "build" directory, I did not figure out where the real production directory locates, so JReble can not find it either. I still don't know how to use the default gradle build to support hot swap, but thanks a lot, it works for now. If I figure it out, I'll share it with you❤