2

From what I've read so far, plugins {} seems to be the way to apply plugins for later Gradle versions where apply plugin: 'name' is the legacy way and we are encouraged to not use it anymore where possible.

However, in my IntelliJ Gradle project, I tried to import Lombok and SpringBoot as below:

plugins {
    id 'java'
    id 'org.springframework.boot' version '2.0.4.RELEASE'
    id 'net.ltgt.apt' version '0.10'
}

dependencies {
    compile 'org.springframework.boot:spring-boot-starter-web'
    compile 'com.github.javadev:underscore:1.35'
    compileOnly 'org.projectlombok:lombok:1.18.2'
    apt "org.projectlombok:lombok:1.18.2"
}

It won't work at all and no packages are added to the External Libraries. So, I had to add the code below in build.gradle for it to work:

apply plugin: 'io.spring.dependency-management'
apply plugin: 'nebula.provided-base'

Is this the right way to go or am I missing something very important?

Sorakthun Ly
  • 732
  • 2
  • 8
  • 15
  • 2
    In one case you apply the spring boot and the apt plugins, and in the second case you apply the dependency management and the provided-base plugins. Why would these different plugins have the same effects? – JB Nizet Aug 05 '18 at 09:26
  • This is my first day getting into Java and I'm reading up on it. There are a lot of unanswered questions. Thanks for replying. Do you mind explaining the difference between plugins and dependencies in Java Gradle and how that compares to a Node project? – Sorakthun Ly Aug 05 '18 at 10:43

0 Answers0