我在测试我的应用程序时遇到了这个问题,mvn测试将无法运行,并且特别在具有Lombok的@Getter @Setter注释的属性上会产生编译问题。IDE中没有突出显示错误,因为Intelij插件可以工作,但是maven不能以某种方式找到Lombok。我见过与我的问题相似的帖子,但所有帖子都有不同版本的maven / lombok / maven-compiler。我的版本是Maven-3.5,Maven编译器-3.7,Lombok 1.16.20。
我的带有龙目岛注释的Java类
@JsonProperty
@Getter @Setter private String name;
@JsonProperty
@Getter @Setter private String catType;
@JsonProperty
@Getter @Setter private String description;
@JsonProperty
@Getter @Setter private String intType;
@JsonProperty
@Getter @Setter private String numberCode;
当我运行mvn install我得到
> [my-path]/my-java.java:[86,29] cannot find symbol
[ERROR] symbol: method numberCode()
[ERROR] location: variable source of type My-java
[my-path]/my-java.java:[86,29] cannot find symbol
[ERROR] symbol: method name()
[ERROR] location: variable source of type My-java
[my-path]/my-java.java:[86,29] cannot find symbol
[ERROR] symbol: method catType()
[ERROR] location: variable source of type My-java
[my-path]/my-java.java:[86,29] cannot find symbol
[ERROR] symbol: method description()
[ERROR] location: variable source of type My-java
这是我的Pom.xml(因为这是一个很长的pom.xml,我只分享了在此问题中可能重要的内容)
<lombok.version>1.18.0</lombok.version>
<maven-clean-plugin.version>2.6.1</maven-clean-plugin.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
<maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>
<maven-enforcer-plugin.version>3.0.0-M1</maven-enforcer-plugin.version>
<maven-resources-plugin.version>3.0.1</maven-resources-plugin.version>
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
<maven.version>3.0.0</maven.version>
<java.version>1.8</java.version>
<scala.version>2.12.1</scala.version>
<node.version>v8.9.4</node.version>
<yarn.version>v1.3.2</yarn.version>
DIEA
小怪兽爱吃肉
相关分类