WestCoastProjects
WestCoastProjects

Reputation: 63062

Intellij is applying java level 1.5 even though 1.8 selected in four places

Where is IJ picking up the language level ?? When compiling I am getting the following error:

Error:(29, 38) java: diamond operator is not supported in -source 1.5
  (use -source 7 or higher to enable diamond operator)

Note: the pom.xml has NO mention of the java level.

But from screenshots we see FOUR places I have selected 1.8 !

enter image description here

enter image description here

Upvotes: 2

Views: 167

Answers (3)

Jigar Joshi
Jigar Joshi

Reputation: 240900

place following in your pom.xml

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

IntelliJ respects's maven pom.xml's configuration, by default points to JAVA_HOME and which might not be set properly, So setting compiler version to 1.8 does the job here

Upvotes: 1

E.Egiazarov
E.Egiazarov

Reputation: 931

Please see screen shot attached.one language level settings

Upvotes: 0

mvd
mvd

Reputation: 2720

Try Settings > Modules > {module} > Dependencies > Module SDK.

Upvotes: 0

Related Questions