简体   繁体   中英

IntelliJ & Maven - mvn command not found

I'm trying to build a drop wizard project created with IntelliJ. when I run

mvn package

I get

bash: mvn: command not found

I'm on a Mac and I'm following this tutorial: http://www.dropwizard.io/0.9.2/docs/getting-started.html

According to IntelliJ documentation ( https://www.jetbrains.com/help/idea/2016.1/maven.html?origin=old_help )

Maven integration is shipped with IntelliJ IDEA, and you do not need to perform any additional actions to install it. You can start using it straight away for importing Maven projects, working with them and for running Maven goals.

So I don't know what I'm suppose to do in order to use the command line Any idea?

Thanks

In IntelliJ, on the right hand side, click "Maven", and expand "Lifecycle" Select "Package" and click "Run" (green arrow).

在此输入图像描述

mvn is the command line tool for Maven. See https://maven.apache.org/install.html for details on how to install it. Or as you are using a Mac if you use brew try using it to install the maven formula.

If you have maven properly installed and you want to configure intelliJ terminal with a custom Terminal or if you want fix "command not found", follow these steps:

  1. Click > File
  2. Click > Settings
  3. Click > Tools
  4. Click > Terminal
  5. Edit "Shell path" @ "Application Settings", if you use git bash change current path with: C:\Users\Work\AppData\Local\Programs\Git\bin\sh.exe --login

// The path you may have differs based on your OS, in example: "installationPath\Terminal Folder\bin\sh.exe --login"

  1. Click > Apply
  2. Click > Ok

I used git bash but technically it should work with every terminal. Do not forget to add --login after the *.exe

If it still doesn't work maybe you need to check:

  1. Click > Environment variables
  2. Click > System Properties
  3. Click > Environment Variables
  4. Click > System Variables
  5. Select > Path from the list
  6. Click > Edit
  7. Click > New

Insert the path of your maven bin folder, in example:

  • "installationPath\apache-maven-3.8.6\bin"

Also insert the path of your jdk, in example:

  • "installationPath\Java\jdk-18.0.1.1"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM