与lombok问题的Openshift

时间:2015-07-02 05:33:10

标签: java maven openshift lombok

我使用openshift模板创建了一个带有wildfly 8的新应用程序,一切正常。

添加lombok:1.16.4库后,服务器中的maven无法编译,在我的本地机器上运行正常。

当我在openshift机器中运行mvn -e -Popenshift -DskipTests -X compile时,它会说:

[DEBUG] Command line options:
[DEBUG] -d
/var/lib/openshift/ID/app-root/runtime/repo/target/classes
-classpath
/var/lib/openshift/ID/app-root/runtime/repo/target/classes:/var/lib/openshift/ID/.m2/repository/javax/javaee-api/7.0/javaee-api-7.0.jar:/var/lib/openshift/ID/.m2/repository/com/sun/mail/javax.mail/1.5.0/javax.mail-1.5.0.jar:/var/lib/openshift/ID/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar:/var/lib/openshift/ID/.m2/repository/org/projectlombok/lombok/1.16.4/lombok-1.16.4.jar:/var/lib/openshift/ID/.m2/repository/org/torpedoquery/org.torpedoquery/1.7.0/org.torpedoquery-1.7.0.jar:/var/lib/openshift/ID/.m2/repository/org/javassist/javassist/3.18.0-GA/javassist-3.18.0-GA.jar:/var/lib/openshift/ID/.m2/repository/org/eclipse/persistence/javax.persistence/2.0.0/javax.persistence-2.0.0.jar:/var/lib/openshift/ID/.m2/repository/org/objenesis/objenesis/1.3/objenesis-1.3.jar:/var/lib/openshift/ID/.m2/repository/com/google/guava/guava/11.0.2/guava-11.0.2.jar:/var/lib/openshift/ID/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar:/var/lib/openshift/ID/.m2/repository/org/apache/commons/commons-lang3/3.0/commons-lang3-3.0.jar:
-sourcepath
/var/lib/openshift/ID/app-root/runtime/repo/src/main/java:
ALL_MY_CLASSES
-s /var/lib/openshift/ID/app-root/runtime/repo/target/generated-sources/annotations
-g -nowarn -target 1.8 -source 1.8 -encoding UTF-8

编译错误,问题是,当我运行时

javac $ALL_ARGUMENTS_FROM_MAVEN_DEBUG_INFO (from the -d) 

它工作正常,并且javac手动编译mvn compile报告没有问题(直到执行clean或文件被更改)。

我检查环境中的变量,我没有看到任何错误,这是差异:

  • mvn:local(3.2.3)remote(3.0.4)
  • os:local(amd64)remote(i386)
  • os.version:local(3.16)remote(2.6)
  • 都使用OpenJDK
  • aether:local(org.eclipse.aether)remote(org.sonatype.aether)

另外,如果我在运行lombok命令时删除类路径中的javac部分,我会从maven获得相同的错误。

使用openshift 忽略 lombok制作maven的环境有什么区别?

Here是两个编译的链接(带有调试输出)

1 个答案:

答案 0 :(得分:1)

问题与maven-compiler-plugin有关,最新版本无处不在,将其添加到pom:

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <compilerVersion>1.8</compilerVersion>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

openshift中默认配置中的插件版本太旧(2.3)并且与lombok不兼容。