1

私は自分のプロジェクトで Lombok を使い始めましたが、すべてがローカル環境でうまく機能しています (maven コンパイルが機能しています)。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 コンパイル プラグインの古いバージョンと関係がありました。

これを修正するには、プラグインのバージョンを変更して、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 に答える