1
votes

I used the Maven archetype maven-archetype-quickstart at the command-line to generate a new project. I imported that project into IntelliJ 2017.1.

  • How do I run the app?
  • How to debug the app?

The green triangle button to run the app is disabled.

I opened the panel listing Maven lifecycle and plugins. But I do not see any action for running the app.

enter image description here

1
Try Ctrl + Shift + F10, Also make sure you've configured JDK What exact problem are you facing while Running the application? - Pratik Ambani
@PratikAmbani With more complicated Maven archetypes, I have seen a Maven plugin executed to run the app. But in this simple archetype, I see no way to run the app. As you can see in this screenshot, the green triangle button is disabled (as I indicated in my Question). - Basil Bourque
@BasilBourque, in order to run the application (do you mean build?), you can use the Maven-(vertical)tab on to your right within IntelliJ. Look at the Lifecycle-tab. Note that you might have to click the view-toggle button in the lower-left corner in order for it to pop up. - vegaasen
@vegaasen That Maven panel you mention is exactly what I already showed in the screenshot in my Question. Which of the items shown do you suggest I use to run the app? - Basil Bourque

1 Answers

2
votes

When running the application itself, within IntelliJ, you will have to open the App.java-file in order to run it. From there, right-click and select Run within the static main()-method. In the same context-menu, you also have to option to select Debug.

Running the application from Maven is however not possible based on the archtype. Maven may rather help you package the entire thing. However, executing the jar-file post-build is quite simple - as explained in the documentation found here:

https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App