Intellij Idea 13 UI Designer and automatic Gradle building

后端 未结 4 826
耶瑟儿~
耶瑟儿~ 2020-11-30 10:40

I\'ve used the Intellij UI Designer to create forms for a project. Everything works fine when I\'m building with idea as it handles compiling the forms for me, but as we rec

相关标签:
4条回答
  • 2020-11-30 10:51

    Idea 2019.2

    It seems like IntelliJ changed the settings UI when updating from 2019.1 to 2019.2, as the menu entry mentioned by Tom isn't there anymore.
    I got it fixed by setting Build and run using: to IntelliJ Idea. I also changed Run tests using: to IntelliJ Idea to avoid problems while testing.
    Both settings are located under File | Settings | Build, Execution, Deployment | Build Tools | Gradle.

    0 讨论(0)
  • 2020-11-30 10:55

    So I made this a lot more complicated than needs be.

    To make it work you need to change two things in your project.

    A setting in IDEA 13.1.5

    Settings -> GUI Designer -> Generate GUI into: Java source code

    This makes IntelliJ IDEA add 3 methods into the bottom of your forms:

    • $$$setupUI$$$()
    • $$$setupUI$$$()
    • $$$getRootComponent$$$()

    If they are missing try recompiling your project after you change the setting.

    Add the missing classes

    Intellij has a jar called forms_rt.jar, and I found mine in {IntelliJ IDEA Root}\lib. And renamed it to "forms_rt-13.1.1.jar"

    This needs to be included during compile time to your project. If you are using Gradle as I did you could copy it to {project root}/lib and add a flatfile repository like so:

    repositories {
        mavenCentral()
        flatDir dirs: "${rootDir}/lib"
    }
    

    After that you need to include it in your project gradle file:

    dependencies {
        compile name: 'forms_rt', version: '13.1.1'
    }
    

    After that it should be possible to build it both in IntelliJ IDEA and Gradle.

    0 讨论(0)
  • 2020-11-30 11:09

    The forms_rt library is in mavenCentral. http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22forms_rt%22

    Once you have configured IntelliJ to update the SourceCode it is sufficient to just add the library to the dependencies in your build.gradle.

    dependencies {
        compile 'com.intellij:forms_rt:7.0.3'
    }
    
    0 讨论(0)
  • 2020-11-30 11:16

    IntelliJ IDEA 2019.1

    I found this issue still exists. It's at least somehow documented now:

    If your build actions are delegated to Gradle, GUI Designer will not generate Java source code.

    So by disabling the according setting

    Build, Execution, Deployment | Build Tools | Gradle | Runner | Delegate IDE build/run actions to gradle

    I was able to build and run the project successfully. Note that I didn't need any other settings or additional libraries from the answers above. I let Generate GUI into be set to Binary class files.

    0 讨论(0)
提交回复
热议问题