I’m trying to configure my Maven project for SonarCloud use in GitHub actions.
I have such errors when building on GitHub actions:
Error: SonarQube server [http://localhost:9000 ] can not be reached
Error: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project goods-partner: Unable to execute SonarScanner analysis: Fail to get bootstrap index from server: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:9000: Connection refused → [Help 1]
What could bed the reason of failure? why does it looks for http://localhost:9000 though I configured https://sonarcloud.io (see below)?
Here is sonar-cloud.yml:
name: Build
on:
push:
branches:
- 76-sonarcloud-integration
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
And here is pom.xml piece:
<sonar.organization>some-text-here</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.projectKey>some-text-here</sonar.projectKey>
1 Like
Colin
(Colin)
August 23, 2022, 8:52am
2
Are you sure you’ve set the configuration in your root pom.xml , and not one of the subprojects?
1 Like
Hi Colin!
Yo`re right. Now this moved to parent pom.xml:
<sonar.organization>some-text-here</sonar.organization>
<sonar.host.url>https://sonarcloud.io </sonar.host.url>
<sonar.projectKey>some-text-here</sonar.projectKey>
But another error occurs:
1 Like
Joe
(Joe)
August 23, 2022, 5:01pm
4
Please check if these other posts can resolve your issue. You are most likely encountering a problem with how you are defining Sonar analysis parameters of your multimodule project (as defined by the cleanAllWorkingDirs
method calls):
I’m getting this error when running mvn clean verify sonar:sonar:
Exception in thread "main" java.lang.StackOverflowError
at org.sonar.api.batch.fs.internal.DefaultInputComponent.equals(DefaultInputComponent.java:48)
at com.google.common.collect.SingletonImmutableBiMap.get(SingletonImmutableBiMap.java:56)
at com.google.common.collect.ImmutableListMultimap.get(ImmutableListMultimap.java:285)
at com.google.common.collect.ImmutableListMultimap.get(ImmutableListMultimap.java:55)
at org.sonar.s…
Hi,
I am trying to configure sonarcloud but I get a java.lang.StackOverflowError if I use a multi-module Java maven project.
Repository: github
CI: Github actions
Language Java
Error log in github action executed when doing a pull request:
Exception in thread "main" java.lang.StackOverflowError
at org.sonar.api.batch.fs.internal.DefaultInputComponent.hashCode(DefaultInputComponent.java:43)
at java.base/java.util.HashMap.hash(HashMap.java:339)
at java.base/java.util.HashMap.getOrDefault(Ha…
I am running a SonarScan on a maven project using the maven plugin (SonarQube 9.4.0.54424). I just added a module to the project (previously it was not a multi-module project). Now, when I run the scan, I get a StackOverflowException which seems to be due to a recursion problem.
Can you please help me figure out what could be causing the stack overflow error and how to get around it?
In the parent-pom, I have the following properties:
<sonar-maven-plugin.version>3.9.1.2184</sonar-ma…
Trying to setup my multi-module project (AWS Serveless generated by IntelliJ) to run.
This is running on a MacBook pro - Java8 and Maven 3.6.1
When running the following command in the project root, it works 100%
mvn sonar:sonar
-Dsonar.projectKey=pkey
-Dsonar.host.url=http://xyz.xyz.xyz.xyz:9000
-Dsonar.login=genrated-key
However, when I set these three properties in the pom.xml it fails with a StackOverflow exception in the following class:
org.sonar.scanner.scan.WorkDirectoriesInit…
1 Like
This helped to solve my StackOverFlowError:
I figured it out after attaching my debugger. I have a multi-module Maven project, and in the root POM I had set the property <sonar.projectKey>foo</sonar.projectKey>, which then propagated into the sub-modules, of course. When WorkDirectoriesInitializer.cleanAllWorkingDirs went to recurse through the project, it calculated a key for each module, but it did this by reading the sonar.projectKey property. Because this had the same value for every module, the recursion never completed and the stack…
So I added <sonar.moduleKey>${project.artifactId}</sonar.moduleKey> to the root POM
Thank`s a lot for help!
2 Likes
system
(system)
Closed
August 30, 2022, 8:13pm
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.