0

After a switch to JDK8 the MANIFEST.MF Attributes started returning null
https://bugs.openjdk.java.net/browse/JDK-8201636 suggests that this is a bug introduced by Oracle in JDK 8u151-8u172.

I use pom.xml and IntelliJ IDEA. pom.xml specifies (tags < and > removed)

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

IDEA settings show target bytecode version 1.8
JAVA_HOME set to JDK10
I have C:\Program Files\Java\jdk1.8.0_201 installed.

How to specify this version for the builds. Also does pom.xml trump IDEA project settings or vice versa?


Edit:
I've specified

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <verbose>true</verbose>
                <fork>true</fork>
                <!--executable>{JAVA_1_8_HOME}/bin/javac</executable-->
                <executable>C:/Program Files/Java/jdk1.8.0_201/bin/javac</executable>
                <compilerVersion>1.8</compilerVersion>
            </configuration>
        </plugin>

Intellij still defaults to JDK 1.5 and chokes on List<String> a = new ArrayList<>(); with "I don't understand <> with JDK1.5".

Stepan
  • 1,391
  • 18
  • 40

1 Answers1

0

maven.compiler.target and source are nothing to do with it. Those are just arguments passed to javac.

If you want to specify the version of javac explicitly, you can use the Maven Compiler Plugin.

<configuration>
  <verbose>true</verbose>
  <fork>true</fork>
  <executable><!-- path-to-javac --></executable>
  <compilerVersion>1.3</compilerVersion>
</configuration>

Otherwise the javac from the Project SDK will be used (Project Structure > Project).

Michael
  • 41,989
  • 11
  • 82
  • 128
  • If you don't mind, can you look at this question please? https://stackoverflow.com/questions/55520594/jdk-version-hierarchy-in-ideamaven-what-is-the-order-of-importance-of-jdk-sett – Stepan Apr 04 '19 at 16:13