Request assistance in configuring Maven for sonar scanning with SonarQube server which is hosted in another system behind corporate proxy

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

Dear all,
Request assistance on what other configurations needs to be added in pom.xml in Maven project so that i can connect to sonarqube server which is running in different IP inside corporate proxy

SonarQube version: 8.1.0.31237
Sonar scanner version: 4.5.0.2216

I’ve added the following dependency:

org.sonarsource.scanner.maven
sonar-maven-plugin
3.7.0.1746

I’ve added the following profile:

<profiles>
	<profile>
		<id>sonar</id>
		<activation>
			<activeByDefault>true</activeByDefault>
		</activation>
		<properties>
			<!-- Optional URL to server. Default value is http://localhost:9000 -->
			<sonar.host.url>http://localhost:9000</sonar.host.url>
			<sonar.projectVersion>1.0</sonar.projectVersion>
		</properties>
	</profile>
</profiles>

If I run sonarqube server in localhost and run the Maven project, sonar scanner is successful. But if i try to give the Sonar host url which is behind corporate proxy, the scanning doesn’t happens. Logs gets stuck in:

Logs:
User cache: C:\Users\XXXX.sonar\cache

After this there is no response in logs , no failures as well. Kindly help

Thanks and Regards
Sumit Saha

Hi @Sumit_Saha,

Welcome to the community.

But if i try to give the Sonar host url which is behind corporate proxy, the scanning doesn’t happens. Logs gets stuck in:

Do you configure Maven to use your company proxy? Details are available here https://maven.apache.org/guides/mini/guide-proxies.html

Could it be that a company firewall is also between the system running the scanner and the SonarQube instance? I ask because you mention that the scan run gets stuck without any output. This sounds to me like the web requests to SonarQube are being dropped or otherwise ignored without resulting in a response to the scanner. This could be caused by a firewall.

One thing you could also try, is running the scan in debug mode (Maven option -X) and share the build logs here.

1 Like

Thanks Mark,

Yes the issue was related to firewall. Now its resolved. Thanks for the assistance :slight_smile:

Thanks and Regards
Sumit Saha

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.