Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Configure SonarQube in my workspace
Hello,
I am working with Liferay DXP and I would like integrate SonarQube in my workspace, I am using gradle.
My workspace is called: test-workpace
My gradle.properies file (path: test-workspace/gradle.properties) is:
My build.gradle file (path: test-workspace/build.gradle) is:
When I execute gradle sonarqube all workspace is scanned but I would like to configure each modules like a project in SonarQube.
Someone know how to configure gradle files to do it?.
Thank you very much!
I am working with Liferay DXP and I would like integrate SonarQube in my workspace, I am using gradle.
My workspace is called: test-workpace
My gradle.properies file (path: test-workspace/gradle.properties) is:
systemProp.sonar.host.url=http://localhost:9000
systemProp.sonar.sourceEncoding=UTF-8
systemProp.sonar.forceAuthentication=true
systemProp.sonar.login=<mytoken>
# Definición de variables para el proyecto.
description = 'Gradle - Sample Project'
group = 'com.test.sonarqube.gradle'
version = '1.0.0'</mytoken>My build.gradle file (path: test-workspace/build.gradle) is:
buildscript {
repositories {
mavenLocal()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath group: "org.sonarsource.scanner.gradle", name:"sonarqube-gradle-plugin", version:"2.5"
}
}
group = 'com.test.sonarqube.gradle'
apply plugin: "org.sonarqube"
When I execute gradle sonarqube all workspace is scanned but I would like to configure each modules like a project in SonarQube.
Someone know how to configure gradle files to do it?.
Thank you very much!
Hi,
i think configuration of following properties in each project may solve your issue.
sonar.projectKey [${project.group}:]${project.name} for root module
<root module key>:<module path> for submodules
sonar.projectName ${project.name}
Regards
i think configuration of following properties in each project may solve your issue.
sonar.projectKey [${project.group}:]${project.name} for root module
<root module key>:<module path> for submodules
sonar.projectName ${project.name}
Regards
Thanks Sushil, that worked.
Hi Vishal,
Can you please provide you gradle file Facing same issue
Can you please provide you gradle file Facing same issue
Hello,
I know it's an old topic but if that helps you can just run it like:
Best regards and hope that helpsRafał Pydyniak
I know it's an old topic but if that helps you can just run it like:
./gradlew sonarqube \
-Dsonar.projectKey=test2 \
-Dsonar.host.url=http://localhost:9000 \
-Dsonar.login=115ee4c271411c118e7935ee705bdebcdf714b4ayou just need to provide your projectKey, url of your SonarQube and your token as login (the one you generated when you created a project - if you don't have it you can always generate it again in your account settings in security tab)The only thing you need for that is to have sonarqube plugin in build.gradleplugins {
id "org.sonarqube" version "2.7"
}I used to use that (before Jenkins) and that worked but I've only tested in on particular modules not the whole project (just because we wanted to have few SonarQube projects for one workspace because we have quite a lot modules).If perhaps you wanted to use Jenkins instead you can check this SonarQube with Jenkins and Liferay integration tutorialBest regards and hope that helpsRafał Pydyniak