vert.xvert.x-webclient

"static interface method invocations are not supported in -source 7" despite using 1.8


This is the complete error message:

"static interface method invocations are not supported in -source 7 (use -source 8 or higher to enable static interface method invocations)"

Here is the class:

public class UserVerticle extends AbstractVerticle {

    @Override
    public void start() {
        Router router=Router.router(vertx);//IDE shows error message here
    }

    @Override
    public void stop() {
    }
}

Here are the project properties: enter image description here

These are my dependencies:

        <groupId>io.vertx</groupId>
        <artifactId>vertx-core</artifactId>
        <version>4.0.0</version>

And:

        <groupId>io.vertx</groupId>
        <artifactId>vertx-web</artifactId>
        <version>3.4.1</version>

Edit:

I changed javaee-web-api version to 8 in pom.xml (It was 7), built with dependencies, and still getting the same error.

Edit2:

I changed vertx-web version to 4.0.0 in pom.xml, built with dependencies, and still getting the same error.


Solution

  • Turns out I should choose source 8 in maven-compiler-plugin, this totally solved the problem:

     <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>