cd ?/export/sonar-scanner/bin &&
./sonar-scanner -e -Dsonar.host.url=http://localhost:9000 ?-Dsonar.scm.disabled=true -Dsonar.language=java -Dsonar.projectName=ai-content-adapter -Dsonar.projectVersion=1.0.0 -Dsonar.projectKey=ai-content-adapter -Dsonar.sources=/export/jenkins/workspace/ai-content-adapter -Dsonar.projectBaseDir=/export/jenkins/workspace/ai-content-adapter -Dsonar.java.binaries=target/sonar ?-Dsonar.java.binaries=src
echo "SVN版本号:${SVN_REVISION}"
git --version
export LANG="zh_CN.UTF-8"
export LC_ALL="zh_CN.UTF-8"
sonar_url=http://192.168.1.251:9000/api/pdfreport/get?componentKey=ai-content-adapter
send1=@ha.com
send2=@ha.com
send3=@ha.com
send4=@ha.com
send5=@ha.com
rm -f ${JOB_NAME}.pdf?
wget http://192.168.180.251:9000/api/pdfreport/get?componentKey=${sonar_url} -O ${JOB_NAME}.pdf
#邮件需要包含的内容写入临时文件
echo "${JOB_NAME}-第${BUILD_NUMBER}次代码扫描报告" > mail.txt
echo "项目名称 : ${JOB_NAME}" >> mail.txt
echo "构建编号 : 第${BUILD_NUMBER}次构建" >> mail.txt
#echo "代码路径 : ${SVN_URL}" >> mail.txt
echo "代码路径 : ${WORKSPACE}" >> mail.txt
echo "构建日志 : ${BUILD_URL}consoleText" >> mail.txt
echo "构建Url : ${JOB_URL}" >> mail.txt
echo "SonarQube-PDF报告下载地址 : ${sonar_url}" >> mail.txt
echo "SonarQube-PDF报告下载地址 : ${sonar_url}" >> mail.txt
#cat mail.txt ?${sonar_url} | mail -s "title" ?${send1},${send2},${send3}
sudo mail -s "=?UTF-8?B?`echo ${JOB_NAME}第${BUILD_NUMBER}次代码扫描报告 | base64`?=" ${send1},${send2},${send3},${send4},${send5} < mail.txt ?${sonar_url}
?