运行IDEA自带maven错误

时间:2024-07-14 22:11:40

如何使用IDEA自带maven

参考:https://blog.****.net/sleetdream/article/details/122685104

vim ~/.bash_profile

输入

export IDEA_MAVEN=/Applications/IntelliJ\ IDEA.app/Contents/plugins/maven/lib/maven3
export PATH=$PATH:$IDEA_MAVEN/bin

更新

source ~/.bash_profile

备注:IDEA内使用,也需要source ~/.bash_profile

idea运行mvn报错:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project jrdw-domains: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

参考:https://blog.****.net/u014454538/article/details/126218249

查询jdk版本,确定有多个jdk

/usr/libexec/java_home -V

    1..8.371.11 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
    1.8.0_382 (x86_64) "Amazon" - "Amazon Corretto 8" /Users/xxx/Library/Java/JavaVirtualMachines/corretto-1.8.0_382/Contents/Home
    1.8.0_371 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home

在.bash_profile中不要使用第一个,使用包含JavaVirtualMachines的