Lambda expressions and Java 1.8 in IdeaUIDesigner

安稳与你 提交于 2019-12-30 03:09:12

问题


I'm trying to use Java 1.8 with lambda expressions with Idea UI Designer, I have in maven:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>ideauidesigner-maven-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>javac2</goal>
            </goals>
        </execution>
    </executions>

    <configuration>
        <fork>true</fork>
        <debug>true</debug>
        <failOnError>true</failOnError>
    </configuration>
</plugin>

and dependency

<dependency>
    <groupId>com.intellij</groupId>
    <artifactId>forms_rt</artifactId>
    <version>7.0.3</version>
</dependency>

When I try to use lambdas it returns compile error:

Failed to execute goal org.codehaus.mojo:ideauidesigner-maven-plugin:1.0-beta-1:javac2 (default) on project stockbox-chart: Execution default of goal org.codehaus.mojo:ideauidesigner-maven-plugin:1.0-beta-1:javac2 failed: 52264 -> [Help 1]

Do you have any ideas how to use lambdas with Idea UI Designer?


回答1:


One workaround, until such time as someone is able to fix the plugin, is to configure your IntelliJ settings to generate the GUI as source rather than as binaries, then manually re-generate the GUI sources prior to running Maven any time you make a change in GUI designer:

  1. Go to File > Settings and change the selection for Editor > GUI Designer > Generate GUI into: to Java source code.
  2. Whenever you make a GUI change, build the project from IntelliJ to (re-)generate the GUI Java source code (Build >> Build Project).
  3. Optionally, check the generated source into whatever source-control mechanism you're using; this step saves anyone else building your project via Maven from having to do the manual build from IntelliJ later (i.e. so they can build solely via Maven).
  4. If you're using an IntelliJ layout manager (like GridLayoutManager), add com.intellij:forms_rt:7.0.3 as a compile dependency in your pom.xml, if it isn't already there.
  5. Run Maven as usual to build your project.


来源:https://stackoverflow.com/questions/32135018/lambda-expressions-and-java-1-8-in-ideauidesigner

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!