The MVN command cannot be found under Zsh
If Maven is configured, you must execute source ~ /.Bash every time the terminal executes the MVN command_ Profile to take effect. This is because when Zsh is installed on the Mac,. The configuration of the Bash_profile file cannot take effect. The solution is:
vi ~/.zshrc
Add the following command at the end of the file:
source ~/.bash_profile
then
esc :wq
Update document:
source ~/.zshrc
In this way, when Zsh starts, it will read. Bash_ The contents of the profile file and make it effective
configure Maven environment variables under Zsh
there are three places on the MAC where you can set environment variables:
/Etc/Profile: system global variable, which loads the configuration of the file upon system startup (not recommended)
/etc/bashrc: all types of bash shells will read the configuration of the file
~ /.Bash_Profile: configure user level environment variables and create them in the system user folder. When a user logs in, the file will be executed only once
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
export PATH=${PATH}:/usr/local/mysql/bin
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:/usr/local/maven/apache-maven-3.5.0/bin
export CATALINA_HOME=/usr/local/tomcat/apache-tomcat-7.0.77
export PATH=$PATH:/CATALINA_HOME/bin
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
Then experiment
mvn -v
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /Users/yaoyonghao/Documents/software/apache-maven-3.8.4
Java version: 1.8.0_212, vendor: Oracle Corporation, runtime: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"
Read More:
- Executing Maven command error: Java_HOME is not defined correctly executing maven
- easy-pdf-merge Error: java: command not found [How to Solve]
- Springboot startup error: err config is disabled command (Redis Disables Config command)
- [Solved] Command line is too long. Shorten command line for XXXXXXXTest.rmLogRecordOver Error running
- Project Startup Error: Error running ‘xxxApplication‘;Command line is too long, Shoerten command line for……..
- [Solved] Error: Blocked mirror for repositories maven intellij Mac
- [Solved] error running ‘xx‘ Command line is too long shorten command line for xx or also for Spring Boot defa
- [Solved] Error running ‘ServiceStarter’: Command line is too long. Shorten command line for ServiceStarter or also for Application default configuration
- [Solved] IDEA Start Project Error: Error running ‘xxxxxx‘: Command line is too long. Shorten command line for …..
- Maven (http://repo1.maven.org/maven2/): Failed to transfer file and PKIX path building failed: sun.secu
- IDEA Package Error: No valid Maven installation found.
- [Solved] Spring Boot Package Error: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0
- [Solved] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:analyze-only
- MVN compile Error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin…
- Maven error: Could not find artifact jdk.tools [How to Solve]
- [Solved] O2oa compile error: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin
- [Solved] Maven Publish Error: Failed to execute goal org.apache.maven.pluginsmaven-deploy-plugin2.8.2deploy
- [Solved] Error:Maven Resources Compiler: Maven project configuration required for module ‘XX‘ isn‘t available
- IDEA Create Web Project with maven Error: The desired archetype does not exista…
- [Solved] MVN Build Project Error: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test