声纳插件不工作的使用ANT作为构建脚本项目 [英] Sonar plugin not working for projects that use ANT as a build script

查看:194
本文介绍了声纳插件不工作的使用ANT作为构建脚本项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题

我刚安装了声纳詹金斯插件。我走进通过Ant构建生成一个WAR文件神器我的配置工作(自由风格的工作),并做如下:

I have just installed the Sonar Jenkins plugin. I went into my configured job (a free style job) that produces a WAR file artifact through an ANT build and did as follows:


  1. 检查声纳复选框。 (这里没有问题)

  1. Check the Sonar checkbox. (No problems here)

配置声纳的安装目录(这里没有问题)

Configure the install dir of sonar (No problems here)

经过,指出该复选框:检查这个项目是不是与Maven 2内置(我很困惑在这里)

Checked the checkbox that states: "Check if this project is NOT built with maven 2" (I am confused here)

我已签了框,因为我没有使用maven进行构建,我使用ANT,但它仍然要求我类似于很多必需的属性MVN如:组织ID,项目编号,项目名称,项目版本,源目录...等。

I have checked that box because I am not using maven for build, I am using ANT but it still asked me for required properties that resemble a lot MVN such as: Organization id, project id, project name, project version, source directories... etc..

所以我写满了那些为好。当我点击播放按钮现在打造构建似乎运行良好,因为它总是前声纳安装过,但在失败快结束的,因为它试图执行MAVEN。

So I have filled those as well. When I click the play button "Build Now" the build seems to be running fine as it always had prior to sonar installation but it fails at the very end because its trying to execute MAVEN.

请参阅如下:

$ MVN -f /root/.jenkins/jobs/HRDA/workspace/pom.xml -e -B声纳:声纳
FATAL:命令执行失败
java.io.IOException异常:不能运行程序MVN(目录/root/.jenkins/jobs/HRDA/workspace):java.io.IOException异常:错误= 2,没有这样的文件或目录

问题


  1. 为什么声纳试图执行的Maven如果我检查了说如果你选中此复选框复选框不会使用Maven 2?

我可以利用这个声纳插件,如果我的应用已与ANT建成,GANT,摇篮?

Can I make use of this Sonar plugin if my apps are built with ANT, GANT, GRADLE?

我必须再改我的应用程序使用MVN建立?

Do I have to reconvert my apps to use MVN builds?

谢谢,
- 达里奥

Thanks, - Dario

推荐答案

就像OERS对我的问题的意见建议,如果你正在使用ANT作为你的CI服务器(詹金斯在我的情况)构建脚本,你将不得不使用SONAR -ant任务生成声纳报告,请执行以下操作:

Like Oers suggested on my question comments if you are using ANT as a build script in your CI server (Jenkins in my case) you will have to use the SONAR-ANT-TASK to generate Sonar reports, do as follows:


  1. 下载MySQL或任何其他声纳支持的RDBMS如Postgres的,甲骨文等。

  2. 下载和安装声纳服务器。

  3. 去(声纳安装文件夹)/演员/数据库/ mysql和运行create_database.sql脚本。

  4. 我不得不使用MySQL,你可以在这里看到跑在我的情况下,一个额外的sql语句<一个href=\"http://stackoverflow.com/questions/7247945/unable-to-access-sonar-mysql-database-caused-by-java-sql-sqlexception-access-de/7258582#7258582\">Unable访问声呐MySQL数据库产生的原因:java.sql.SQLException中:拒绝访问用户sonar'@'glassfishdev.ccs.local'(使用密码:YES)

  5. 开始声纳键入./sonar.sh启动

  6. 声纳Ant任务添加到您的构建脚本。你可以按照这个模板 HTTP://docs.codehaus.org /显示/ SONAR /分析与+ + ANT +任务+ 1.0

  7. 不要查看声纳复选框,在你的屏幕配置,如果你有哈德逊声纳插件安装,因为这个插件只与Maven项目工作。

  8. 单击立即生成按钮。如果一切上面已经做得正确,你应该能够看到在 HTTP的报告:// ipaddressofmachinesonarisinstalled:9000 /

  1. Download MySQL or any other Sonar supported RDBMS such as Postgres, Oracle, etc..'
  2. Download and Install sonar server.
  3. go to (sonar installation folder)/extras/database/mysql and run the create_database.sql script.
  4. I had to run an extra sql statement in my case using mysql, you can see here Unable to access Sonar MySQL database Caused by: java.sql.SQLException: Access denied for user 'sonar'@'glassfishdev.ccs.local' (using password: YES)
  5. Start Sonar by typing ./sonar.sh start
  6. Add the sonar ant task to your build script. You can follow this template http://docs.codehaus.org/display/SONAR/Analyse+with+Ant+Task+1.0
  7. DO NOT check the sonar check box in your Configure screen if you have the Hudson Sonar plugin for installed, as this plugin only works with Maven projects.
  8. Click the "Build Now" button. If everything above has been done correctly you should be able to see the reports at http://ipaddressofmachinesonarisinstalled:9000/

希望这有助于
-Dario

Hope this helps, -Dario

这篇关于声纳插件不工作的使用ANT作为构建脚本项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆