1

Good evening! My question is odd but I could not run an existing maven project.

There is an error which IDE returns: and I have a bunch of them. I am using Intellij IDEA. Even if I run just simple mvn install I have the same issue. I googled but there is no positive result.

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

2 Answers2

1

IntelliJ requires you to add some properties to your pom.xml file

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

Also, check your selected SDK:

enter image description here

and the language level in your module settings:

enter image description here

Michael W
  • 3,515
  • 8
  • 39
  • 62
  • Thank you for the answer but I still have the same error. I would like to add some screenshots but I cant. I have the same settings as yours; java 1.8 and Language level - 8. – Kirill Barsukov Jun 08 '19 at 23:17
  • I tried to run mvn clean install but I get more than 10 errors like that:[ERROR] /Users/kirillbarsukov/Desktop/Project/src/main/java/com/project/viewer2/View6DAO.java:[218,55] cannot find symbol – Kirill Barsukov Jun 08 '19 at 23:21
  • I have no idea how it is possible because I downloaded that project from company's SVN repository. It means 100% that there is nothing missing and an issue is somewhere in my environment. – Kirill Barsukov Jun 08 '19 at 23:24
1

As an addition to Michael W's answer. I think you also put these settings under Project?

Project Settings

And to be on the safe side, check here if the version is set correctly. Sometimes it differs with me. You can simply enter javac in the search settings. Settings

Sven M.
  • 587
  • 7
  • 23