SonarQube with CUBA projects

Hi all,

I was wondering if anyone has got SonarQube working with a CUBA project?

I have it working on a very basic project but anything more fancy and I’m having issues. Also seem to have issues with the Premium addons.

Thanks.

Hi,

i think it is not directly related to CUBA. It is just a gradle multi module project.

So perhaps this helps you: Sonar and Gradle Multi-Module Projects - DZone
[SONARGRADL-5] - Jira
GitHub - SonarSource/sonar-scanner-gradle: SonarQube Scanner for Gradle

Bye
Mario

Hi Mario

Thanks for that. I’ve been following a number of articles but no success with the Premium addons in the project.

This is the error. It isn’t happy getting the premium addons from their repository.

image

No success yet.

this seems to be a credentials problem. Do you have configured the credentials for the premium repo?

Yeah that is what I was thinking. They are there and the project works fine. I’m new to SonarQube and was wondering if anyone else ran in to this issue with the credentials.

Did you try it without premium addons?

Yep that seems to work fine

can you share the build.gradle to see how you configured the maven repo?

Sure. Here you go

build.gradle (5.9 KB)

Interestingly when I import the project in to intelliJ instead of opening via Studio I get the following

image

Maybe it is a more general issue with the build.gradle and not a SonarQube setting

Mario,

I’m on a Mac but where should CUBA_PREMIUM_USER and CUBA_PREMIUM_PASSWORD come from. I assuming printenv should show these settings?

maven {
    url 'https://repo.cuba-platform.com/content/groups/premium'
    credentials {
        username(rootProject.hasProperty('premiumRepoUser') ? rootProject['premiumRepoUser'] : System.getenv('CUBA_PREMIUM_USER'))
        password(rootProject.hasProperty('premiumRepoPass') ? rootProject['premiumRepoPass'] : System.getenv('CUBA_PREMIUM_PASSWORD'))
    }
}

Mario

I worked it out. We were right it was the credentials. Odd thing is the projects I have worked on all run fine, but I now don’t know why.

I had to add in the CUBA_PREMIUM_USER and CUBA_PREMIUM_PASSWORD as environment variables and reboot. This got the build.gradle to work and SonarQube has started working too.

I usually build from Studio so perhaps it it doing something differ. hmmm

Thanks for your help

Hi,

Also, you could simply define these properties in gradle.properties : Configuring Access to Repository - CUBA Platform. Developer’s Manual

@artamonov

Thanks for that info.

Can you explain why my project were working without those settings in place if I was using the premium components?

Studio passes credentials to Gradle automatically. Settings are required only for command line or CI.

1 Like