前提需要在项目根目录下新建sonar-project.properties文件,内容如下:

# must be unique in a given SonarQube instance
sonar.projectKey=cynomys:0.0.
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=cynomys
sonar.projectVersion=0.0. # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=.
sonar.exclusions=**/test/**,**/target/** sonar.java.source=1.8
sonar.java.target=1.8 # Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
# 项目的class文件地址
sonar.java.binaries=/root/.jenkins/workspace/e-content/e-content-controller/target/classes

pipeline脚本

node {
maven_home='/usr/local/apache-maven-3.5.4' stage('Pull Code'){ git branch: 'master', credentialsId: 'gitlab_account', url: 'http://******.git' } stage('Code Check') {
echo "代码检查!"
} stage('SonarQube analysis') {
// SonarQubeServer为系统配置的SonarQube servers的名称
withSonarQubeEnv('SonarQubeServer') {
sh '/usr/local/sonar-scanner-3.2.0.1227-linux/bin/sonar-scanner' }
} stage('Unit Test') {
echo "单元测试 !"
} stage('Compile') {
echo '编译开始'
// 暂时打包报错
sh "'$maven_home'/bin/mvn install"
} stage('Build Images') {
echo '敬请期待!' } stage('Backup'){
echo '旧版本软件包已经备份'
} stage('Delete Old war'){
echo "删除老的包"
} stage('Deploy'){
echo '部署!'
sh 'echo hello'
// sh 'scp /root/.jenkins/workspace/e-trade/e-trade-mapper/target/e-trade-mapper-1.0-SNAPSHOT.jar root@10.132.131.51:/home/guchen_test' } stage('Integration Testing') {
echo "敬请期待!"
} stage('UI Automated Testing') {
echo "敬请期待!"
} stage('Send Testing Report') {
echo "敬请期待!"
} }

pipeline+sonar的更多相关文章

  1. Jenkins Pipeline+sonar构建质量平台

    前提: Jenkins JDK 目录: 1.安装sonar插件:SonarQube Scanner for Jenkins 2.安装SonarQube 3.安装sonar-scanner ++++++ ...

  2. pipeline配置sonar和自动化

    1.sonar配置webhooks, 2.url填写jenkins的地址:http://jenkinsurl/sonarqube-webhook/ 3.前提:jenkins配置好sonar的scann ...

  3. jenkins2 pipeline 语法快速参考

    jenkins2 pipeline中常用的语法快速参考. 文章来自:http://www.ciandcd.com文中的代码来自可以从github下载: https://github.com/ciand ...

  4. 在Jenkins中使用sonar进行静态代码检查

    要解决的问题 jenkins自动构建完成后,希望能通过sonar静态代码检查生成一份报告,给与开发人员对当前代码的做一个质量评估和修改意见 1.安装并配置sonar服务器 懒得说,跟着官方文档走就行, ...

  5. [持续交付实践] pipeline使用:项目样例

    项目说明 本文将以一个微服务项目的具体pipeline样例进行脚本编写说明.一条完整的pipeline交付流水线通常会包括代码获取.单元测试.静态检查.打包部署.接口层测试.UI层测试.性能专项测试( ...

  6. Jenkins Jfrog Artifactory 以及docker下的pipeline 容器编排实践

    1. 测试环境情况: Docker主机 10.24.101.99 JFrog Artifactory 主机 (admin password) jenkinx github原始地址:https://gi ...

  7. jenkins pipeline 部署

    一.git 版本控制结合jenkins 发布 sh-4.2$ git branch sh-4.2$ git chekout master sh-4.2$ git tag v1.1 sh-4.2$ gi ...

  8. Jenkins + Pipeline 构建流水线发布

      Jenkins + Pipeline 构建流水线发布 利用Jenkins的Pipeline配置发布流水线 参考: https://jenkins.io/doc/pipeline/tour/depl ...

  9. 看到了一个pipeline例子,

    pipeline { agent any options { timestamps() } parameters { string(name: 'GIT_BRANCH', defaultValue: ...

随机推荐

  1. winform频繁刷新导致界面闪烁解决方法

    转自龙心文 原文 winform频繁刷新导致界面闪烁解决方法 一.通过对窗体和控件使用双缓冲来减少图形闪烁(当绘制图片时出现闪烁时,使用双缓冲) 对于大多数应用程序,.NET Framework 提供 ...

  2. 什么时候必须使用UI相机? 多个相机的作用原理?

    首先,要从主画布说起,maincanvas,这个有什么限制?主画布是一张默认用来绘制UI的地方,这些UI必须是系统提供的UI组件,在画面下挂一个3D物体或非UI的2D物品是不会被绘制到画布上的,但是仍 ...

  3. kaptcha验证码组件使用简介

    Kaptcha是一个基于SimpleCaptcha的验证码开源项目. 官网地址:http://code.google.com/p/kaptcha/ kaptcha的使用比较方便,只需添加jar包依赖之 ...

  4. VMWare中三种网络连接模式的区别

    VMWare中有桥接.NAT.host-only三种网络连接模式,在搭建伪分布式集群时,需要对集群的网络连接进行配置,而这一操作的前提是理解这三种网络模式的区别. 参考以下两篇文章可以更好的理解: V ...

  5. 【原】Coursera—Andrew Ng机器学习—课程笔记 Lecture 12—Support Vector Machines 支持向量机

    Lecture 12 支持向量机 Support Vector Machines 12.1 优化目标 Optimization Objective 支持向量机(Support Vector Machi ...

  6. Request.IsAuthenticated

    Original question that the answer below refers to: I have a forms based application that is giving m ...

  7. 3D Math Keynote

    [3DMathKeynote] 1.常用公式. 1)(A*B)^T = B^T*A^T.   2)(A*B)^-1 = B^-1*A^-1. 3)|A*B| = |A|*|B|. 4)|M^T|=|M ...

  8. lnline Hook初试

    简单解释下hook: 钩子(Hook),是Windows消息处理机制的一个平台,应用程序可以在上面设置子程以监视指定窗口的某种消息,而且所监视的窗口可以是其他进程所创建的.当消息到达后,在目标窗口处理 ...

  9. string.Empty与null与""

    (1)NULLnull 关键字是表示不引用任何对象的空引用的文字值.null 是引用类型变量的默认值.那么也只有引用型的变量可以为NULL,如果int i=null,的话,是不可以的,因为Int是值类 ...

  10. EZOJ #224

    传送门 分析 首先我们发现要让答案最小,或运算一定是没有用的 我们还可以发现a^b = a&(~b) 所以异或运算也没有用 于是我们只考虑否和与 我们还会得到一个性质就是没增加一个数一定会让答 ...