Refresh the Maven project in the Maven Projects tool window (Reimport All Maven Projects), if it doesn't help, refer to this answer for diagnostics.

The issue is that your source roots were not configured correctly from the Maven model for some reason and the .java file appears in a plain directory instead of the Source root.
You can tell that by the color of the folders and by the icon of the file.
Answer from CrazyCoder on Stack OverflowRefresh the Maven project in the Maven Projects tool window (Reimport All Maven Projects), if it doesn't help, refer to this answer for diagnostics.

The issue is that your source roots were not configured correctly from the Maven model for some reason and the .java file appears in a plain directory instead of the Source root.
You can tell that by the color of the folders and by the icon of the file.
You need to create a Java Project.
File->New->Project->Java->Next->Next->Finish
Then go to the top and do:
Right click parent folder of project->Add Framework Support->Click Maven->Ok
Now Maven should be added to your project and also you should be able to run it
If this doesn't allow you to run the project, click the little drop down box to the left of the grayed out run button and click Edit Configurations.
Then click the + and click Application and set your Main class to the class that has the main method in it, and then it should allow you to run the application.
Hope that helps!
Videos
Please follow the following steps:
Set the maven goal by clicking the "+" in IntelliJ (circled area)

Write
mvn install.
Set the VM Options as:
-Dspring.profiles.active=development
After that it should just run fine just by clicking the green play button.
This should help you get started.

There are 2 things you can do:
You can right-click your project root in the "Maven Projects" view and select the "Create XXX [install]..." option (where XXX is your project/module name. Then, in the subsequent dialog, specify clean install -U as the command line option. This will create a run configuration that invokes maven (you can name it "update" if you want). While it won't show up in the Maven view, it will be accessible from the normal run/debug configuration.
Alternatively, you can define a new profile in your pom that rebinds "install" to "clean install -U". You won't be able to rename it to "update" in the intelliJ ui, but you can at least ensure that both clean and install are run whenever someone runs the install goal.
Another way to do that is create a new run/debug Maven configuration. There you can specify the full command line arguments and a lot of other things.
Run\Edit configurations...
Select + (to create a new one)\Maven
If You have created maven profiles in your pom.xml, you should be able to see the profiles in right side of Intellij Idea

If there will be multiple profile you can activate one by default
<activation>
<activeByDefault>true</activeByDefault>
</activation>
Or for running specific profile we can select mvn install -Pbuild-profile
You can assign specific profiles via the dialog "Edit Run Configurations". See this screenshot:

AFAIK, this profile setting overrides the choice which you select in the maven view of IntelliJ.




