我在项目中开始使用Lombok,并且在我的本地环境中运行良好(maven编译工作正常)。当我尝试使用openshift(Jboss安装)时,openhift中的maven编译失败并出现错误:
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ german-school ---
[INFO] Compiling 13 source files to /var/lib/openshift/5290ebf4500446c6e20000b8/app-root/runtime/repo/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /var/lib/openshift/5290ebf4500446c6e20000b8/app-root/runtime/repo/src/main/java/gr/alx/german/model/Word.java:[95,26] error: cannot find symbol
[ERROR] class Word /var/lib/openshift/5290ebf4500446c6e20000b8/app-root/runtime/repo/src/main/java/gr/alx/german/model/Word.java:[102,18] error: cannot find symbol
[ERROR] variable shuffledWord of type Word /var/lib/openshift/5290ebf4500446c6e20000b8/app-root/runtime/repo/src/main/java/gr/alx/german/model/Word.java:[114,19] error: cannot find symbol
[ERROR] variable shuffledWord of type Word /var/lib/openshift/5290ebf4500446c6e20000b8/app-root/runtime/repo/src/main/java/gr/alx/german/controller/AdminController.java:[70,18] error: cannot find symbol
[ERROR] class Word
...
...
...
...
[INFO] 33 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
为了清晰起见,我没有显示每个错误。 “Word”类是一个用Lombok注释注释的类。 Maven似乎根本找不到课程。
我应该注意到我使用的是java 7。
答案 0 :(得分:0)
我遇到了同样的问题。这与maven编译插件的旧版本有关。
要修复它,请将插件版本更改为专门请求maven编译2.5.1(或更高版本)
这是我的maven pom.xml的重要部分
<profiles>
<profile>
<!-- When built in OpenShift the 'openshift' profile will be used when invoking mvn. -->
<!-- Use this profile for any OpenShift specific customization your app will need. -->
<!-- By default that is to put the resulting archive into the 'deployments' folder. -->
<!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
<id>openshift</id>
<build>
<finalName>myname</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<outputDirectory>deployments</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
</plugin>
</plugins>
</build>
</profile>
</profiles>
注意: maven-compiler-plugin - 版本2.5.1