новичок в Gradle. Прошу прощения, если это плохой вопрос.
Я пытался запустить простой проект Java8 Gradle. Все было замечательно, пока я не попытался добавить Lombok в свой проект.
My Intellij IDE имеет все настройки, необходимые для Lombok.
- Плагин Lombok установлен и активирован
- Процессор аннотаций включен
IDE отлично справляется с аннотациями. Ошибки не отображаются, и шаблон отображается в структуре кода.
Однако, когда я пытаюсь построить проект или запустить метод main с использованием Intellij, компилятор жалуется, что шаблон Lombok должен генерировать не не существует.
Среда
186590cf4989:JokerJava$ gradlew --version
------------------------------------------------------------
Gradle 5.2.1
------------------------------------------------------------
Build time: 2019-02-08 19:00:10 UTC
Revision: f02764e074c32ee8851a4e1877dd1fea8ffb7183
Kotlin DSL: 1.1.3
Kotlin: 1.3.20
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 11.0.5 (Oracle Corporation 11.0.5+10-LTS)
OS: Mac OS X 10.14.6 x86_64
Ниже приведено несколько сообщений об ошибках:
8:23:21 PM: Executing task 'build'...
> Task :generateLombokConfig UP-TO-DATE
> Task :compileJava FAILED
2 actionable tasks: 1 executed, 1 up-to-date
warning: You aren't using a compiler supported by lombok, so lombok will not work and has been disabled.
Your processor is: org.gradle.api.internal.tasks.compile.processing.IncrementalProcessingEnvironment
Lombok supports: sun/apple javac 1.6, ECJ
workspace/tank/JokerJava/src/main/java/tictactoe/game/gui/TicTacToeButton.java:11: error: variable index not initialized in the default constructor
private final int index;
^
workspace/tank/JokerJava/src/main/java/tictactoe/game/TicTacToe.java:42: error: constructor TicTacToeButton in class TicTacToeButton cannot be applied to given types;
buttons[i] = new TicTacToeButton(i);
^
required: no arguments
found: int
reason: actual and formal argument lists differ in length
/workspace/tank/JokerJava/src/main/java/tictactoe/game/TicTacToe.java:70: error: cannot find symbol
int index = buttonClicked.getIndex();
^
symbol: method getIndex()
location: variable buttonClicked of type TicTacToeButton
/workspace/tank/JokerJava/src/main/java/tictactoe/game/TicTacToe.java:86: error: cannot find symbol
update(opponentAction.getPlayer(), opponentAction.getIndex());
^
symbol: method getPlayer()
location: variable opponentAction of type UserAction
/workspace/tank/JokerJava/src/main/java/tictactoe/game/TicTacToe.java:86: error: cannot find symbol
update(opponentAction.getPlayer(), opponentAction.getIndex());
^
symbol: method getIndex()
location: variable opponentAction of type UserAction
Note: /workspace/tank/JokerJava/src/main/java/Client.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
5 errors
1 warning
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
8:23:22 PM: Task execution finished 'build'.
См. ниже мой конфигурационный файл build.gradle
plugins {
id 'java'
id "io.freefair.lombok" version "5.0.0-rc2"
}
group 'org.example'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}