[JAVA] I can't install lombok with Gradle.

Event

I added the following two lines to Gradle and ran Gradle, but I got an error.

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    testCompile('org.springframework.boot:spring-boot-starter-test')
    testCompile('com.jayway.jsonpath:json-path')
    compileOnly 'org.projectlombok:lombok:1.18.6' <--add to
    annotationProcessor 'org.projectlombok:lombok:1.18.6' <--add to
}

Error 1

Warning:<i><b>root project 'complete': Unable to resolve additional project configuration.</b>
Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':runtimeClasspath'.
Caused by: org.gradle.internal.resolve.ArtifactResolveException: Could not download spring-boot-starter-web.jar (org.springframework.boot:spring-boot-starter-web:2.1.3.RELEASE): No cached version available for offline mode</i>

Countermeasure 1

I don't know which measure I heard, but I did it from top to bottom and finally succeeded.

  1. Check Enable annotation processing. Intellij IDEA -> Preferences -> Compiler -> Annotation Processors スクリーンショット 2019-04-05 17.46.29.png

  2. Check Enable annotation processing. File -> Other Settings -> Default Settings -> Compiler -> Annotation Processors スクリーンショット 2019-04-08 11.02.20.png スクリーンショット 2019-04-08 11.02.56.png

  3. Install the Lombok plugin Intellij IDEA -> Preferences -> Plugins ->Browse Repositories-> Search for "Lombok"-> install plugin -> Apply and restart IDEA スクリーンショット 2019-04-08 11.04.35.png

  4. Check Work offline. Intellij IDEA -> Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle スクリーンショット 2019-04-05 17.44.53.png

Error 2

After the above measures, when I executed the build, the following error occurred.

スクリーンショット 2019-04-08 10.55.32.png

Countermeasure 2

The following has been added to pom.xml. Reference: https://tyoshikawa1106.hatenablog.com/entry/2015/11/15/220056


    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path</artifactId>
            <scope>test</scope>
        </dependency>
        <!--from here-->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.6</version>
            <scope>provided</scope>
        </dependency>
        <!--Add up to here-->
    </dependencies>

The build passed successfully.

Recommended Posts

I can't install lombok with Gradle.
Install Gradle with ubuntu16.04
Lombok not working with Gradle5
I tried using JOOQ with Gradle
I can't install rails on my mac
JUnit 5 gradle test fails with lombok annotation
I couldn't install docker with raspberry pi2 b +.
I wanted to gradle spring boot with multi-project
I can't do docker-compose up -d with docker
I tried Getting Started with Gradle on Heroku
Install gradle on mac
Use ProGuard with Gradle
Install Ruby 3.0.0 with asdf
Lombok with VS Code
Integration Test with Gradle
Install Java with Ansible
Install OpenJDK8 with RPM
[Ruby] I can't install puma on Mac [Rails, etc.]
Install lombok on SpringToolSuite4
DataNucleus starting with Gradle
[Note] I suddenly can't build with Docker for windows.
I played with Refinements
I struggled with pip install on an M1 Mac
How to install Gradle and Kotlin with SDKMAN (Mac)
Use WebJars with Gradle
Get started with Gradle
Use jlink with gradle
Install Composer with Docker
I changed the Ruby version and now I can't bundle install
I made a plugin to execute jextract with Gradle task
Java multi-project creation with Gradle
Clogged with Express npm install
Gradle + Kotlin-Generate jar with DSL
Install Java 7 with Homebrew (cask)
I played loosely with Jshell
I tried DI with Ruby
Install Oracle JDK 8 with Ansible
Remote debugging with Gradle test
I tried UPSERT with PostgreSQL.
Reduce verbose code with Lombok
I tried BIND with Docker
Use log4j2 with YAML + Gradle
Hello World with SpringBoot / Gradle
I can't create a Java class with a specific name in IntelliJ
I can't edit user information with devise! ~ Update_resource Let's see here ~
I want to operate cron with GUI, so I will install Dkron
I want to add devise in Rails, but I can't bundle install