Bug 580990 - create dynamic web project 5.0
Summary: create dynamic web project 5.0
Status: NEW
Alias: None
Product: EPP
Classification: Technology
Component: jee-package (show other bugs)
Version: 4.25 / 2022-09   Edit
Hardware: PC Windows 10
: P3 normal with 1 vote (vote)
Target Milestone: later   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2022-11-04 10:53 EDT by gbarnard CLA
Modified: 2024-03-13 07:58 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gbarnard CLA 2022-11-04 10:53:15 EDT

    
Comment 1 gbarnard CLA 2022-11-04 11:02:46 EDT
Trying to create a Dynamic Web Project 5.0 fails with message saying it needs Java 1.8 or later. I have tried using both Java 11 and 17 as the runtime, but Eclipse spits out the message  Dynamic Web Module 5.0 requires Java 1.8 or newer.

I can easily create one with 4.0 and use the Project Facets to move it to 5.0.

I'm using Eclipse for 6/2022 and plan on deploying to Glassfish 6.25.
Comment 2 Nitin Dahyabhai CLA 2022-11-04 23:51:33 EDT
What about on the current release?
Comment 3 gbarnard CLA 2022-11-05 21:37:37 EDT
Please clarify "current release"? If you mean 5.x, then no. But I need to work with Servlet 5.0. That's Eclipse IDE version 6/22.
Comment 4 Nitin Dahyabhai CLA 2022-11-05 21:52:28 EDT
I was referring to the 2022-09 release. There is a release every quarter.
Comment 5 gbarnard CLA 2022-11-06 14:17:21 EST
My apologies. I am using the 9/22 release. Updated this ticket accordingly.
Comment 6 Nitin Dahyabhai CLA 2022-11-06 16:13:38 EST
If you have not selected a target runtime in the wizard, the bug is that choosing 4.0 does not also prevent you from finishing the wizard.

If you are choosing a target runtime that supports version 5 of the dynamic web facet, does the runtime's entry on the Server Runtime Environments preference page also refer to a 1.8 or newer JRE?
Comment 7 gbarnard CLA 2022-11-08 12:55:30 EST
When creating a project, the IDE does not know anything about a server. I will be building WAR files which should be server agnostic. And, the only reference to Java version that I know of is in the Window->Preferences->Java->Installed JREs is set to Java 11. It's not until the project is created that I can change the project's Java version.

So, the last comment is VERY confusing.
Comment 8 Nitin Dahyabhai CLA 2022-11-08 14:26:13 EST
Server agnostic doesn't mean you can compile Servlets without the base types and interfaces being present to compile against, and those most often come from some sort of server. Perhaps you should add a screenshot, because I'm not sure you're setting values in the wizard that are required to Finish it.
Comment 9 gbarnard CLA 2022-11-08 21:50:22 EST
I think I see the prompt you're referring to: Target Runtime. The server that I have installed is the latest version of Glassfish and the IDE has the latest Payara Tools installed. 

When I select the Payara tool, the Dynamic Web Module Version is maxed out at 4.0. 

At this point, I'm going to have to rethink the project I'm trying to create.

Thanks for your time!!!!!
Comment 10 gbarnard CLA 2022-11-08 21:50:50 EST
I think I see the prompt you're referring to: Target Runtime. The server that I have installed is the latest version of Glassfish and the IDE has the latest Payara Tools installed. 

When I select the Payara tool, the Dynamic Web Module Version is maxed out at 4.0. 

At this point, I'm going to have to rethink the project I'm trying to create.

Thanks for your time!!!!!
Comment 11 gbarnard CLA 2022-11-08 21:50:57 EST
I think I see the prompt you're referring to: Target Runtime. The server that I have installed is the latest version of Glassfish and the IDE has the latest Payara Tools installed. 

When I select the Payara tool, the Dynamic Web Module Version is maxed out at 4.0. 

At this point, I'm going to have to rethink the project I'm trying to create.

Thanks for your time!!!!!
Comment 12 gbarnard CLA 2022-11-08 21:50:59 EST
I think I see the prompt you're referring to: Target Runtime. The server that I have installed is the latest version of Glassfish and the IDE has the latest Payara Tools installed. 

When I select the Payara tool, the Dynamic Web Module Version is maxed out at 4.0. 

At this point, I'm going to have to rethink the project I'm trying to create.

Thanks for your time!!!!!
Comment 13 Dave Nice CLA 2024-02-15 11:53:42 EST
Hey,

We have hit this as part of some testing, too. To reiterate the issue.
Using the dynamic web project wizard, on Eclipse 2023-12.
If you choose Dynamic web module version 4.0 or older, you are able to click next without selecting a Target runtime.

If you choose Dynamic web module version 5.0 or newer, the wizard is prevented from continuing with the error "Dynamic Web Module 5.0 requires Java 1.8 or newer".

I suspect that this is because in https://github.com/eclipse-jeetools/webtools.javaee/blob/master/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebProjectFirstPage.java for versions 4.0 and earlier, a Java facet is also added to the project.

Is there a reason why from 5.0 and newer a user must add a target runtime, whereas they don't need to before then?
Comment 14 Nitin Dahyabhai CLA 2024-03-03 21:49:48 EST
(In reply to Dave Nice from comment #13)
> Is there a reason why from 5.0 and newer a user must add a target runtime,
> whereas they don't need to before then?

Only an oversight. Not adding a runtime leaves Servlets without the necessary classes to compile against. Is there a use case for not setting a runtime?
Comment 15 Dave Nice CLA 2024-03-13 06:59:54 EDT
Thanks Nitin.

Our product provides its own classpath container to resolve the classes available in our product, however it doesn't appear in the Target Runtime framework.

So our customers use the approach of not selecting a target runtime, but adding in a library later that contains the appropriate Java code.

So I think retaining the original behaviour seems reasonable? It's easy to change the Java library to a different version if needed but harder to change the dynamic web module version!

I will see if I can open a PR with a suggested change.
Comment 16 Dave Nice CLA 2024-03-13 07:58:41 EDT
I created PR https://github.com/eclipse-jeetools/webtools.javaee/pull/7 - happy to take comments.

I wasn't sure of the right infrastructure to test the change so did it locally by hotswapping the contents of the method.