gabrie-allaigre / sonar-gitlab-plugin

Add to each commit GitLab in a global commentary on the new anomalies added by this commit and add comment lines of modified files
GNU Lesser General Public License v3.0
712 stars 207 forks source link

Plugin class not found: 'com.talanlabs.sonar.plugins.gitlab.GitLabPlugin #255

Closed LiewJK closed 4 years ago

LiewJK commented 4 years ago

Hi all, I'm beginner with SonarQube and GitLab. May I know what's the causes of this error?

[ERROR] Failed to execute goal org.sonarsource.sonar-packaging-maven-plugin:sonar-packaging-maven-plugin:1.18.0.372:sonar-plugin (default-sonar-plugin) on project sonar-gitlab-plugin: Plugin class not found: 'com.talanlabs.sonar.plugins.gitlab.GitLabPlugin -> [Help 1] [ERROR]

I've been working around it for few hours and it just can't be fixed. I have been looking through the issues page, but just no one is facing it. Hope anyone of you could provide relevant solution or advice to me. Thanks!

You may refer following for my setup information. GitLab: hosted on gitlab.com Sonar: localhost SonarQube, version 6.7.7 (the localhost has been exposed) Sonar-gitlab-plugin: using 3.0.2 version Addtional: I've followed readme.md guideline to configure SonarQube administration settings.

You may refer following for the gitlab-ci.yml file:

stages:
  - sonar-qube

sonar-qube:
  stage: sonar-qube
  image: maven:3.3.3-jdk-8
  variables:
    SONAR_LOGIN: 7xx22xxxxac2818de4xxxx767c7d8c3ac5c9xxx4
    SONAR_URL: https://daxxxx3.ngrok.io
  script:
    - mvn --batch-mode verify org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.gitlab.project_id=$CI_PROJECT_ID -Dsonar.branch.name=$CI_COMMIT_REF_NAME

You may refer following for the pom.xml file (I reused pom.xml file provide by this repo):

<?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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.sonarsource.parent</groupId>
    <artifactId>parent</artifactId>
    <version>40</version>
  </parent>
  <groupId>com.talanlabs</groupId>
  <artifactId>sonar-gitlab-plugin</artifactId>
  <version>3.0.2</version>
  <name>SonarQube :: GitLab Plugin</name>
  <description>GitLab Plugin for Reporting</description>
  <packaging>sonar-plugin</packaging>
  <url>https://github.com/gabrie-allaigre/sonar-gitlab-plugin</url>
  <properties>
    <java-gitlab-api.version>1.5.0</java-gitlab-api.version>
    <freemarker.version>2.3.23</freemarker.version>
    <commons-lang3.version>3.5</commons-lang3.version>

    <license.mailto>gabriel.allaigre@gmail.com</license.mailto>
    <license.owner>Talanlabs</license.owner>

    <sonar.version>6.7.7</sonar.version>
    <sonar.pluginName>GitLab</sonar.pluginName>
    <sonar.pluginClass>com.talanlabs.sonar.plugins.gitlab.GitLabPlugin</sonar.pluginClass>

    <!-- used for deployment to SonarSource Artifactory -->
    <gitRepositoryName>sonar-gitlab</gitRepositoryName>
    <!-- Release: enable publication to Bintray -->
    <artifactsToPublish>${project.groupId}:${project.artifactId}:jar</artifactsToPublish>

    <jacoco-maven-plugin.version>0.7.5.201505241946</jacoco-maven-plugin.version>
    <jacoco.ut.execution.data.file>${project.build.directory}/coverage-reports/jacoco-ut.exec
    </jacoco.ut.execution.data.file>

    <sonar.jacoco.reportPaths>${jacoco.ut.execution.data.file}</sonar.jacoco.reportPaths>
    <sonar.sourceEncoding>UTF-8</sonar.sourceEncoding>
  </properties>
  <inceptionYear>2016</inceptionYear>
  <organization>
    <name>Talanlabs</name>
    <url>http://www.talanlabs.com</url>
  </organization>
  <licenses>
    <license>
      <name>GNU LGPL 3</name>
      <url>http://www.gnu.org/licenses/lgpl.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <developers>
    <developer>
      <name>Gabriel Allaigre</name>
      <email>gabriel.allaigre@gmail.com</email>
    </developer>
  </developers>
  <contributors>
    <contributor>
      <name>Johno Crawford</name>
      <email>johno.crawford@gmail.com</email>
    </contributor>
    <contributor>
      <name>frol2103</name>
    </contributor>
    <contributor>
      <name>Sylvain Desgrais</name>
    </contributor>
    <contributor>
      <name>Thibaud Lepretre</name>
    </contributor>
    <contributor>
      <name>Alex Krevenya</name>
    </contributor>
    <contributor>
      <name>Jérôme BAROTIN</name>
    </contributor>
    <contributor>
      <name>Eugene Dubrovka</name>
    </contributor>
    <contributor>
      <name>David Marin Vaquero</name>
    </contributor>
  </contributors>
  <scm>
    <url>https://github.com/gabrie-allaigre/sonar-gitlab-plugin</url>
    <connection>scm:git:https://github.com/gabrie-allaigre/sonar-gitlab-plugin.git</connection>
  </scm>
  <ciManagement>
    <system>gitlab-ci</system>
    <url>https://gitlab.talanlabs.com/gabriel-allaigre/sonar-gitlab-plugin/builds</url>
  </ciManagement>
  <issueManagement>
    <system>github</system>
    <url>https://github.com/gabrie-allaigre/sonar-gitlab-plugin/issues</url>
  </issueManagement>
  <repositories>
    <repository>
      <id>jitpack.io</id>
      <url>https://jitpack.io</url>
    </repository>
  </repositories>
  <build>
    <plugins>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>pre-unit-test</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
            <configuration>
              <destFile>${jacoco.ut.execution.data.file}</destFile>
            </configuration>
          </execution>
          <execution>
            <id>post-unit-test</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
            <configuration>
              <dataFile>${jacoco.ut.execution.data.file}</dataFile>
              <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>org.sonarsource.sonarqube</groupId>
      <artifactId>sonar-plugin-api</artifactId>
      <version>${sonar.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.sonarqube</groupId>
      <artifactId>sonar-ws</artifactId>
      <version>${sonar.version}</version>
    </dependency>
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
      <version>2.0.3</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.github.gabrie-allaigre</groupId>
      <artifactId>java-gitlab-api</artifactId>
      <version>${java-gitlab-api.version}</version>
    </dependency>
    <dependency>
      <groupId>org.freemarker</groupId>
      <artifactId>freemarker</artifactId>
      <version>${freemarker.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>${commons-lang3.version}</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.sonarsource.sonar-packaging-maven-plugin/sonar-packaging-maven-plugin -->
    <!-- <dependency>
        <groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId>
        <artifactId>sonar-packaging-maven-plugin</artifactId>
        <version>1.18.0.372</version>
    </dependency> -->

    <!-- unit tests -->
    <dependency>
      <groupId>org.codehaus.sonar</groupId>
      <artifactId>sonar-batch</artifactId>
      <version>5.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>3.9.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>1.10.19</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.hamcrest</groupId>
          <artifactId>hamcrest-core</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.squareup.okhttp</groupId>
      <artifactId>mockwebserver</artifactId>
      <version>2.6.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>