netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Improve Jakarta EE 9/9.1 support

Open pepness opened this issue 3 years ago • 12 comments

Changes for NetBeans in general

  • Add schemas for Jakarta EE 9
  • Add namespace for Jakarta EE
  • Add missing deployment descriptor files for Java EE and Jakarta EE
  • Add validations to create deployment descriptor for Jakarta EE 9
  • Add mdd files for Jakarta EE 9 schemas
  • Fix wrong version inside some mdd files
  • Add support to create bean validation deployment descriptor's based on the Profile version
  • Add DataLoader for Jakarta EE 9 schemas (EjbJar40DataLoader, DDWeb50DataLoader)
  • Add missing DataLoader for Java EE 8 schemas (DDWeb40DataLoader)
  • Add missing maven coordinates for Java/Jakarta EE
  • Jakarta 9/9.1 xsd files have a license type of EDL-1.0 or EPL-v20
  • Add some tests

Miscellaneous:

  • Use try-with-resources
  • Formatting code
  • Add documentation
  • Use diamond operator
  • Use StandardCharsets
  • Remove unused imports
  • Use switch-case instead of long if-else if-else
  • Use Multi-catch when possible
  • Improve performance of Collection.toArray

Testing:

  • Full build done
  • Verify successful execution of libraries and licenses Ant test
  • Verify successful execution of Sigtests
  • Verify successful execution of commit-validation
  • Verify successful execution of rat-exclusions
  • Started NetBeans and ensure the log didn't have any ERROR or new WARNINGS
  • Download every version of GlassFish and successfully:
    • Create Web App Project from Java EE 5 to Jakarta EE 9.1
    • Create every deployment descriptor from Java EE 5 to Jakarta EE 9.1 in each project
    • Verify correct version of each deployment descriptor match to the Profile version of the Web App
    • Deploy and run the project

pepness avatar Jul 26 '22 19:07 pepness

Hi @pepness I will try to review today. Does this include all of the fixes that I had performed in my previous PR? It looks like it does. I performed a lot of work to get those fixes completed so I don't want to duplicate work if we do not have to...so I'll compare to see the delta between your changes and mine. Thanks

juneau001 avatar Jul 27 '22 12:07 juneau001

lots of issue may be linked to this PR. Nice job

ebarboni avatar Jul 27 '22 16:07 ebarboni

Hi @juneau001, I did not include your PR, I already had some of these changes in my branch as a continuation of PR-4364. @mbien I will check what issues may be closed with this PR.

pepness avatar Jul 27 '22 16:07 pepness

Thanks @pepness the code looks good after a quick review. I did download PR sources and ran unsuccessfully though. Was able to create a Jakarta EE 8 project after I deselected "GlassFish Server". However, a Jakarta EE 9.1 Web Project did not generate and provided error: No archetype defined for profile 9.1-web in class org.netbeans.modules.maven.j2ee.ui.wizard.archetype.J2eeArchetypeFactory$WebArchetypes; check whether all possible   pairs have been added. Thanks

juneau001 avatar Jul 27 '22 19:07 juneau001

@juneau001, This PR does not add support to Maven projects, just to Ant projects and with GlassFish server (sometimes I work with limited Internet access and just with Ant projects); but the foundation was build inside the core javaee/j2ee modules: j2ee.api.ejbmodule, j2ee.clientproject, j2ee.common, j2ee.core, j2ee.dd and so on, adding support for Maven and Gradle projects should be way easy now. I guess we need to register a new Maven archetype for Jakarta 9.1, I will do some tests with a maven project.

These are the steps that I did to test with an Ant project:

  • Cleaning cache and everything with rm -rf ~/.netbeans/dev && rm -rf ~/.cache/netbeans/dev
  • Build the sources
  • Start NetBeans (running JDK-19ea) and register JDK 8 and 11
  • Create an Ant Web App
  • Register servers GlassFish 5.1 and 6.2.5
  • Create the web standard deployment descriptor Screenshot from 2022-07-27 16-56-05 Screenshot from 2022-07-27 16-55-04 Screenshot from 2022-07-27 17-25-52

pepness avatar Jul 27 '22 22:07 pepness

Thanks to @juneau001 archetypes I have added Jakarta EE 9.1 support for maven projects (by reusing Jakarta 9 archetype). The only thing missing is the actual Jakarta EE 9.1 archetype that use java 11 and the correct Jakarta 9.1.0 version.

pepness avatar Jul 28 '22 00:07 pepness

Thanks to @juneau001 archetypes I have added Jakarta EE 9.1 support for maven projects (by reusing Jakarta 9 archetype). The only thing missing is the actual Jakarta EE 9.1 archetype that use java 11 and the correct Jakarta 9.1.0 version.

Thanks so much for your hard work on this PR @pepness , great work! I will test out the PR. I had created previous archetypes for Jakarta EE 8 and Jakarta EE 9 (https://mvnrepository.com/artifact/io.github.juneau001). If you want me to create the 9.1.0 archetype using JDK 11 then I can do that...just let me know.

juneau001 avatar Jul 28 '22 03:07 juneau001

If you want me to create the 9.1.0 archetype using JDK 11 then I can do that...just let me know.

@juneau001 Yes please!, with that this PR would be complete.

pepness avatar Jul 28 '22 17:07 pepness

If you want me to create the 9.1.0 archetype using JDK 11 then I can do that...just let me know.

@juneau001 Yes please!, with that this PR would be complete.

@pepness I have generated the archetype and published it. It may take a few hours or days to show up in Maven Central. Here is the GitHub repository for the archetype: https://github.com/juneau001/jakartaee91_archetype

juneau001 avatar Jul 29 '22 11:07 juneau001

Testing: I was able to create Jakarta EE 8 and 9 projects without issue using Maven. Testing successful! Once Jakarta EE 9.1 archetype is in-place and used for creation of the Jakarta EE 9.1 projects then I think this is ready to move forward. Thanks @pepness and I will update this thread once the archetype is available in Maven central for use.

juneau001 avatar Jul 29 '22 12:07 juneau001

Testing: I was able to create Jakarta EE 8 and 9 projects without issue using Maven. Testing successful! Once Jakarta EE 9.1 archetype is in-place and used for creation of the Jakarta EE 9.1 projects then I think this is ready to move forward. Thanks @pepness and I will update this thread once the archetype is available in Maven central for use.

Hi @pepness the Jakarta EE 9.1 archetype is now published to Maven Central. Please use the following coordinates and let me know if you need anything. Thanks again for the tremendous effort to improve Jakarta EE support in Apache NetBeans!

io.github.juneau001 webapp-jakartaee91 1.0.0

juneau001 avatar Jul 31 '22 02:07 juneau001

I added the "do not merge" label. The issues raised before regarding license infos need to be fixed prior to merging.

matthiasblaesing avatar Aug 04 '22 17:08 matthiasblaesing