This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 230984 - [Maven] New plain Maven project should use JDK 1.6/1.7 binary format as default
Summary: [Maven] New plain Maven project should use JDK 1.6/1.7 binary format as default
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on: 208462
Blocks:
  Show dependency tree
 
Reported: 2013-06-09 11:25 UTC by markiewb
Modified: 2014-03-24 07:54 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Shows the project properties and its issue (132.64 KB, image/png)
2013-06-09 11:28 UTC, markiewb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2013-06-09 11:25:52 UTC
[ JDK VERSION : 1.7.0_21 ]

* create a new project via "New Project|Maven|Java Application"
* open the project properties -> sources

ACTUAL: binary format is 1.5
EXPECTED: binary format is 1.6 (or 1.7)

FYI: When creating a project via "New Project|Maven|EJB Module" then the binary
format is set to 1.7
Comment 1 markiewb 2013-06-09 11:28:27 UTC
Created attachment 135548 [details]
Shows the project properties and its issue
Comment 2 markiewb 2013-06-09 11:29:28 UTC
FYI: in a new plain non-maven-based java application the binary
format is also set to 1.7 by default
Comment 3 Milos Kleint 2013-06-09 18:54:48 UTC
closely related to issue 208462
Comment 4 Milos Kleint 2013-06-10 07:47:19 UTC
(In reply to comment #0)
> [ JDK VERSION : 1.7.0_21 ]
> 
> * create a new project via "New Project|Maven|Java Application"
> * open the project properties -> sources
> 
> ACTUAL: binary format is 1.5
> EXPECTED: binary format is 1.6 (or 1.7)
> 
> FYI: When creating a project via "New Project|Maven|EJB Module" then the binary
> format is set to 1.7

for ejb/war/ear projects the source level is set explicitly because they are closely associated with the given version of javaee.

source/target 1.5 are the default values for maven compiler plugin. Any other value requires configuration. Any configuration in the current pom overrides possibly inherited value from the parent. 
That's an issue often encountered when creating projects from archetypes in multiproject environment.
Comment 5 markiewb 2013-06-10 20:40:32 UTC
(In reply to comment #4)
> Any configuration in the current pom overrides possibly inherited value from the parent. 

Good catch.
Comment 6 Milos Kleint 2013-12-05 09:10:20 UTC
for 8.0 I've reworked the basic jar (and pom) project templates to be generated by the IDE without an archetype. I suppose adding the source/target level should be easier now
Comment 7 Milos Kleint 2013-12-05 10:17:21 UTC
http://hg.netbeans.org/core-main/rev/69765c62fcd4
Comment 8 Quality Engineering 2013-12-06 02:46:33 UTC
Integrated into 'main-silver', will be available in build *201312060002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/69765c62fcd4
User: Milos Kleint <mkleint@netbeans.org>
Log: #230984 use source level 1.7 by default if nothing is defined by the parent, in that case just inherit
Comment 9 penelop92200 2014-03-22 14:58:12 UTC
Ok, but how to set the default binary format for each new project ? 

Each time I create a new project I have 1.7 , I have to set 1.8 manually each time. Find nowhere how to set it, is it hardcoded ?
Comment 10 athompson 2014-03-23 04:21:48 UTC
(In reply to penelop92200 from comment #9)
> Ok, but how to set the default binary format for each new project ? 
> 
> Each time I create a new project I have 1.7 , I have to set 1.8 manually
> each time. Find nowhere how to set it, is it hardcoded ?

You can easily change this yourself by creating a custom archetype and using it to create new projects. See the Maven documentation for details on how this.
Comment 11 Milos Kleint 2014-03-24 07:54:37 UTC
(In reply to athompson from comment #10)
> (In reply to penelop92200 from comment #9)
> > Ok, but how to set the default binary format for each new project ? 
> > 
> > Each time I create a new project I have 1.7 , I have to set 1.8 manually
> > each time. Find nowhere how to set it, is it hardcoded ?
> 
> You can easily change this yourself by creating a custom archetype and using
> it to create new projects. See the Maven documentation for details on how
> this.

Yes, the default is hardcoded. Intentionally there's no UI option in the wizard to set it. You can either ex post change it in the pom or project customizer or in larger project sets, the value should be encoded in the parent pom hierarchy. The generation code will respect that.