I faced problem during migration our project to Java 9.
After I've updated Java 9, I attempt to run project, I faced with compiler errors :-
Error:(6, 1) java: package javax.annotation is not visible
(package javax.annotation is declared in module java.xml.ws.annotation, which is not in the module graph)
but I found the solution how to resolve it. I added lombok.config
file.
Then after adding module-info.java
file to project compiler is displayed errors again
Error:(10, 26) java: variable title not initialized in the default constructor
Project example:
We have entity Store
:
@AllArgsConstructor
@Getter
public class Story {
private final String title;
}
in root's package I have module-info.java
with content:
module javanine {
requires lombok;
}
and in root's project I have lombok.config file with:
lombok.addJavaxGeneratedAnnotation = false
lombok.anyConstructor.suppressConstructorProperties = true
config.stopBubbling = true
and somewhere in the code I call it :
public static void main(String[] args) {
Story story = new Story("how as");
System.out.println(story.getTitle());
}