После клонирования JUnit 5 на локальном компьютере ошибка времени компиляции при выполнении задачи "сборки"
Я пытаюсь проверить исходный код JUnit 5. Я клонировал их репозиторий на свой локальный компьютер. В их репозитории говорится, что мне нужен JDK 11 для сборки этого проекта. Но я попытался запустить его с помощью JDK 14. Сообщите мне, работает ли он только на JDK 11. Из корневого каталога проекта я выполнил
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 ответ
На сегодняшний день для запуска установки Gradle JUnit 5 требуется JDK 11. Последние инструкции см. На https://github.com/junit-team/junit5/.
Чтобы собрать JUnit 5 на новых JDK, вам необходимо указать дополнительный путь к JDK, который следует использовать при компиляции исходных файлов - в дополнение к установке JDK 11, запускающей Gradle. Вот суть рабочего процесса "кросс-версии", работающего на JDK 14, 15 и 16:
gradlew -PjavaHome=$ADDITIONAL_JDK build