Nicolas Vanhoren created NETBEANS-4833:
------------------------------------------
Summary: Gradle project not triggering Lombok annotation processor
anymore in 12.1
Key: NETBEANS-4833
URL: https://issues.apache.org/jira/browse/NETBEANS-4833
Project: NetBeans
Issue Type: Bug
Affects Versions: 12.1
Environment: Ubuntu 18.04, openjdk 13, Netbeans 12.1, gradle 6.6.1
(installed by Netbeans)
Reporter: Nicolas Vanhoren
h3. Description:
A Gradle project using the Lombok plugin doesn't seem to trigger the annotation
processor anymore in 12.1. It worked with previous version.
h3. How to reproduce:
* In 12.1, create a new "Java Application" project using Gradle.
* Alter the gradle file, {{build.gradle, }}to add a reference to the lombok
gradle plugin:
{code:java}
plugins {
id "io.freefair.lombok" version "5.2.1"
}
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'application'mainClassName = 'gradleproject1.Main'
repositories {
jcenter()
}
dependencies {
testImplementation 'junit:junit:4.13'
}
{code}
* Alter the {{Main.java }}file to make some use of a Lombok annotation:
{code:java}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gradleproject1;
import lombok.Getter;
/**
*
* @author nico
*/
public class Main {
public static class TestClass {
@Getter String testString = "hello";
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
TestClass x = new TestClass();
System.out.println(x.getTestString());
}
}
{code}
Result: The project compiles and executes correctly. Unfortunately Netbeans
identifies this line as an error:
{code:java}
System.out.println(x.getTestString());
{code}
This is due to the Lombok annotation processor not being run before checking
for errors.
By looking at the properties of the project we can see that the lombok jar file
was correctly detected by Netbeans as it can be found in the "Sources > Main >
Annotation Processors" tab. But somehow it doesn't seem to be used by Netbeans
before checking errors.
I do not know any kind of workaround for this problem. For normal Netbeans
projects it is possible to manually enable the annotation processor in the
properties of the project but it is not possible for Gradle projects. This
basically makes Netbeans 12.1 unsuitable to work on projects using both Gradle
and Lombok as far a I know. (If someone find a workaround I would be very glad.)
h3. Expected Behavior:
That Netbeans properly triggers the annotation processor with Gradle projects,
like it seems to do it in versions prior to 12.1.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists