前提需要在项目根目录下新建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 "敬请期待!"
} }

最新文章

  1. BI建模原则和常见问题
  2. [HAOI2009]求回文串
  3. 使用HttpWebRequest和HtmlAgilityPack抓取网页(拒绝乱码,拒绝正则表达式)
  4. 移植到Windows CE 的经验
  5. 【BZOJ】2946: [Poi2000]公共串
  6. ISBN号码
  7. Berkeley DB
  8. UVa442 Matrix Chain Multiplication
  9. C++11新特性:Lambda函数(匿名函数)
  10. 【转载】 Linux用户态和内核态
  11. Ms SQL Server 约束和规则
  12. qt软键盘输入
  13. 开启、关闭数据库mysql
  14. java JDK安装
  15. HTML解析HtmlAgilityPack
  16. 神奇的 routing mesh - 每天5分钟玩转 Docker 容器技术(100)
  17. BZOJ_4006_[JLOI2015]管道连接_斯坦纳树
  18. 【转】JSON.parse() Unexpected token i in JSON at position 2 报错问题
  19. Pyqt walk 在Windows查找文件
  20. python面对对象

热门文章

  1. HTTP之URL
  2. fileinput模块可以循环一个或多个文本文件的内容
  3. TortoiseSVN文件夹及文件图标不显示解决方法(兼容Window xp、window7)
  4. Docker入门命令备份
  5. 如何降低Unity程序的Drawcall
  6. Openssl pkeyutl命令
  7. Red Hat 6.5 网络yum源的配置
  8. AspnetBoilerplate (ABP) Organization Units 组织结构管理
  9. CSS3 圆环状进度条
  10. 哈代平衡 &连锁不平衡