Sonar-packaging-maven-plugin build problem

Hello, im writing a custom rule plugin to my company but im experiencing build problems.

This is my POM.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

	<!-- <parent> <groupId>votorantim.arqt.base</groupId> <artifactId>arqt-base-master</artifactId> 
		<version>1.1.0</version> </parent> -->

	<modelVersion>4.0.0</modelVersion>
	<groupId>br.com.votorantim</groupId>
	<artifactId>regras-sonar-plugin</artifactId>
	<version>1.0.12-SNAPSHOT</version>
	<packaging>sonar-plugin</packaging>

	<name>bv-sonar-arquitetura</name>
	<description>Regras de Java para SonarQube - Banco Votorantim</description>
	<inceptionYear>2020</inceptionYear>

	<properties>
		<sslr.version>1.23</sslr.version>
		<gson.version>2.6.2</gson.version>

		<sonar.version>7.9.1</sonar.version>
		<sonarjava.version>5.13.1.18282</sonarjava.version>
		<analyzer.commons.version>1.11.0.541</analyzer.commons.version>

		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

		<maven-release-plugin.version>3.0.0-M4</maven-release-plugin.version>
	</properties>

	<scm>
		<url></url>
		<connection>scm:git:ssh://bitbucket.bvnet.bv:7999/arqt-base/bv-sonar-regras-plugin.git</connection>
		<developerConnection>scm:git:ssh://bitbucket.bvnet.bv:7999/arqt-base/bv-sonar-regras-plugin.git</developerConnection>
		<tag>HEAD</tag>
	</scm>

	<!--<distributionManagement>
		<snapshotRepository>
			<id>nexus3-snapshots</id>
			<url>https://nexus.bvnet.bv/repository/maven-snapshots/</url>
		</snapshotRepository>
		<repository>
			<id>nexus3-releases</id>
			<url>https://nexus.bvnet.bv/repository/maven-releases/</url>
		</repository>
	</distributionManagement>-->

	<dependencies>

		<dependency>
			<groupId>org.sonarsource.sonarqube</groupId>
			<artifactId>sonar-plugin-api</artifactId>
			<version>${sonar.version}</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.sonarsource.java</groupId>
			<artifactId>sonar-java-plugin</artifactId>
			<type>sonar-plugin</type>
			<version>${sonarjava.version}</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.sonarsource.sslr-squid-bridge</groupId>
			<artifactId>sslr-squid-bridge</artifactId>
			<version>2.6.1</version>
			<exclusions>
				<exclusion>
					<groupId>org.codehaus.sonar.sslr</groupId>
					<artifactId>sslr-core</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.codehaus.sonar</groupId>
					<artifactId>sonar-plugin-api</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.codehaus.sonar.sslr</groupId>
					<artifactId>sslr-xpath</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.slf4j</groupId>
					<artifactId>jcl-over-slf4j</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-api</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.sonarsource.java</groupId>
			<artifactId>java-checks-testkit</artifactId>
			<version>${sonarjava.version}</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>com.google.code.gson</groupId>
			<artifactId>gson</artifactId>
			<version>${gson.version}</version>
		</dependency>

		<dependency>
			<groupId>org.sonarsource.sslr</groupId>
			<artifactId>sslr-testing-harness</artifactId>
			<version>${sslr.version}</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.sonarsource.analyzer-commons</groupId>
			<artifactId>sonar-xml-parsing</artifactId>
			<version>${analyzer.commons.version}</version>
		</dependency>

		<dependency>
			<groupId>org.sonarsource.analyzer-commons</groupId>
			<artifactId>sonar-analyzer-commons</artifactId>
			<version>${analyzer.commons.version}</version>
		</dependency>

		<dependency>
			<groupId>commons-lang</groupId>
			<artifactId>commons-lang</artifactId>
			<version>2.6</version>
		</dependency>

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.7.30</version>
		</dependency>

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.11</version>
			<scope>test</scope>
		</dependency>


		<dependency>
			<groupId>org.hamcrest</groupId>
			<artifactId>hamcrest-core</artifactId>
			<version>2.2</version>
			<scope>test</scope>
		</dependency>


		<dependency>
			<groupId>org.assertj</groupId>
			<artifactId>assertj-core</artifactId>
			<version>3.6.1</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-core</artifactId>
			<version>1.2.3</version>
		</dependency>

		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
			<version>1.2.3</version>
			<scope>test</scope>
		</dependency>

		<!--<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
			<version>26.0-jre</version>
		</dependency>-->

	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId>
				<artifactId>sonar-packaging-maven-plugin</artifactId>
				<version>1.18.0.372</version>
				<extensions>true</extensions>
				<configuration>
					<pluginKey>java</pluginKey>
					<pluginName>bv-sonar-arquitetura</pluginName>
					<pluginDescription>Regras da Arquitetura</pluginDescription>
					<pluginClass>br.com.votorantim.sonar.plugin.BVSonarRulesPlugin</pluginClass>
					<sonarLintSupported>true</sonarLintSupported>
					<sonarQubeMinVersion>7.9</sonarQubeMinVersion>
					<requirePlugins>java:${sonarjava.version}</requirePlugins>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.6.0</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>

			<!-- only required to run UT - these are UT dependencies -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>2.10</version><!--$NO-MVN-MAN-VER$ -->
				<executions>
					<execution>
					<?m2e execute onConfiguration?>
						<id>copy</id>
						<phase>test-compile</phase>
						<goals>
							<goal>copy</goal>
						</goals>
						<configuration>
							<artifactItems>
								<artifactItem>
									<groupId>org.apache.commons</groupId>
									<artifactId>commons-collections4</artifactId>
									<version>4.0</version>
									<type>jar</type>
								</artifactItem>
								<artifactItem>
									<groupId>javax</groupId>
									<artifactId>javaee-api</artifactId>
									<version>6.0</version>
								</artifactItem>
							</artifactItems>
							<outputDirectory>${project.build.directory}/test-jars</outputDirectory>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<!--<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-release-plugin</artifactId>
				<version>${maven-release-plugin.version}</version>
			</plugin>-->

		</plugins>
	</build>

</project>


And im getting this issue :

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building bv-sonar-arquitetura 1.0.12-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- sonar-packaging-maven-plugin:1.18.0.372:check (default-check) @ regras-sonar-plugin ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.936 s
[INFO] Finished at: 2022-04-12T12:25:25-03:00
[INFO] Final Memory: 10M/37M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.sonar-packaging-maven-plugin:sonar-packaging-maven-plugin:1.18.0.372:check (default-check) on project regras-sonar-plugin: Unable to parse configuration of mojo org.sonarsource.sonar-packaging-maven-plugin:sonar-packaging-maven-plugin:1.18.0.372:check for parameter pluginSourcesUrl: Cannot convert '' to URL: no protocol: -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginConfigurationException

Can someone help me please? I dont what to try anymore, i tried many different things like : changing pluginKey, changing some dependencies versions, changing the packaging way, etc.

PS: When i use “jar” as my packaging like :

<packaging>jar</packaging>

It builds, but i cant start sonar with my plugin and i get this message :

2022.04.12 12:06:33 ERROR web[][o.s.s.p.Platform] Web server startup failed: File is not a plugin. Please delete it and restart: C:\Users\primeup.msouza\OneDrive - Banco Votorantim S.A\Documentos\Ambiente de testes para sonar em componente de teste\sonarqube-7.9.6\extensions\plugins\regras-sonar-plugin-1.0.12-SNAPSHOT.jar

thanks a lot for your time and attention!

Hi,

Welcome to the community!

What do you make of the error you’re getting:

At a guess, I’d say it’s looking for a parameter you’re not providing…

 
HTH,
Ann

Hello G Ann, thanks for the replying. At first, thanks for the attention, i really appreciate you and sonar source.

I already made some custom rules plugins and i never had to set this PluginSourceURL, what am i supposed to set for this parameter?

1 Like

Hi, i got, i put in the parameter my company nexus maven central url and i could download all the required libraries

1 Like

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