grep
grep

Reputation: 5623

Why maven fails at build and not Eclipse?

I have written this code in Eclipse (JDK 8.0.20) is compilation JDK.

this.invokeMethod( (Set<MyClass<?>>) vari);

private void invokeMethod(Set<MyClass<?>> vari) throws  Exception{
         // TODO
}

In eclipse Everything looks well. But when I build it with maven, I have error:

[ERROR] /Path/Test.java:[52,88] incompatible types: java.util.Set<capture#1 of ? extends x.y.z.MyClass<?>> cannot be converted to java.util.Set<x.y.z.MyClass<?>>

Upvotes: 0

Views: 406

Answers (1)

Stephan
Stephan

Reputation: 43013

You can add those two lines in your pom and check if maven succeeds in compiling:

<properties>
  <maven.compiler.source>1.8</maven.compiler.source>
  <maven.compiler.target>1.8</maven.compiler.target>  
</properties>

Upvotes: 1

Related Questions