javaintellij-ideamaven-3

unable to create java package in maven project imported in Intellij


I've imported a maven project into Intellij and added a module to the src directory. But now I discovered that I cannot add a java package to new directory as I can with other projects, i.e., whenever I right click on the newly added directory, Intellij does not give me the possibility to add a java package. It would seem that this is a setting issue but I cannot find the setting that would control this. I'm using the community edition of Intellij: 2018.3


Solution

  • Your problem is your src folder not marked as sources folder . Try below step

    1. From the main menu, select File | Project Structure(Ctrl+Shift+Alt+S) and click Project Settings | Modules.

    2. Select the src folder mark with sources folder.

    Now you can able to create the Packages under src