Description of problem:
Maven before 3.8.0 uses default source and target version 1.5. But JDK 9+ can't compile with these settings. As a result, project generated with maven:3.6 / java 11 can't be built with maven:3.6 / java 11 - which seems odd.
Workaround is to change the defaults manually or setting the values in the project.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. mvn -e -V archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
2. cd my-app
3. mvn -e -V package
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project my-app: Compilation failure: Compilation failure:
[ERROR] Source option 5 is no longer supported. Use 6 or later.
[ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.
I don't think it's a problem with maven module, but rather with the project generated by old, obsolete version of archetype being used.
Since explicit version of maven-archetype-quickstart is not specifed, an old version (1.0) is used. That version generates maven project that is not compliant with current best practices and therefore fails to build with Maven 3.6 and Java 11.
I would recommend to set explicit version of the archetype to the latest available version by passing -DarchetypeVersion=1.4 argument to the command in step 1.
Thanks for the hint. It fixed the issue with the test. However, I still think that the defaults (archetype version in this case) should be sane - ie. generated project should be buildable without the need to pass additional parameters. Of course, priority of this bug is very low (unless a customer complains about it).
I believe that our maven package should use the same defaults as upstream Maven, that is source/target 1.5 for Maven 3.6
Our package works as intended in this regard, so there is nothing to be fixed. Closing as NOTABUG.