Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

maven - Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.code.TypeTags when using lombok

I have following dependency in pom.xml:

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.16.8</version>
</dependency>

When I run mvn clean install, I have following error:

Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.code.TypeTags
    at java.lang.ClassLoader.findClass (ClassLoader.java:711)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:566)
    at lombok.launch.ShadowClassLoader.loadClass (ShadowClassLoader.java:418)

I tried to use java 1.8, 1.9, 1.10. And I tried lombok 1.6.10, 1.6.12, 1.6.20. All of them have the same problem.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I am able to solve the problem in my maven project with Java-10 and Lombok 1.18.2.

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.18.2</version>
    <scope>provided</scope>
</dependency>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...