1

我开始在我的项目中使用 Lombok,并且在我的本地环境中一切正常(maven compile 正在运行)。当我尝试推送到 openshift(Jboss 安装)时,openshift 中的 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。

4

1 回答 1

0

我遇到了同样的问题。这与 maven compile 插件的旧版本有关。

要修复它,请更改您的插件版本以专门请求 maven compile 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

于 2015-08-28T05:03:34.387 回答