Search code examples
mavenmaven-3

mvn install fails due to "incompatible types"


I'm getting the following error from "mvn clean install"

[ERROR] /private/tmp/framework/src/main/java/org/jboss/narayana/txframework/api/annotation/transaction/WSBA.java:[21,65] incompatible types found : org.jboss.narayana.txframework.api.configuration.transaction.CompletionType required: org.jboss.narayana.txframework.api.configuration.transaction.CompletionType [ERROR] /private/tmp/framework/src/main/java/org/jboss/narayana/txframework/api/annotation/service/ServiceRequest.java:[32,56] incompatible types found : org.jboss.narayana.txframework.api.configuration.service.RequestType required: org.jboss.narayana.txframework.api.configuration.service.RequestType [INFO] 2 errors

I'm assuming this is a dependency issue and there is another instance of CompletionType in the build path somewhere. I've checked this is not the case and also tried with an empty ~/.m2/repository.

I've tried renaming the package of the offending packages and this does not fix the problem. I simply get the same error with the new package name on both lines.

My dependencies in the pom.xml shouldn't be including a lib that has these classes in.

I've tried to reproduce this on another developer's computer and the problem does not occur.

I am seeing this problem on two of my computers. These computers have a lot of their environment synced, so it doesn't surprise me that the problem is also being synced. However on my office computer I can do a successful "mvn install" within Intellij, but not on the command line. On my home computer I get this problem, both on the command line and within IntelliJ.

I've tried Googleing for this issue, but once I remove text specific to my project from the build, I don't have anything specific enough to search on.

The pom.xml can be found here:

http://anonsvn.jboss.org/repos/labs/labs/jbosstm/trunk/txframework/framework/pom.xml

Yes, I am aware that this is a JBoss package, in which the problem occurs. I work for JBoss and this is my code, so I can't get them to fix it ;-)

Thanks.


Solution

  • This is caused by a bug in the annotation processing of the compiler in this version of the Oracle JDK:

    java version "1.6.0_27" Java(TM) SE Runtime Environment (build 1.6.0_27-b07) Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)

    It also occurs in the equivalent mac version, which at the time of posting is the latest release.

    I fixed the problem by switching to this release of OpenJDK:

    java version "1.6.0_22" OpenJDK Runtime Environment (IcedTea6 1.10.4) (fedora-60.1.10.4.fc15-x86_64) OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

    There are workarounds if you can't switch JDK (for example if you have a mac).

    More details can be found on the bug report, that I am using to track this issue:

    https://issues.jboss.org/browse/JBTM-997