Bug 1877716 - Change default source and target to 1.6
Summary: Change default source and target to 1.6
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: maven-3.6-module
Version: 8.3
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: 8.0
Assignee: Mikolaj Izdebski
QA Contact: RHEL CS Apps Subsystem QE
Depends On:
TreeView+ depends on / blocked
Reported: 2020-09-10 09:45 UTC by Martin Kyral
Modified: 2020-12-16 08:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2020-11-18 08:51:22 UTC
Type: Bug
Target Upstream Version:

Attachments (Terms of Use)

Description Martin Kyral 2020-09-10 09:45:45 UTC
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):

How reproducible:

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

Actual results:
[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.

Expected results:

Additional info:

Comment 1 Mikolaj Izdebski 2020-09-10 10:38:46 UTC
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.

Comment 2 Martin Kyral 2020-09-11 11:28:13 UTC
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).

Comment 4 Mikolaj Izdebski 2020-11-18 08:51:22 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.