I have a maven build error


#1

I have a maven build error due to error in OG-Util package.

I am running Java jdk1.8.0_11 on Mac OSX Mavericks.
Error is due to Map2.remove() method.
Below is the error snippet.

Thanks,

[INFO] OG-Platform … SUCCESS [2.146s]
[INFO] OG-Platform-Public … SUCCESS [0.025s]
[INFO] OG-TimeSeries … SUCCESS [4.796s]
[INFO] OG-Util … FAILURE [7.086s]

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project og-util: Compilation failure: Compilation failure:
[ERROR] /Users/sdcho/Views/sdc_priv/OpenGamma/OG-Platform/projects/OG-Util/src/main/java/com/opengamma/util/map/HashMap2.java:[26,7] error: types Map<Pair<K1,K2>,V> and Map2<K1,K2,V> are incompatible; both define remove(K1,K2), but with unrelated return types
[ERROR] /Users/sdcho/Views/sdc_priv/OpenGamma/OG-Platform/projects/OG-Util/src/main/java/com/opengamma/util/map/HashMap2.java:[164,11] error: name clash: remove(K1,K2) in HashMap2 and remove(Object,Object) in Map have the same erasure, yet neither overrides the other
[ERROR] /Users/sdcho/Views/sdc_priv/OpenGamma/OG-Platform/projects/OG-Util/src/main/java/com/opengamma/util/map/Map2.java:[58,4] error: name clash: remove(K1,K2) in Map2 and remove(Object,Object) in Map have the same erasure, yet neither overrides the other
[ERROR] /Users/sdcho/Views/sdc_priv/OpenGamma/OG-Platform/projects/OG-Util/src/main/java/com/opengamma/util/map/WeakValueHashMap2.java:[19,7] error: types Map<Pair<K1,K2>,V> and HashMap2<K1,K2,V> are incompatible; both define remove(K1,K2), but with unrelated return types
[ERROR] /Users/sdcho/Views/sdc_priv/OpenGamma/OG-Platform/projects/OG-Util/src/main/java/com/opengamma/util/map/SoftValueHashMap2.java:[18,7] error: types Map<Pair<K1,K2>,V> and HashMap2<K1,K2,V> are incompatible; both define remove(K1,K2), but with unrelated return types


#2

The itHub master branch (v2.1) is not compatible with Java SE 8. You will need to use Java SE 7 to compile that branch.


#3

I tried with jdk1.7.0_65.jdk but the same result as before.


#4

Be aware that you may need to set the JAVA_HOME environment variable to force Java 7. Run mvn – version to see what maven is up to.


#5

By setting JAVA_HOME to jdk 1.7 resolves the problem.

My setting was

JAVA_HOME=jdk 1.8
IntelliJ started up with jdk 1.8
To compile using jdk 1.7
Using mvn inside IntelliJ using jdk 1.7

But somehow IntelliJ does not resolve the java version properly.

Thanks.