java 空 GroupID 声纳日食

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5654749/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 12:06:53  来源:igfitidea点击:

Empty GroupID sonar eclipse

javamavensonarqube

提问by Eduardo

I'm using Maven And Sonar with eclipse. I already have my maven projects on LocalHost 9000. But when i go to eclipse configure>associate with sonar says that my groupId is empty. I think thats not supposed to happen. Anybody know how to fix this? Thanks

我在 Eclipse 中使用 Maven 和声纳。我已经在 LocalHost 9000 上有我的 Maven 项目。但是当我去 eclipse configure>associate with sonar 时说我的 groupId 是空的。我认为那不应该发生。有谁知道如何解决这个问题?谢谢

回答by Mingjiang Shi

I encountered the same issue, the tricks here are:

我遇到了同样的问题,这里的技巧是:

  1. The key of the sonar project must follow the naming convention, [groupid]:[artifactid]. They are separated by a ":". For example, if the key com.example:sample, then the groupid is com.example, artifactid is sample.
  2. The eclipse project name must be same as the artifactid (case-sensitive).
  1. sonar工程的key必须遵循命名约定,[groupid]:[artifactid]。它们以“:”分隔。例如,如果键为com.example:sample,则 groupid 为com.example, artifactid 为sample
  2. eclipse 项目名称必须与 artifactid 相同(区分大小写)。

So, you need to 1) change the sonar project key to the naming convention above, 2) change the eclipse project name to the artifactid. Then eclipse will be able to automatically link your eclipse project to sonar project when your click the button "Find on server".

因此,您需要1)将声纳项目密钥更改为上面的命名约定,2)将eclipse项目名称更改为artifactid。然后,当您单击“在服务器上查找”按钮时,eclipse 将能够自动将您的 eclipse 项目链接到声纳项目。

回答by CoolBeans

Few things to check:-

需要检查的几件事:-

  1. Check the groupIdis actually there in your pom.xml.
  2. Check that the artifactIdand the eclipse project name are the same.
  3. Check that you typed groupIdand artifactIdin the associate with sonardialog window. Then click find on server.
  4. Also make sure that the sonar plugin is set up on your eclipse (by going to Windows->Preferences->Sonar).
  1. 检查groupId您的pom.xml.
  2. 检查artifactId和 eclipse 项目名称是否相同。
  3. 检查您是否在对话窗口中输入了groupId和。然后点击。artifactIdassociate with sonarfind on server
  4. 还要确保在 Eclipse 上设置了声纳插件(通过转到Windows->Preferences->Sonar)。

HTH.

哈。

回答by leenasn

It got fixed by following the instructions mentioned here

按照此处提到的说明进行修复

回答by Brian Pipa

I hit the same problem in my setup with Jenkins running Ant and sending the data to Sonar. I had to add in projectKey=com.mycompany:projectNameInEclipse either to the sonar properties or into the Project properties for Sonar in Jenkins. (I had projectKey=projectname which won't work)

我在我的设置中遇到了同样的问题,Jenkins 运行 Ant 并将数据发送到声纳。我必须将 projectKey=com.mycompany:projectNameInEclipse 添加到声纳属性或 Jenkins 中声纳的项目属性中。(我有 projectKey=projectname 这不起作用)

Update: by doing this way, it created a new project in Sonar with the same name but with the new key. The proper way to do it is to change the sonar property as above then configure the project in Sonar (Configuration->Update Key) and set that to the proper key. Now when you run the analysis the new run will go into the old Sonar project (with the new key).

更新:通过这种方式,它在声纳中创建了一个具有相同名称但具有新密钥的新项目。正确的方法是更改​​声纳属性,然后在声纳(配置->更新密钥)中配置项目并将其设置为正确的密钥。现在,当您运行分析时,新运行将进入旧声纳项目(使用新密钥)。