Maven project with typescript coverage reports

  • ALM used GitHub
  • CI system used Jenkins CI
  • Scanner command used:
    mvn sonar:sonar -Dsonar.projectKey=***** -Dsonar.organization=eclipse -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=********* -Dsonar.branch.name=***********"
  • Languages of the repository Java, Typscript
  • The URL https://sonarcloud.io/dashboard?id=eclipse_che-che4z-lsp-for-cobol

Hello,

I’m trying to find a way to run standalone sonar scanner so it would import the configuration from maven, and also read jest reports and typescript source files

we included a typescript module in out project and we need to migrate off of the maven sonar scanner that we have, but I don’t want to lose the configurations we’ve put in our pom files, and reuse them in the standalone sonar scanner if possible

but all I can find is maven sonar scanner related information, I can’t find the standalone information that would do what we need.

if someone can point me in the right direction, that would be highly appreciated.

Hello @abdrabrcom,

As I understand correctly you want to analyze both Java code built with Maven, and typescript code.

The easiest way to do this would be to keep using the Maven scanner, and to set the sources of the Typescript code. Is this an option for you?

If your Typescript module has a pom.xml you can set

<properties>
    <sonar.sources>src</sonar.sources>
</properties>

If your Typescript module does not include a pom.xml you can include the sources with the -Dsonar.sources=relative/path/to/tsmodule parameter.

Hi Tom,

Thanks for the quick reply, I’m not sure if it’s possible, the maven project’s directory is 1 level under the root project directory
and so is the typescript directory

root
|—typescript
|—Maven

would it be possible to go one level up in the relative directory and reference the typescript directory?

Hi @abdrabrcom,

In that case I don’t think my proposed solution would work.

The other option would be to run the maven build without the scanner, and the then analyze the code-base with the standalone scanner. This will require you to specify all the sources of the compiled java files manually though. I realise that is not what you are after.

We have a feature on the roadmap where you are able to have multiple SonarCloud projects for one repository. In that scenarioyou could have two different projects (TS and Maven), which could both use their own scanner. Would that fit your usecase?

in that case yes that would be very useful, as each module would have an automated configuration file that would show where the sources, tests, and exclusions are

I’m trying to avoid doing things manually for now yes, but seems like it’s the only option, aside from creating another repository for the typescript module

You can follow this ticket to see the progress made on this feature.