我正在尝试检查JUnit5的源代码。我在本地机器上克隆了他们的存储库。他们的存储库说我需要JDK11来构建这个项目。但我试着用JDK14运行它。如果它只在JDK11上运行,请告诉我。在projects根目录中,我执行了
gradlew clean assemble
这里gradle抛出了一个编译时错误
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:110: error: annotation @Category is missing a default value for the element 'value'
@Category("JUnit")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:111: error: annotation @Label is missing a default value for the element 'value'
@Label("Test Plan")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:112: error: annotation @Name is missing a default value for the element 'value'
@Name("org.junit.TestPlan")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:157: error: annotation @Label is missing a default value for the element 'value'
@Label("Test")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:158: error: annotation @Name is missing a default value for the element 'value'
@Name("org.junit.TestExecution")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:129: error: annotation @Category is missing a default value for the element 'value'
@Category("JUnit")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:160: error: annotation @Label is missing a default value for the element 'value'
@Label("Result")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:162: error: annotation @Label is missing a default value for the element 'value'
@Label("Exception Class")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:164: error: annotation @Label is missing a default value for the element 'value'
@Label("Exception Message")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:133: error: annotation @Label is missing a default value for the element 'value'
@Label("Unique Id")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:135: error: annotation @Label is missing a default value for the element 'value'
@Label("Display Name")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:137: error: annotation @Label is missing a default value for the element 'value'
@Label("Tags")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:139: error: annotation @Label is missing a default value for the element 'value'
@Label("Type")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:115: error: annotation @Label is missing a default value for the element 'value'
@Label("Contains Tests")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:117: error: annotation @Label is missing a default value for the element 'value'
@Label("Engine Names")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:123: error: annotation @Name is missing a default value for the element 'value'
@Name("org.junit.UniqueId")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:150: error: annotation @Label is missing a default value for the element 'value'
@Label("Skipped Test")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:151: error: annotation @Name is missing a default value for the element 'value'
@Name("org.junit.SkippedTest")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:153: error: annotation @Label is missing a default value for the element 'value'
@Label("Reason")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:168: error: annotation @Category is missing a default value for the element 'value'
@Category("JUnit")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:169: error: annotation @Label is missing a default value for the element 'value'
@Label("Report Entry")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:170: error: annotation @Name is missing a default value for the element 'value'
@Name("org.junit.ReportEntry")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:174: error: annotation @Label is missing a default value for the element 'value'
@Label("Unique Id")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:176: error: annotation @Label is missing a default value for the element 'value'
@Label("Key")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:178: error: annotation @Label is missing a default value for the element 'value'
@Label("Value")
^
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:60: error: reference to begin is ambiguous
event.begin();
^
both method begin() in Event and method begin() in Event match
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:66: error: reference to commit is ambiguous
event.commit();
^
both method commit() in Event and method commit() in Event match
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:74: error: reference to commit is ambiguous
event.commit();
^
both method commit() in Event and method commit() in Event match
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:82: error: reference to begin is ambiguous
event.begin();
^
both method begin() in Event and method begin() in Event match
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:92: error: reference to end is ambiguous
event.end();
^
both method end() in Event and method end() in Event match
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:96: error: reference to commit is ambiguous
event.commit();
^
both method commit() in Event and method commit() in Event match
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:106: error: reference to commit is ambiguous
event.commit();
^
both method commit() in Event and method commit() in Event match
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:114: error: reference to Event is ambiguous
static class TestPlanExecutionEvent extends Event {
^
both constructor Event() in Event and constructor Event() in Event match
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:131: error: reference to Event is ambiguous
abstract static class TestEvent extends Event {
^
both constructor Event() in Event and constructor Event() in Event match
{my root directory}\junit-platform-jfr\src\main\java\org\junit\platform\jfr\FlightRecordingListener.java:172: error: reference to Event is ambiguous
static class ReportEntryEvent extends Event {
^
both constructor Event() in Event and constructor Event() in Event match
35 errors
我需要一些帮助来解决这个问题,这样我才能成功地建立这个项目。
我的系统信息
操作系统:windows 10
jdk版本:jdk-14.0.2
gradle版本:gradle 6.5.1
1条答案
按热度按时间wvt8vs2t1#
到今天为止,jdk11是运行junit5的gradle安装所必需的。参考https://github.com/junit-team/junit5/#building-从源代码获取最新指令。
为了在较新的jdk上构建JUnit5,除了运行gradle的JDK11安装之外,还需要指定编译源文件时应该使用的jdk的附加路径。以下是在JDK14、15和16上运行的“跨版本”工作流的要点: