SonarQube Local Script in IntelliJ can#39;t find mvn (IOException/No such directory)(IntelliJ 中的 SonarQube 本地脚本找不到 mvn(IOException/No such directory))
问题描述
我的 maven 构建在 IntelliJ IDEA 中运行良好.这不是问题.该问题与 SonarQube 社区插件有关.
My maven build works fine in IntelliJ IDEA. That is not the issue. The issue is relating to SonarQube Community Plugin.
ERROR 17:08:38.358 > java.io.IOException: Cannot run program "mvn" (in directory "/Users/chrismanning/Projects/Registry/registry/idea-files"): error=2, No such file or directory
本地分析脚本:
mvn sonar:sonar
-DskipTests=true
-Dsonar.analysis.mode=issues
-Dsonar.scm.enabled=false
-Dsonar.scm-stats.enabled=false
-Dissueassignplugin.enabled=false
-Dsonar.preview.excludePlugins=emailnotifications,issueassign
-Dsonar.report.export.path=sonar-report.json
我肯定已经安装了 maven 并且在我的路径中.(它在/usr/local/bin 中符号链接)
I definitely have maven installed and in my path. (it's symlinked in /usr/local/bin)
chrismanning@Chriss-MacBook-Pro:~/Projects/Registry/registry/idea-files$ mvn -version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T12:29:23-05:00)
Maven home: /Users/chrismanning/apache-maven-3.2.5
Java version: 1.8.0_40, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.3", arch: "x86_64", family: "mac"
M2_HOME 和 PATH 在/etc/launchd.conf 中正确定义
M2_HOME and PATH are propely defined in /etc/launchd.conf
推荐答案
如果你正在使用 Yosemite(像我一样)你必须这样设置环境变量
在 ~/Library/LaunchAgents/environment.plist 创建新文件
Create new file at ~/Library/LaunchAgents/environment.plist
添加此代码块并修改以适当设置您的环境变量
Add this code block and modify to appropriately set your environmental variables
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>my.startup</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>
launchctl setenv JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
launchctl setenv M2_HOME /Users/chrismanning/apache-maven-3.2.5
</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
保存并重新启动计算机.这是加载优胜美地环境变量的正确方法
Save and restart your computer. This is the proper way to load Yosemite environmental variables
如果您使用的是旧版 Mac OS X,请查看此答案
在 OS X 中设置环境变量?
这篇关于IntelliJ 中的 SonarQube 本地脚本找不到 mvn(IOException/No such directory)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:IntelliJ 中的 SonarQube 本地脚本找不到 mvn(IOException/No such directory)
基础教程推荐
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- 降序排序:Java Map 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01