I am new to gradle and loaded an existing Java project with gradle. I can use:
./gradlew build
./gradlew run
to build and run the application successfully without a problem, but I can't run it in IntelliJ by right-click the Java file with the 'main' method, because when I right click the file, it doesn't show me anything like 'run as Java application'. And as a test, I want to create a "Hello World" java application (a java file) under the same project, but I can't do that, because when I click 'new' in IntelliJ, it doesn't give me any option of creating a Java class or package.
It seems like the IntelliJ doesn't recognize the project environment as java, so it can't do it. I used to use Maven.
The project has to be imported from the build.gradle
file. This way IntelliJ IDEA will configure all the source roots and the dependencies automatically.