Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Java 14的IntelliJ 2020.1中的“记录”预览功能在Maven“install”期间因编译器错误而失败,但在其他情况下运行_Java_Maven_Intellij Idea_Java Record - Fatal编程技术网

使用Java 14的IntelliJ 2020.1中的“记录”预览功能在Maven“install”期间因编译器错误而失败,但在其他情况下运行

使用Java 14的IntelliJ 2020.1中的“记录”预览功能在Maven“install”期间因编译器错误而失败,但在其他情况下运行,java,maven,intellij-idea,java-record,Java,Maven,Intellij Idea,Java Record,我试图在2020.1.1 RC中使用Java中的功能 我定义了这样一个类: package work.basil.example; import java.time.LocalTime; public record LocalTimeRange(LocalTime start , LocalTime stop) { } 当我使用这个LocalTimeRange类在另一个类中运行main方法时,没有问题 在执行Maven安装时,会出现以下错误: 错误:6,8 java:记录是预览功能,默认情

我试图在2020.1.1 RC中使用Java中的功能

我定义了这样一个类:

package work.basil.example;

import java.time.LocalTime;

public record LocalTimeRange(LocalTime start , LocalTime stop)
{
}
当我使用这个LocalTimeRange类在另一个类中运行main方法时,没有问题

在执行Maven安装时,会出现以下错误:

错误:6,8 java:记录是预览功能,默认情况下被禁用

➥ 如何帮助Maven完成安装操作

我用的是1.4版。然后,我编辑POM以使用其各种依赖项的所有最新版本

我有项目结构设置:

项目设置>项目>项目SDK>14

项目设置>项目>项目语言级别>14预览-记录、模式、文本块

项目设置>模块>项目语言级别>14预览-记录、模式、文本块

我有偏好设置:

构建、执行、部署>编译器>Java编译器>每个模块字节码版本>目标字节码版本>14

运行此Java: openjdk 14.0.1 2020-04-14 OpenJDK运行时环境采用OpenJDK build 14.0.1+7 OpenJDK 64位服务器VM采用OpenJDK build 14.0.1+7,混合模式,共享

使用:

IntelliJ IDEA 2020.1.1最终版

建造IU-201.7223.58,于2020年4月26日建造

订阅有效期至2020年8月28日

运行时版本:11.0.6+8-b765.40 x86_64

VM:JetBrains s.r.o提供的OpenJDK 64位服务器VM macOS 10.14.6

GC:ParNew、ConcurrentMarkSweep

内存:2200米

核心:6


非捆绑插件:com.github.leomillon.uuidgenerator

这似乎是IntelliJ 2020.1.1 RC build 201前后出现的新问题或bug。2020.1.1最终版本中的行为相同

见票号IDEA-237538

解决方法:添加元素 要使Maven clean&install成功完成,请向两个POM元素添加元素,以标记启用预览

更改此项:

            <plugin>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>3.8.1</version>
            </plugin>

            <plugin>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>3.0.0-M4</version>
            </plugin>
……为此:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <release>14</release>
                    <compilerArgs>
                        <arg>--enable-preview</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M4</version>
                <configuration>
                    <argLine>--enable-preview</argLine>
                </configuration>
            </plugin>

这似乎是IntelliJ 2020.1.1 RC build 201出现的新问题或bug。2020.1.1最终版本中的行为相同

见票号IDEA-237538

解决方法:添加元素 要使Maven clean&install成功完成,请向两个POM元素添加元素,以标记启用预览

更改此项:

            <plugin>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>3.8.1</version>
            </plugin>

            <plugin>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>3.0.0-M4</version>
            </plugin>
……为此:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <release>14</release>
                    <compilerArgs>
                        <arg>--enable-preview</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M4</version>
                <configuration>
                    <argLine>--enable-preview</argLine>
                </configuration>
            </plugin>

“你有办法吗?”埃利奥特弗里希那张票上的虫子似乎是我的问题。我在那页上加了一条评论,记录了我的详细情况。谢谢你提供这个链接。我现在还不打算升级。希望他们能解决问题。@ElliottFrisch奇怪的是,我的代码运行正常。我可以实例化我的记录类,并调用它的方法。只有Maven安装才会抛出此错误。因此,对于一个只玩唱片的简单小应用程序来说,这个bug不会咬人。只有需要安装Maven的复杂应用程序才有问题。@ElliottFrisch如果你对你的评论做出回答,我会接受。你有什么办法吗?@ElliottFrisch那张罚单上的错误似乎是我的问题。我在那页上加了一条评论,记录了我的详细情况。谢谢你提供这个链接。我现在还不打算升级。希望他们能解决问题。@ElliottFrisch奇怪的是,我的代码运行正常。我可以实例化我的记录类,并调用它的方法。只有Maven安装才会抛出此错误。因此,对于一个只玩唱片的简单小应用程序来说,这个bug不会咬人。只有对于需要Maven安装的复杂应用程序才有问题。@ElliottFrisch如果您对您的评论作出答复,我将接受它。基于编辑,相关基于编辑,相关基于编辑