Sonar代码质量管理服务搭建并导入java项目

1、软件下载

7.4

2、软件配置

打开解压后文件conf/sonar.properties
mysql版本必须大于5.6小于8.0

#----- MySQL >=5.6 && <8.0
sonar.jdbc.url= #mysql地址
sonar.jdbc.username=root #用户名
sonar.jdbc.password=!  #密码
sonar.web.port=19001 #服务端口

因为服务会同步启动elasticsearch占用9001,所以请预留9001端口,或者重新配置es端口

3、服务启动\关闭

我的机器是linux 64位,大家可以按照自己需要选择运行命令bin\linux-x86-64\sonar.sh start | stop
首页如下,默认超管账户: admin/admin
在这里插入图片描述

4、java项目导入

1、在pom文件加入sonar插件并配置sonar profiles

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>3.9.0.2155</version>
            </plugin>

<profiles>
		<profile>
			<id>sonar</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<properties>
				<sonar.jdbc.url>
					jdbc:mysql://
				</sonar.jdbc.url>
				<sonar.jdbc.username>root</sonar.jdbc.username>
				<sonar.jdbc.password>!</sonar.jdbc.password>
				<sonar.host.url>http://10.1.41.9:19001</sonar.host.url>
			</properties>
		</profile>
	</profiles>

2、运行导入项目到sonar服务器

mvn clean install sonar:sonar

3、到平台查看项目

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

woniyu123

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值