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 230188 - Project properties showing old project is a JavaEE 7 project by default
Summary: Project properties showing old project is a JavaEE 7 project by default
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.3.1
Hardware: PC Linux
: P1 normal (vote)
Assignee: Martin Janicek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-23 14:25 UTC by Michel Graciano
Modified: 2013-05-29 11:31 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michel Graciano 2013-05-23 14:25:42 UTC
I have opened an 'old' Web Maven project create at 7.3 at 7.3.1 and now the project properties shows it is a JavaEE 7 project and if I change it to JavaEE 6 it shows a warning that this change could break the project. IMHO, it is wrong to make this kind of assumption and we need to mark the project as JavaEE X when the project is created.

I am pretty sure it is better to assume all project opened at 7.3.1 are JavaEE 6 compliant than 7 by default and so make possible to the user change it to JavaEE 7 when necessary, with the appropriate warning. I think the property netbeans.hint.j2eeVersion should be create when the project is create. It will minimize any problem since the user need to already choose the JavaEE version at the wizard.
Comment 1 Jiri Skrivanek 2013-05-24 08:07:23 UTC
Existing Maven projects should keep their Java EE level. Please, evaluate whether it is possible to fix it in 7.3.1.
Comment 2 Martin Janicek 2013-05-25 16:58:39 UTC
AFAIK before the new Java EE 7 support, we were recognizing project using web.xml version and if the web.xml were not presented it was always Java EE 6 project.

Since Java EE 7 it's not possible to use the same mechanism because both Java EE 6 and Java EE 7 don't need to have web.xml by default (which is one of the reasons why it's possible to set Java EE version from the project properties - that possibility was disabled before 7.3.1). And it is actually reason why we are creating netbeans.hint.j2eeVersion when creating new projects.

Based on the above, there is no way I can recognize the project were created as Java EE 6 not Java EE 7. On the other hand the true is that all Java EE 7 projects should have netbeans.hint.j2eeVersion set, so maybe we can set Java EE 6 as the default value instead of the Java EE 7..
Comment 3 Jiri Skrivanek 2013-05-25 19:32:27 UTC
BTW, Java EE 5 project from 7.3 is recognized as Java EE 7 in 7.3.1 too. It seems the project level recognition doesn't work at all.
Comment 4 Petr Jiricka 2013-05-26 11:11:21 UTC
> we are creating netbeans.hint.j2eeVersion when creating new projects

So when did we start doing this? Did we do this in 7.3, or is this new behavior in 7.3.1?

> BTW, Java EE 5 project from 7.3 is recognized as Java EE 7 in 7.3.1 too.

So this project contains web.xml? In that case that would be a serious problem, IMO.
Comment 5 Martin Janicek 2013-05-26 12:15:17 UTC
> BTW, Java EE 5 project from 7.3 is recognized as Java EE 7 in 7.3.1 too.

You're right Jirko. Two things seems to be wrong. First there is no check for web.xml in 7.3.1 and second even with check there is Java EE 7 as the default platform.

I'm going to do following:

1) Check if the netbeans.hint.j2eeVersion is created and if so use the platform defined there
2) Check for web.xml and if it exists try to guess Java EE platform
3) Else simply set version to Java EE 6

> So when did we start doing this? Did we do this in 7.3, or is this new behavior
> in 7.3.1?

AFAIK it's new behavior.
Comment 6 Martin Janicek 2013-05-26 14:10:59 UTC
Fixed in: web-main #866681eef255
Comment 7 Martin Janicek 2013-05-26 14:12:47 UTC
BTW: It won't be possible to simply graft/transplant the change-set into the release73 branch because the code differs between trunk and 7.3.1.

Although it shouldn't be complicated to update the patch also for 7.3.1
Comment 8 Petr Jiricka 2013-05-26 17:05:53 UTC
Thanks a lot Martin. Who would be able to review the patch - David, would you, please?
Comment 9 Jiri Skrivanek 2013-05-27 08:09:09 UTC
Verified in NetBeans IDE Dev (Build web-main-10615-on-20130527).
Comment 10 Martin Janicek 2013-05-27 09:06:56 UTC
Martine, may I ask you for the review?
Comment 11 Martin Fousek 2013-05-27 09:19:10 UTC
Reviewed changeset seems to be fine and safe.
Comment 12 Martin Janicek 2013-05-27 09:24:47 UTC
Thanks for the super-fast-review! :) ..I send email to reviewers and I'm going to integrate to the release73 later today.
Comment 13 Martin Janicek 2013-05-27 13:47:35 UTC
Integrated in: releases #4ec440196f28
Comment 14 Michel Graciano 2013-05-27 17:16:43 UTC
I guess that the assumptions done for 7.3.1 are fair enough but I have been thinking about the future (not so long future IMO) and how to improve it. Since now web.xml is optional, we gonna have this kind of issue for future versions of JavaEE. I was wondering if at least for Maven projects this lookup couldn't be improved (probably using dependencies versions), or if it is impossible to infer, maybe we can ask formally to the user the right JavaEE version (probably with a UI, maybe in the Open Project wizard...).

I am wondering because since we have transparent support for Maven, people can freely create JavaEE 7 projects outside the IDE and when the user open it inside the IDE we can have issues if we assume JavaEE 6 as default.
Comment 15 Quality Engineering 2013-05-27 23:34:08 UTC
Integrated into 'releases', will be available in build *201305272201* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/4ec440196f28
User: Martin Janicek <mjanicek@netbeans.org>
Log: #230188 - Project properties showing old project is a JavaEE 7 project by default
Comment 16 Martin Janicek 2013-05-28 08:12:32 UTC
(In reply to comment #14)
> I was wondering if at least for Maven projects this lookup couldn't
> be improved (probably using dependencies versions)

This is an interesting idea and I think it should be possible. It's not complicated to go through the project dependencies and lookup if there is an javaee version specified. But from what I remember this operation can be possibly expensive so I would say we can check if there is a netbeans.hint.j2eeVersion and if not, run a background task looking up for javaee version and set the netbeans.hint.j2eeVersion for the future usages.
What do you think?

> I am wondering because since we have transparent support for Maven, people can
> freely create JavaEE 7 projects outside the IDE and when the user open it
> inside the IDE we can have issues if we assume JavaEE 6 as default.

Agree, if we can find some elegant solution I'm 100% for it..
Comment 17 Quality Engineering 2013-05-28 14:15:27 UTC
Integrated into 'main-golden', will be available in build *201305281155* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/866681eef255
User: Martin Janicek <mjanicek@netbeans.org>
Log: #230188 - Project properties showing old project is a JavaEE 7 project by default
Comment 18 Michel Graciano 2013-05-28 17:06:25 UTC
(In reply to comment #16)
> (In reply to comment #14)
> > I was wondering if at least for Maven projects this lookup couldn't
> > be improved (probably using dependencies versions)
> 
> This is an interesting idea and I think it should be possible. It's not
> complicated to go through the project dependencies and lookup if there is an
> javaee version specified. But from what I remember this operation can be
> possibly expensive so I would say we can check if there is a
> netbeans.hint.j2eeVersion and if not, run a background task looking up for
> javaee version and set the netbeans.hint.j2eeVersion for the future usages.
> What do you think?

I think it is acceptable. Since we don't have a reliable and performatic approach and the IDE need to know the version to be able to help the users, we need a way to balance it and keep this metadata netbeans.hint.j2eeVersion looks good to me.

I still think it needs a further thinking but it is imperative fix it for the next release. Should I file a new issue for 7.4 to track this?
Comment 19 Martin Janicek 2013-05-29 10:48:02 UTC
(In reply to comment #18)
> (In reply to comment #16)
> > (In reply to comment #14)
> > > I was wondering if at least for Maven projects this lookup couldn't
> > > be improved (probably using dependencies versions)
> > 
> > This is an interesting idea and I think it should be possible. It's not
> > complicated to go through the project dependencies and lookup if there is an
> > javaee version specified. But from what I remember this operation can be
> > possibly expensive so I would say we can check if there is a
> > netbeans.hint.j2eeVersion and if not, run a background task looking up for
> > javaee version and set the netbeans.hint.j2eeVersion for the future usages.
> > What do you think?
> 
> I think it is acceptable. Since we don't have a reliable and performatic
> approach and the IDE need to know the version to be able to help the users, we
> need a way to balance it and keep this metadata netbeans.hint.j2eeVersion looks
> good to me.
> 
> I still think it needs a further thinking but it is imperative fix it for the
> next release. Should I file a new issue for 7.4 to track this?

Yup, that would be awesome. Thanks!
Comment 20 Michel Graciano 2013-05-29 11:31:14 UTC
Done at issue #230447.