Cannot packages nor servlets in a Maven web project...
Answered
I'm testing IntelliJ with a Maven Project, it creates the Project fine, the problem is that I don't see the option to add a Servlet, and i don't see an option to add a package eather. just JSP and JSF pages, this is the sub-menu I get, how can I add a servlet and a package?
You can see the submenu I get in the attached picture.
I found the way in the View->Tools->Web menu, in that view i can right click and add a Servlet, but it doens't do anything, it doesn't create the class nor the servlet declartation in the web.xml file, it simple does nothing.
Attachment(s):
intellij_maven_no_add_servlet_option.png
Please sign in to leave a comment.
src/main/java is not configured as a source folder.
Did you actually import this project from Maven? Please share your pom.xml, what packaging method does it define?
Hi, I created the project directly from IntelliJ (a Maven project using a webapp archeotype), I added the java folder manually, here is the pom.xml
After importing the Maven project java directory will be configured as Sources automatically:

Please make sure you are using IDEA Ultimate as these features are not available in Community.
If it still doesn't work for you, please submit a ticket to support at https://intellij-support.jetbrains.com/home/ , attach your project and idea.log (https://intellij-support.jetbrains.com/entries/23352446).
Thank you.
I marked the directory as Source Directory and I was able to create packages and classes.
I have a similar problem, but in my case, the java folder is market as the source and I have already added the servlet dependency in the pom.xml file but I am still not able to see the option to create a servlet java class.
Do you have IntelliJ IDEA Ultimate? Did you disable any plug-ins?
I am using IntelliJ IDEA Ultimate and I didn't disable any plugin
I checked if is there any file template for servlet and there is no template.
Please provide the screenshot showing the New menu for the source root where Servlet option is missing. Also upload the logs (Help | Compress Logs and Show in ...) at https://uploads.services.jetbrains.com/ and specify the file name here.
I have uploaded the filename:
I will try to uninstall it and install one of the 2018 versions.
I managed to get it solved. I had to first create a simple maven project without any archetype defined and after I had to add the Java EE framework on the created project.
Had the same problem but solved it by removing
<scope>provided<scope> from the dependency!!
I came across a scenario, it may be useful for someone.
https://stackoverflow.com/a/59481579/6456330
Tried above:
-Marked Java as source root
-Make sure the servlet package is there.
-Using Ultimate Intellij
-rebuilt maven and reimported
-removed the <scope> code
-web.xml is in my structure
-deleted projects and recreated it multiple times
Any ideas?
-------------------------
reedited: After two-hour investigation,
I realized that the UI has been changed.
Instead of being called "Servlet" at the last third line, it is called "Create New Servlet" at the last fifth line.
Please provide the sample project and the screenshot of the issue. You can upload the files at https://uploads.services.jetbrains.com/.