maven + sonar, gradle + sonar
sonar installation and configuration
- Download sonar
http://downloads.sonarsource.com/sonarqube/ - Decompression sonar package for installation
- Set sonar environment variable
SONAR_HOME: “D:\sonarqube”
PATH: “%SONAR_HOME%\bin\windows-x86-64” - Start-up sonar
CMD: StartSonar
- log into sonar
http://localhost:9000/ - check issue in sonar web page
eclipse plug-in installation
- installation from “Eclipse Marketplace”
- Configuration sonar server
sonar with maven
- pom.xml fragment for sonar
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.host.url>http://localhost:9000</sonar.host.url>
<sonar.exclusions>**/*.class, **/*.groovy, src/main/java/spark/*</sonar.exclusions>
</properties>
Note: sonar uses h2 as default database
2. maven CMD for sonar
CMD: mvn sonar:sonar
3. Analyze maven project in sonar GUI
http://localhost:9000/
sonar with gradle
- build.gradle fragment for sonar
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: "sonar-runner"
group = 'com.shuai.gradle.demo'
description = 'hello gradle for demo'
sourceCompatibility = 1.7
version = '1.0'
jar {
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart',
'Implementation-Version': version
}
}
repositories { maven { url "http://scm0.access.nsn.com/nexus/content/groups/unify/" } }
dependencies {
compile group: 'commons-io', name: 'commons-io', version: '2.+'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.+'
compile group: 'commons-collections', name: 'commons-collections', version: '3.+'
testCompile group: 'junit', name: 'junit', version: '4.+'
}
sonarRunner {
sonarProperties {
property "sonar.host.url", "http://localhost:9000"
property "sonar.jdbc.url", "jdbc:h2:tcp://localhost:9092/sonar"
property "sonar.jdbc.driverClassName", "org.h2.Driver"
property "sonar.jdbc.username", "sonar"
property "sonar.jdbc.password", "sonar"
}
}
test { systemProperties 'property': 'value' }
uploadArchives {
repositories { flatDir { dirs 'repos' } }
}
- gradle CMD for sonar
CMD:
gradle build cleanEclipse -x test
gradle sonarRunner - log into sonar
http://localhost:9000/
analyze codes via sonar in eclipse
- associate with sonarQube
- analyze codes via sonar
maven + sonar, gradle + sonar的更多相关文章
- Jenkins+Gradle+Sonar进行Java项目代码分析
Jenkins+Maven+Sonar与Jenkins+Gradle+Sonar配置方法很相似,区别就是Java项目所用的编译工具不同,一个是maven,一个是gradle 使用maven编译工具的可 ...
- Maven和Gradle对比
Java世界中主要有三大构建工具:Ant.Maven和Gradle.经过几年的发展,Ant几乎销声匿迹.Maven也日薄西山,而Gradle的发展则如日中天.笔者有幸见证了Maven的没落和Gradl ...
- Java构建工具:如何用Maven,Gradle和Ant+Ivy进行依赖管理
原文来自:https://zeroturnaround.com/rebellabs/java-build-tools-how-dependency-management-works-with-mave ...
- Maven、gradle、Ant、Eclipse IDE
Maven.gradle.Ant.Eclipse IDE之间的关系 http://wenku.baidu.com/view/d33208810912a21615792910.html?from=sea ...
- Maven和Gradle
Maven和Gradle对比 Java世界中主要有三大构建工具:Ant.Maven和Gradle.经过几年的发展,Ant几乎销声匿迹.Maven也日薄西山,而Gradle的发展则如日中天.笔者有幸见证 ...
- 项目自动构建工具对比(Maven、Gradle、Ant)
Java世界中主要有三大构建工具:Ant.Maven和Gradle.经过几年的发展,Ant几乎销声匿迹.Maven也日薄西山,而Gradle的发展则如日中天. Maven的主要功能主要分为5点,分别是 ...
- Zxing 的集成 ---- Maven 对应 Gradle 的写法
Zxing 的集成 ---- Maven 对应 Gradle 的写法 刚刚想耍耍二维码,想到了zxing和zbar,又想到zxing是Google老爹的,想想就算了吧,虽然zbar快但是识别错误率也高 ...
- maven到Gradle,一些对比和分享
Gradle作为一款基于Groovy语言的构建工具,已经吸引众多的ant,maven使用者转投gradle的怀抱,和Gradle相比,ant显得冗余复杂,maven显得有些死板落后,而gradle基于 ...
- CentOS7 nexus 3 搭建maven或gradle 私有代理服务器
1.下载nexus 3, 选择与操作系统对应版本 2.解压nexus并运行: 3.在浏览器中输入http://192.168.127.128:8081/,并以amdin为用户名,以admin123为密 ...
随机推荐
- Caffe学习系列(17): blob
对于blob.h文件. 先看成员变量.定义了6个保护的成员变量,包括前.后向传播的数据,新.旧形状数据(?), 数据个数及容量. 再看成员函数.包括构造函数(4个参数),reshape(改变blob形 ...
- Selenium2+python自动化62-jenkins持续集成环境搭建【转载】
前言 selenium脚本写完之后,一般是集成到jenkins环境了,方便一键执行. 一.环境准备 小编环境: 1.win10 64位 2.JDK 1.8.0_66 3.tomcat 9.0.0.M4 ...
- 几种常见类的使用(System,Runtime,Math,Date,Calendar,Random)
一:System 1.介绍 System:类中的方法和属性都是静态的. out:标准输出,默认是控制台. in:标准输入,默认是键盘. 2.properties 获取系统属性信息:Properties ...
- 系统管理员常用的Linux命令
整理Linux的一些基本系统管理命令作为备忘 ========================================================================= 查看文 ...
- JAVA 类和对象基础知识详解
/*文章中用到的代码只是一部分,需要源码的可通过邮箱联系我 1978702969@qq.com*/ 和C++一样,JAVA也是一门面向对象的语言,其基础和核心是类和对象.而面向对象的思想是来源与显示生 ...
- android 调试Installation failed with message INSTALL_FAILED_USER_RESTRICTED: Install canceled by user.
真机调试 遇到的问题 在使用真机调试的程序的时候出现了这个问题. 解决方法如下
- 运行程序,解读this指向---case6
function Parent() { this.a = 1; this.b = [1, 2, this.a]; this.c = { ckey: 5 }; this.show = function ...
- mac那些事儿
OS是苹果公司开发的电脑操作系统,MAC是苹果公司开发的笔记本.台式机.IOS是苹果公司开发的移动操作系统,iPhone是苹果公司研发的智能手机系列,搭载IOS操作系统. 一.mac系统快捷键 回到桌 ...
- Centos 首次运行MySQL
1:启动MySQL systemctl start mysqld.service 2:查看MySQL运行状态 systemctl status mysqld.service 3:查看默认密码 grep ...
- 【BZOJ 1180】 (LCT)
1180: [CROATIAN2009]OTOCI Time Limit: 50 Sec Memory Limit: 162 MBSubmit: 1078 Solved: 662 Descript ...