Run Maven commands (other than "Lifecycle" goals) from within IntelliJ 2019

Viewed 1057

In IntelliJ 2019.3 Ultimate, I am working with a Maven-based project. I never installed Maven on my Mac. So I am using only the Maven bundled inside the IntelliJ app.

The Maven panel within IntelliJ displays several "Lifecycle" Maven goals such as clean and install. These work well. So this Question is not a duplicate of: How to execute mvn command using IntelliJ IDEA?.

I read about using other Maven commands such as this:

mvn dependency:tree | grep "guava"

This does work from my Apple Terminal.app with error since I have no Maven installed separately:

zsh: command not found: mvn

This does not work from the Terminal window within IntelliJ:

zsh: command not found: zsh:

➥ So how does one run other Maven commands such as mvn dependency using the Maven built into IntelliJ?

1 Answers

Click on the right most corner marked as Maven. Then click the m icon. I provide below the image.

After that, you can write Maven commands like mvn dependency:tree. That covers the Maven-specific part of your command example. The pipe to grep will not work here.

Besides, if you want you can use Maven wrapper just like Gradlew(Gradle warapper), in this case there is no need to install maven and you can build from the command prompt.

enter image description here

Related