1

I made a new project today and wanted to compile with Maven (I'm running it on IntelliJ). Made sure to change the JDK level to 1.8, which is what I currently use, tried to compile and I'm getting a lot of exceptions asking me to use the "-source 8" argument since the default one is 1.5, and I'm using features of newer JDK versions.

I haven't been using IntelliJ for a long time, could anyone please tell me how to change these Maven compile arguments or how to solve this issue?

sirandy
  • 1,834
  • 5
  • 27
  • 32
John M
  • 31
  • 4

1 Answers1

1

You add this to your pom.xml

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

see: https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html

JFPicard
  • 5,029
  • 3
  • 19
  • 43
  • Hey, that worked for me. Thanks! Also, it may seem a bit off-topic but do you know if there's an easy way to import normal libraries into my pom? – John M Jul 26 '17 at 17:59
  • See: https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html – JFPicard Jul 26 '17 at 18:01