简体   繁体   English

无法找到不同版本的 Sonar Qube 之间的差异

[英]Unable to find differences between various versions of Sonar Qube

I have developed a custom plugin for SonarQube that contains around 20 custom rules for java by following this document.我按照本文档为 SonarQube 开发了一个自定义插件,其中包含大约 20 条 java 的自定义规则。 https://docs.sonarqube.org/display/PLUG/Writing+Custom+Java+Rules+101 https://docs.sonarqube.org/display/PLUG/Writing+Custom+Java+Rules+101

All my rules are working good in SonarQube-6.2 but only one rule is working in 7.6 and SonarQube - 7.7 is not even starting.我的所有规则在 SonarQube-6.2 中运行良好,但只有一个规则在 7.6 和 SonarQube 中运行 - 7.7 甚至没有启动。

Is there anything which I'm missing while using higher versions?使用更高版本时我有什么遗漏吗?

Below are the some of the rules which I have developed:以下是我制定的一些规则:

  1. Egyptian braces埃及牙套
  2. Always tabs, never spaces总是制表符,从不空格
  3. Correct tab indent正确的制表符缩进
  4. Indent continuation lines at least 2 tab缩进续行至少 2 个制表符
  5. 1 or Two blank lines after imports导入后 1 或 2 个空行
  6. No empty blank line at the end of a method方法末尾没有空行

Below is my pom.xml:下面是我的 pom.xml:

http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">4.0.0

<groupId>com.aaaa.bbbb</groupId>
<artifactId>sonar-custom-rules-java</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>sonar-plugin</packaging>

<name>SonarQube Java Custom Rules</name>
<description>Plugin with custom SonarQube Rules for Java used.</description>

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

    <sonar.version>6.0</sonar.version>
    <sonarjava.version>4.5.0.8398</sonarjava.version>
</properties>

<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>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>

    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>19.0</version>
    </dependency>

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

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</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-classic</artifactId>
        <version>0.9.30</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId>
            <artifactId>sonar-packaging-maven-plugin</artifactId>
            <version>1.17</version>
            <extensions>true</extensions>
            <configuration>
                <pluginKey>java-custom</pluginKey>
                <pluginName>Java Custom Rules</pluginName>
                <pluginClass>com.sonar.java.JavaRulesPlugin</pluginClass>
                <sonarLintSupported>true</sonarLintSupported>
                <sonarQubeMinVersion>5.6</sonarQubeMinVersion>
            </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>
            <executions>
                <execution>
                    <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>
                            <artifactItem>
                                <groupId>org.springframework</groupId>
                                <artifactId>spring-webmvc</artifactId>
                                <version>4.3.3.RELEASE</version>
                            </artifactItem>
                            <artifactItem>
                                <groupId>org.springframework</groupId>
                                <artifactId>spring-webmvc</artifactId>
                                <version>4.3.3.RELEASE</version>
                            </artifactItem>
                            <artifactItem>
                                <groupId>org.springframework</groupId>
                                <artifactId>spring-web</artifactId>
                                <version>4.3.3.RELEASE</version>
                            </artifactItem>
                            <artifactItem>
                                <groupId>org.springframework</groupId>
                                <artifactId>spring-context</artifactId>
                                <version>4.3.3.RELEASE</version>
                            </artifactItem>
                        </artifactItems>
                        <outputDirectory>${project.build.directory}/test-jars</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

You should compare your configuration with the one from the example, the example source code has evolved since you copied it to support new versions of SonarQube:您应该将您的配置与示例中的配置进行比较,示例源代码在您复制它以支持新版本的 SonarQube 后已经发展:

https://github.com/SonarSource/sonar-custom-rules-examples/blob/master/java-custom-rules/pom.xml https://github.com/SonarSource/sonar-custom-rules-examples/blob/master/java-custom-rules/pom.xml

Especially those versions:特别是那些版本:

<sonar.version>7.7</sonar.version>
<sonarjava.version>5.12.1.17771</sonarjava.version>

And if you still face any issue with the new build of your plugin and SonarQube that does not start, look in SonarQube logs/sonar.log and logs/web.log .如果您的插件和 SonarQube 的新版本仍然无法启动,请查看 SonarQube logs/sonar.loglogs/web.log

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM