Maven:SonarQube:修订间差异

来自WHY42
Riguz留言 | 贡献
建立內容為「= 部署SonarQube = == Docker部署 == = Maven集成 = == DependencyCheck == == Checkstyle == == PMD == == JaCoCo == Category:Linux/Unix」的新頁面
 
Riguz留言 | 贡献
 
(未显示同一用户的2个中间版本)
第1行: 第1行:
= 部署SonarQube =
= 部署SonarQube =
== Docker部署 ==
== Docker部署 ==
<syntaxhighlight lang="bash">
dcker pull sonarqube:7.9.6-community
docker run -p 9000:9000 sonarqube:7.9.6-community
</syntaxhighlight>


== 插件安装 ==
* checkstyle
* PMD
* dependency check
* jacoco


= Maven集成 =
= Maven集成 =
== DependencyCheck ==
== DependencyCheck ==
<syntaxhighlight lang="xml">
<build>
<plugins>
    <plugin>
        <groupId>org.owasp</groupId>
        <artifactId>dependency-check-maven</artifactId>
        <version>6.3.2</version>
        <executions>
            <execution>
                <goals>
                    <goal>check</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
</plugins>
</build>
</syntaxhighlight>
<syntaxhighlight lang="bash">
./mvnw compile
./mvnw dependency-check:check -Dformats=JSON,HTML
./mvnw sonar:sonar -Dsonar.projectName=xxx \
    -Dsonar.host.url=http://localhost:9000 \
    -Dsonar.login=admin \
    -Dsonar.password=admin \
    -Dsonar.language=java \
    -Dsonar.sourceEncoding=UTF-8 \
    -Dsonar.sources=./src/main/java \
    -Dsonar.java.binaries=./target/classes \
    -Dsonar.dependencyCheck.jsonReportPath=./target/dependency-check-report.json \
    -Dsonar.dependencyCheck.htmlReportPath=./target/dependency-check-report.html
</syntaxhighlight>
== Checkstyle ==
== Checkstyle ==
== PMD ==
== PMD ==

2021年10月12日 (二) 01:22的最新版本

部署SonarQube

Docker部署

dcker pull sonarqube:7.9.6-community
docker run -p 9000:9000 sonarqube:7.9.6-community

插件安装

  • checkstyle
  • PMD
  • dependency check
  • jacoco

Maven集成

DependencyCheck

<build>
<plugins>
    <plugin>
        <groupId>org.owasp</groupId>
        <artifactId>dependency-check-maven</artifactId>
        <version>6.3.2</version>
        <executions>
            <execution>
                <goals>
                    <goal>check</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
</plugins>
</build>
./mvnw compile 
./mvnw dependency-check:check -Dformats=JSON,HTML

./mvnw sonar:sonar -Dsonar.projectName=xxx \
    -Dsonar.host.url=http://localhost:9000 \
    -Dsonar.login=admin \
    -Dsonar.password=admin \
    -Dsonar.language=java \
    -Dsonar.sourceEncoding=UTF-8 \
    -Dsonar.sources=./src/main/java \
    -Dsonar.java.binaries=./target/classes \
    -Dsonar.dependencyCheck.jsonReportPath=./target/dependency-check-report.json \
    -Dsonar.dependencyCheck.htmlReportPath=./target/dependency-check-report.html

Checkstyle

PMD

JaCoCo