声纳插件:接收 'package org.sonar.api does not exist'
Sonar Plugin: Recieving 'package org.sonar.api does not exist'
我已经编写了一个自定义插件来实现一些额外的检查,但是当我重新启动 SonarQube(使用 StartSonar.bat 文件)时,我收到以下错误:
java.lang.RuntimeException: Uncompilable source code - package org.sonar.api does not exist
我正在使用 SonarQube 版本 4.5.5,具有以下依赖项和构建插件:
<dependencies>
<dependency>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-plugin-api</artifactId>
<version>4.5.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.sonar-plugins.java</groupId>
<artifactId>sonar-java-plugin</artifactId>
<type>sonar-plugin</type>
<version>3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.sonar.sslr</groupId>
<artifactId>sslr-testing-harness</artifactId>
<version>1.19.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-packaging-maven-plugin</artifactId>
<version>1.12.1</version>
<extensions>true</extensions>
<configuration>
<pluginClass>
(my plugin class)
</pluginClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
解决方案是添加 SonarQube 父 POM,并更改声纳插件的范围 API 以编译。
我已经编写了一个自定义插件来实现一些额外的检查,但是当我重新启动 SonarQube(使用 StartSonar.bat 文件)时,我收到以下错误:
java.lang.RuntimeException: Uncompilable source code - package org.sonar.api does not exist
我正在使用 SonarQube 版本 4.5.5,具有以下依赖项和构建插件:
<dependencies>
<dependency>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-plugin-api</artifactId>
<version>4.5.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.sonar-plugins.java</groupId>
<artifactId>sonar-java-plugin</artifactId>
<type>sonar-plugin</type>
<version>3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.sonar.sslr</groupId>
<artifactId>sslr-testing-harness</artifactId>
<version>1.19.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-packaging-maven-plugin</artifactId>
<version>1.12.1</version>
<extensions>true</extensions>
<configuration>
<pluginClass>
(my plugin class)
</pluginClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
解决方案是添加 SonarQube 父 POM,并更改声纳插件的范围 API 以编译。