Build Jenkins Sonar-ruby-plugin - ruby

I am trying to build sonar-ruby-plugin for jenkins i.e, to create a .hpi file every time I run the command:
mvn package
it creates a target folder but there is no .hpi file.
https://github.com/GoDaddy-Hosting/ruby-sonar-plugin

This is a plugin for SonarQube server, not Jenkins.
You should:
build the plugin by mvn package
copy to SONARQUBE_HOME/extensions/plugins directory
restart SonarQube
run analysis (you can execute SonarQube in Jenkins; read more on SonarQube wiki)

Related

SonarQube analysis from maven and Jenkins have different results

I am using SonarQube version 6.7 for running analysis of Maven projects using the command mvn clean verify sonar:sonar from the project directory using command prompt and get the results. The sonar configurations in settings.xml for maven (v3.5.3) are added respectively.
In Jenkins (version 2.161), I have installed SonarQube Scanner for Jenkins (v2.8.1) plugin. The SonarQube Server configuration is configured as below.
In the Jenkins maven project, I have configured the post steps as below.
I have checked the Prepare SonarQube Scanner environment in the Build Environment section and the Build goal is -e clean verify sonar:sonar.
My issue is, when the SonarQube analysis for a maven project is triggered through command prompt using the command mvn clean verify sonar:sonar, I am getting the results as expected. But when the Jenkins job is triggered with the configurations above for the same maven project, the results are different and incorrect. What am I missing?
P.S- In the Post-build Actions, I can see the SonarQube analysis with maven is deprecated.
Thanks in advance.
You use different scanners. First you used SonarScanner for Maven (mvn sonar:sonar). Next you used Basi SonarScanner, which requires manual configuration of all options.
The best option to sole it is always use the same scanner. You have Maven project, so you can enable Prepare SonarQube Scanner environment in Build Environment, and next execute Sonar goal $SONAR_MAVEN_GOAL in Build.

sonar qube on jenkins pipeline

How can I make that sonnar qube server analyze a mvn project on jenkins?. I have a pipeline project from CSM with a jenkinfile which point to a groovy file where all steps of the job are executed. All steps are working ok (mvn test, mvn package, mvn compile, etc), but donĀ“t know how to execute the mvn sonar:sonar. It gives following error.Image show how do I have sonar configured in jenkins and the job step where it fails.
And this is how I have the step described in groovy file of pipeline:
stage ('SonarQube analysis') {
withSonarQubeEnv('https://sonarqube.xxxxx.com') {
sh 'mvn sonar:sonar'
}
}
Try using the server installation name in withSonarQubeEnv, right now you are using URL i.e. withSonarQubeEnv('Grey Azure Sonarqube').
Documentation

Jenkins + Maven - How to execute shell script before release:perform cleans the project

I have a Maven project that generates a zip file with maven-assembly-plugin on mvn package
MyProy
|--pom
|--src/...
|--target
|---MyProy-something-1.0.0-SNAPSHOT-zip (contains /1.0.0-SNAPSHOT/...)
I created a Jenkins job and configured a shell script execution as a post step. This script copies the zip to a folder (/something) and unzips it
|-/something
|---1.0.0-SNAPSHOT
|---...
This works fine for builds. However I want to do the same when I launch a release. I installed Jenkins release plugin and in "configure release build" I added this tasks:
Before release build -> Maven task mvn release:prepare
After successful release build -> Maven task mvn release:perform
After successful release build -> Execute shell script - Copy zip and unzip.
I see the mvn release:perform execute correctly, for instance with version 1.0.0 but the problem is that when the script (3.) is launched it applies to the next development version (1.0.1-SNAPSHOT) instead of the release version (1.0.0).
This is how I managed to work around the problem:
Before release build
mvn release:prepare
After successful release build
mvn release:perform
mvc scm:checkout -DscmVersion=${releaseVersion} -DscmVersionType=tag
-f ${WORKSPACE}/target/checkout clean install
Execute shell script with copy and unzip
To sum up, after the release:perform I checkout the brand new tag, execute a clean install in the location of the downloaded tag and finally I execute the script that copies the zip and unzipes it.

running maven sonar from unix

I have a mvn project. I want to run it against sonar.
e.g. the following command - mvn org.codehaus.mojo:sonar-maven-plugin:2.0:sonar
Without going in and modifying the application pom file to add sonar plugin, is there another way that I can call the mvn command and reference sonar plugin ?
I don't know how it works, but if you execute it from Jenkins with the Sonar plugin it will work without modifying your pom.xml.

maven error while running sonar from jenkins job

I am trying to implement Sonar in Jenkins CI using maven build tool.I am using Linux machine to build maven with Sonar.
maven is successfully installed. I have tried to configure maven path in Jenkins Configuration,
maven is installed .
whenever I run the job getting below error.
java.io.IOException: Cannot run program "mvn" (in directory
\"/directorypath"): java.io.IOException: error=2, No such file or directory""
as I understood from error that its unable to find out maven in Job directory. what configuration should needed so job can take by default maven path where is installed.
I have searched lot on internet, but could not helped.
Try without mvn in the commands
Eg clean install package

Resources