question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error creating Enterprise Application with Maven

See original GitHub issue

Apache NetBeans version

Latest release

What happened

When I try to create an Enterprise application with Maven the process fails and generates a corrupt project. The last version of Netbeans where it worked correctly for me is 8.2, which I still have to generate the base projects. All new versions of netbeans fail the same way.

How to reproduce

  1. New Project
  2. Categories: Java with Maven
  3. Enterprise application
  4. fill in the fields normally
  5. Select any server
  6. Java EE version: Jakarta EE 8
  7. Check create EJB Module
  8. Check Web App module and assembly module
  9. Finish
wizard01 wizard02

Project creation result:

Log output:


Generating project in Batch mode
Archetype not found in any catalog. Falling back to central repository.
Add a repository with id 'archetype' in your settings.xml if archetype's repository is elsewhere.
----------------------------------------------------------------------------
Using following parameters for creating project from Archetype: webapp-jakartaee8:1.0.0
----------------------------------------------------------------------------
Parameter: groupId, Value: testapp
Parameter: artifactId, Value: enterpriseApplicationWithMaven-ejb
Parameter: version, Value: 1.0.0
Parameter: package, Value: testapp.enterpriseApplicationWithMaven-ejb
Parameter: packageInPathFormat, Value: testapp/enterpriseApplicationWithMaven-ejb
Parameter: package, Value: testapp.enterpriseApplicationWithMaven-ejb
Parameter: groupId, Value: testapp
Parameter: artifactId, Value: enterpriseApplicationWithMaven-ejb
Parameter: version, Value: 1.0.0
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time:  4.155 s
Finished at: 2022-02-03T09:34:46-03:00
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.1.2:generate (default-cli) on project enterpriseApplicationWithMaven: Unable to add module to the current project as it is not of packaging type 'pom' -> [Help 1]


Full log is attached: project_creation.log

Finally: A series of directories are created with the correct structure, but the pom.xml is not created properly and all modules seem to be of WAR type.

project-view

Did this work correctly in an earlier version?

  • This used to work!

Operating System

macOS Monterey, Windows 10, Windows 11

JDK

zulu11, zulu8, jdk1.7.0_80, jdk1.8.0_271

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

I assume that the problem lies in the archetype used

Are you willing to submit a pull request?

  • Yes I am willing to submit a PR!

Code of Conduct

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
asbachbcommented, Feb 7, 2022

Afaik JavaEE/JakartaEE spec require backwards compatibility so the support won’t go away soon.

But it seems a legitimate question if these types should be proposed by NetBeans for new projects. Afaik you still need an EAR when you bundle a resource adapter.

0reactions
OndroMihcommented, Nov 6, 2022

I hit this issue too. The reason why the project ends in a corrupted stat is that for newer Java EE and Jakarta EE versions, it uses the same archetype for all generated Maven modules. And the archteype generates a WAR module. Therefore we’ll get a WAR module, with multiple nested WAR modules. This is not only wrong but invalid, because the top-level module isn’t POM but WAR.

If we decide that Netbeans won’t support EAR project generation for newer Jakarta EE versions, we should then remove the archetype for the newer versions of Jakarta EE in https://github.com/apache/netbeans/blob/f0ed696648470561d9e05c03db965812893b3f51/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/archetype/J2eeArchetypeFactory.java#L118, so that users can choose the newer versions and get a corrupted project.

It should be reasonably easy to add support for EAR though, by adding appropriate archetypes, because they are very simple. The source code repository for old archetypes at codehaus.org is gone, however, their source code is still available in Maven Central and we can loosely base the new archtypes on that (but not simply fork it, because it’s not released under any opensource license AFAIK). I can have a look into this. @juneau001, would it be OK to contribute to your repository for the WEB archetype? Or better to do it in my own repo/fork and release the new archetypes to Maven Central by myself? Or maybe, even better, join the Eclipse Starter project, which already provides some Jakarta EE archetypes?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating an Enterprise Application Using Maven
In this tutorial you create an enterprise application that is packaged as an EAR archive and deployed to GlassFish Server Open Source Edition...
Read more >
problem creating Maven Web Project project in netbeans 8.2
I went to New Project > Maven > Web Application and tried creating a maven project. I am using glassfish server 4.1.1 and...
Read more >
Error while using enterprise runtime & maven
I am using enterprise mule runtime 3.8.1 and created a maven project. When I run the application it resulted in error as following....
Read more >
Spring Boot, Maven and Eclipse Errors and TroubleShooting ...
Error : On Maven > Update Project, Java 1.4 is auto selected ... Spring 5 and Spring 4 in terms of developing web...
Read more >
Tutorial: Your first Java EE application | IntelliJ IDEA ...
You will create a new Java Enterprise project using the web application ... Select the Web application template, Maven as a build tool, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found