| <!doctype html> |
| <!-- |
| Minimal Mistakes Jekyll Theme 4.4.1 by Michael Rose |
| Copyright 2017 Michael Rose - mademistakes.com | @mmistakes |
| Free for personal and commercial use under the MIT license |
| https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE.txt |
| --> |
| <html lang="cn" class="no-js"> |
| <head> |
| <meta charset="utf-8"> |
| |
| <!-- begin SEO --> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <title>SonarCloud集成指南 - Apache ServiceComb</title> |
| |
| |
| |
| |
| <meta name="description" content="SonarCloud集成指南"> |
| |
| |
| |
| |
| <meta name="author" content="Daniel Qian"> |
| |
| <meta property="og:locale" content="cn"> |
| <meta property="og:site_name" content="Apache ServiceComb"> |
| <meta property="og:title" content="SonarCloud集成指南"> |
| |
| |
| <link rel="canonical" href="https://github.com/pages/apache/incubator-servicecomb-website/cn/developers/sonarcloud-how-to/"> |
| <meta property="og:url" content="https://github.com/pages/apache/incubator-servicecomb-website/cn/developers/sonarcloud-how-to/"> |
| |
| |
| |
| <meta property="og:description" content="SonarCloud集成指南"> |
| |
| |
| |
| <meta name="twitter:site" content="@ServiceComb"> |
| <meta name="twitter:title" content="SonarCloud集成指南"> |
| <meta name="twitter:description" content="SonarCloud集成指南"> |
| <meta name="twitter:url" content=""> |
| |
| |
| <meta name="twitter:card" content="summary"> |
| |
| |
| |
| |
| <meta name="twitter:creator" content="@"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <script type="application/ld+json"> |
| { |
| "@context" : "http://schema.org", |
| "@type" : "Person", |
| "name" : "Apache ServiceComb", |
| "url" : "https://github.com/pages/apache/incubator-servicecomb-website", |
| "sameAs" : null |
| } |
| </script> |
| |
| |
| |
| <meta name="google-site-verification" content="HvJjNd7vvJ-yjSTHlBiIWEYxp_Hrz-PYEY5Idz9LRcA" /> |
| |
| |
| |
| |
| <!-- end SEO --> |
| |
| |
| <link href="/feed.xml" type="application/atom+xml" rel="alternate" title="Apache ServiceComb Feed"> |
| |
| <!-- http://t.co/dKP3o1e --> |
| <meta name="HandheldFriendly" content="True"> |
| <meta name="MobileOptimized" content="320"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| |
| <script> |
| document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/g, '') + ' js '; |
| </script> |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js"></script> |
| <script src="/assets/vendor/prism/prism.js"></script> |
| |
| <script type="text/javascript" async |
| src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML"> |
| </script> |
| |
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous"> |
| |
| <script src="https://www.apachecon.com/event-images/snippet.js"></script> |
| <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script> |
| <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script> |
| <!-- For all browsers --> |
| <link rel="stylesheet" href="/assets/css/main.css"> |
| <link rel="stylesheet" href="/assets/vendor/prism/prism.css"> |
| |
| <!--[if lte IE 9]> |
| <style> |
| /* old IE unsupported flexbox fixes */ |
| .greedy-nav .site-title { |
| padding-right: 3em; |
| } |
| .greedy-nav button { |
| position: absolute; |
| top: 0; |
| right: 0; |
| height: 100%; |
| } |
| </style> |
| <![endif]--> |
| |
| <meta http-equiv="cleartype" content="on"> |
| |
| <!-- start custom head snippets --> |
| |
| <!-- insert favicons. use http://realfavicongenerator.net/ --> |
| <link href="https://fonts.loli.net/css?family=Roboto:400,500,700|Source+Code+Pro" rel="stylesheet"> |
| <script src="/assets/js/custom.js"></script> |
| <!-- end custom head snippets --> |
| |
| </head> |
| |
| <body class="layout--single"> |
| |
| <!--[if lt IE 9]> |
| <div class="notice--danger align-center" style="margin: 0;">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</div> |
| <![endif]--> |
| <div class="masthead" onmouseleave="$('#childrenShow').css('display', 'none')"> |
| <div class="masthead__inner-wrap"> |
| <div class="masthead__menu"> |
| <nav id="site-nav" class="greedy-nav"> |
| |
| <a class="site-title active" href="/cn"><img src="https://www.apache.org/img/servicecomb.png"></a> |
| |
| <ul class="visible-links"> |
| |
| |
| |
| |
| |
| <li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')"> |
| |
| <a href="/cn/">首页</a> |
| |
| </li> |
| |
| |
| |
| |
| |
| |
| <li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')"> |
| |
| <a href="/cn/developers/">项目</a> |
| |
| </li> |
| |
| |
| |
| |
| |
| |
| <li class="def-nav-li" onmouseenter="$('#childrenShow').css('display', 'block')"> |
| |
| |
| |
| |
| |
| <a href="/cn/docs/users/">文档</a> |
| |
| |
| <ul id="childrenShow" class="def-children-show-cn" onmouseleave="$('#childrenShow').css('display', 'none')"> |
| |
| <li><a href="/cn/docs/getting-started/" class="">入门指南</a></li> |
| |
| <li><a href="/cn/docs/users/" class="">用户手册</a></li> |
| |
| <li><a href="/cn/slides/" class="">大咖视频</a></li> |
| |
| <li><a href="/cn/faqs/" class="">常见问题</a></li> |
| |
| </ul> |
| </li> |
| |
| |
| |
| |
| |
| |
| <li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')"> |
| |
| <a href="/cn/year-archive/">博文</a> |
| |
| </li> |
| |
| |
| |
| |
| |
| |
| <li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')"> |
| |
| <a href="/cn/release/">下载</a> |
| |
| </li> |
| |
| |
| </ul> |
| <button><div class="navicon"></div></button> |
| <ul class="hidden-links hidden"></ul> |
| <div class="nav-lang"> |
| |
| |
| |
| <a href=/developers/sonarcloud-how-to/>English</a> |
| |
| </div> |
| </nav> |
| </div> |
| </div> |
| </div> |
| |
| |
| |
| |
| |
| |
| <div id="main" role="main"> |
| |
| <div class="sidebar sticky"> |
| |
| <div class="back-to-home"><a href="/cn/">首页</a> > SonarCloud集成指南</div> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <nav class="nav__list"> |
| |
| <input id="ac-toc" name="accordion-toc" type="checkbox" /> |
| <label for="ac-toc">切换菜单</label> |
| <ul class="nav__items"> |
| |
| <li> |
| |
| |
| |
| |
| <a href="/cn/developers/"><span class="nav__sub-title nav__sub-title-with-url">项目列表</span></a> |
| |
| |
| |
| </li> |
| |
| <li> |
| |
| |
| |
| |
| <a href="/cn/developers/team/"><span class="nav__sub-title nav__sub-title-with-url">开发团队</span></a> |
| |
| |
| |
| </li> |
| |
| <li> |
| |
| |
| |
| |
| <a href="/cn/developers/contributing"><span class="nav__sub-title nav__sub-title-with-url">如何做贡献</span></a> |
| |
| |
| |
| </li> |
| |
| <li> |
| |
| |
| |
| |
| <a href="/cn/developers/becomming-a-commiter"><span class="nav__sub-title nav__sub-title-with-url">成为Committer</span></a> |
| |
| |
| |
| </li> |
| |
| <li> |
| |
| |
| |
| |
| <a href="/cn/developers/setup-develop-environment/"><span class="nav__sub-title nav__sub-title-with-url">开发环境准备</span></a> |
| |
| |
| |
| </li> |
| |
| <li> |
| |
| |
| |
| |
| <a href="/cn/developers/submit-issues/"><span class="nav__sub-title nav__sub-title-with-url">发现问题</span></a> |
| |
| |
| |
| </li> |
| |
| <li> |
| |
| |
| |
| |
| <a href="/cn/developers/submit-codes/"><span class="nav__sub-title nav__sub-title-with-url">代码提交指南</span></a> |
| |
| |
| |
| </li> |
| |
| <li> |
| |
| |
| |
| |
| <a href="/cn/developers/subscribe-mail-list/"><span class="nav__sub-title nav__sub-title-with-url">邮件列表订阅指南</span></a> |
| |
| |
| |
| </li> |
| |
| <li> |
| |
| |
| |
| |
| <a href="/cn/developers/use-jira/"><span class="nav__sub-title nav__sub-title-with-url">JIRA使用方法</span></a> |
| |
| |
| |
| </li> |
| |
| <li> |
| |
| |
| |
| |
| <a href="/cn/developers/use-gitter/"><span class="nav__sub-title nav__sub-title-with-url">Gitter 使用方法</span></a> |
| |
| |
| |
| </li> |
| |
| <li> |
| |
| |
| |
| |
| <a href="/cn/developers/setup-committer-rights/"><span class="nav__sub-title nav__sub-title-with-url">设置代码仓库写权限</span></a> |
| |
| |
| |
| </li> |
| |
| <li> |
| |
| |
| |
| |
| <a href="/cn/developers/release-guide/"><span class="nav__sub-title nav__sub-title-with-url">Servicecomb发版指南</span></a> |
| |
| |
| |
| </li> |
| |
| <li> |
| |
| |
| |
| |
| <a href="/cn/developers/release-validation-guide/"><span class="nav__sub-title nav__sub-title-with-url">ServiceComb发版验证指南</span></a> |
| |
| |
| |
| </li> |
| |
| <li> |
| |
| |
| |
| |
| <a href="/cn/developers/sonarcloud-how-to/"><span class="nav__sub-title nav__sub-title-with-url">SonarCloud集成指南</span></a> |
| |
| |
| |
| </li> |
| |
| </ul> |
| </nav> |
| |
| |
| |
| </div> |
| |
| |
| |
| <article class="page" itemscope itemtype="http://schema.org/CreativeWork"> |
| <meta itemprop="headline" content="SonarCloud集成指南"> |
| <meta itemprop="description" content="SonarCloud集成指南"> |
| |
| <meta itemprop="dateModified" content="November 15, 2019"> |
| |
| <div class="page__inner-wrap"> |
| |
| |
| <header> |
| <h1 class="page__title" itemprop="headline">SonarCloud集成指南 |
| </h1> |
| |
| </header> |
| |
| |
| |
| <section class="page__content" itemprop="text"> |
| <aside class="sidebar__right"> |
| <nav class="toc"> |
| <!-- <header><h4 class="nav__title"><i class="fa fa-file-text"></i> 在本页上</h4></header> --> |
| <ul class="toc__menu" id="markdown-toc"> |
| <li><a href="#步骤" id="markdown-toc-步骤">步骤</a> <ul> |
| <li><a href="#关于浅克隆" id="markdown-toc-关于浅克隆">关于浅克隆</a></li> |
| <li><a href="#关于pr" id="markdown-toc-关于pr">关于PR</a></li> |
| </ul> |
| </li> |
| <li><a href="#参考资料" id="markdown-toc-参考资料">参考资料</a></li> |
| </ul> |
| |
| </nav> |
| </aside> |
| |
| <p>本文向大家介绍如何在Apache ServiceComb中集成SonarCloud。</p> |
| |
| <h2 id="步骤">步骤</h2> |
| |
| <ol> |
| <li>首先你是Github的Apache组织的成员。</li> |
| <li>用你的Github账号登录 <a href="https://sonarcloud.io">sonarcloud.io</a>。</li> |
| <li>在 <a href="https://issues.apache.org/jira/projects/INFRA/">Jira Infrastructure </a> 创建一个JIRA请求在SonarCloud中创建项目,样式可参考<a href="https://issues.apache.org/jira/browse/INFRA-19444">这个</a>。在这个JIRA中要提供仓库的Github地址,project-key(在SonarCloud中唯一表示你项目的ID),作为项目Admin的Github账号,一般来说就是你自己。</li> |
| <li>等待INFRA团队替你创建项目。然后你能在SonarCloud中看到了。</li> |
| <li>根据SonarCloud中的指示修改你的<code class="language-plaintext highlighter-rouge">.travis.yml</code></li> |
| </ol> |
| |
| <h3 id="关于浅克隆">关于浅克隆</h3> |
| |
| <p>Travis<a href="https://docs.travis-ci.com/user/customizing-the-build/#git-clone-depth">默认使用浅克隆</a>,而 SonarCloud需要commit信息,因此你需要禁用浅克隆:</p> |
| |
| <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">git</span><span class="pi">:</span> |
| <span class="na">depth</span><span class="pi">:</span> <span class="no">false</span> |
| </code></pre></div></div> |
| |
| <h3 id="关于pr">关于PR</h3> |
| |
| <p>因为Travis不支持在PR中启用SonarCloud集成,因此你需要对构建脚本做类似下面的改动:</p> |
| |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="s2">"TRAVIS_PULL_REQUEST=</span><span class="nv">$TRAVIS_PULL_REQUEST</span><span class="s2">"</span> |
| <span class="k">if</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$TRAVIS_PULL_REQUEST</span><span class="s2">"</span> <span class="o">==</span> <span class="s2">"false"</span> <span class="o">]</span><span class="p">;</span> <span class="k">then |
| </span><span class="nb">echo</span> <span class="s2">"Not a pull request build, running build with sonar"</span> |
| mvn ... sonar:sonar <span class="nt">-Dsonar</span>.projectKey<span class="o">=</span><project-key> |
| <span class="k">else |
| </span><span class="nb">echo</span> <span class="s2">"Pull request build or local build"</span> |
| mvn ... |
| <span class="k">fi</span><span class="p">;</span> |
| </code></pre></div></div> |
| |
| <h2 id="参考资料">参考资料</h2> |
| |
| <ul> |
| <li><a href="https://cwiki.apache.org/confluence/display/INFRA/SonarQube+Analysis">Apache CWiki - SonarQube Analysis</a></li> |
| <li><a href="https://docs.travis-ci.com/user/sonarcloud/">Travis - SonarCloud</a></li> |
| </ul> |
| |
| |
| |
| </section> |
| |
| <footer class="page__meta"> |
| |
| |
| |
| |
| |
| </footer> |
| |
| |
| |
| |
| |
| </div> |
| |
| |
| </article> |
| |
| |
| |
| </div> |
| |
| |
| <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> |
| <div align="center" style="margin: 0 0;"> |
| <ins class="adsbygoogle" |
| style="display:block; border-bottom: initial;" |
| data-ad-client="ca-pub-7328585512091257" |
| data-ad-slot="3049671934" |
| data-ad-format="auto"></ins> |
| </div> |
| |
| <div class="page__footer"> |
| <footer> |
| <!-- start custom footer snippets --> |
| |
| <!-- end custom footer snippets --> |
| |
| <div class="container"> |
| <div class="row justify-content-md-center"> |
| |
| <div class="col"> |
| <ul> |
| <p class="header">活动</p> |
| <a class="acevent" data-format="square" data-mode="dark" data-event="random"></a> |
| </ul> |
| </div> |
| <div class="col"> |
| <ul> |
| <p class="header">资源</p> |
| <li><a href="/cn/docs/getting-started/">入门指南</a></li> |
| <li><a href="/cn/docs/users/">用户指南</a></li> |
| <li><a href="/cn/slides/">资料</a></li> |
| <li><a href="/cn/users/faq/">常见问题</a></li> |
| </ul> |
| </div> |
| <div class="col"> |
| <ul> |
| <p class="header">ASF</p> |
| <li><a href="http://www.apache.org">基金会</a></li> |
| <li><a href="http://www.apache.org/licenses/">许可证</a></li> |
| <li><a href="http://www.apache.org/events/current-event">活动</a></li> |
| <li><a href="http://www.apache.org/foundation/sponsorship.html">赞助</a></li> |
| <li><a href="http://www.apache.org/foundation/thanks.html">鸣谢</a></li> |
| </ul> |
| </div> |
| <div class="col"> |
| <ul> |
| <p class="header">贡献</p> |
| <li><a href="http://issues.apache.org/jira/browse/SCB">报告本网页问题</a></li> |
| <li><a href="https://github.com/apache/servicecomb-website/edit/master/_developers/cn/sonarcloud-how-to.md">在Github上编辑此页</a></li> |
| <li><a href="/cn/developers/submit-codes/">代码提交指南</a></li> |
| <li><a href="/cn/security">安全</a></li> |
| </ul> |
| </div> |
| <div class="col"> |
| <ul class="social-icons"> |
| <p class="header">社区</p> |
| <li> |
| <a href="mailto:dev-subscribe@servicecomb.incubator.apache.org" rel="nofollow"><span class="mail">邮件列表</span></a> |
| </li> |
| <li> |
| <a href="https://github.com/apache?q=ServiceComb" target="_blank"><span class="github">Github</span></a> |
| </li> |
| <li> |
| <a href="https://twitter.com/ServiceComb" target="_blank"><span class="twitter">Twitter</span></a> |
| </li> |
| <li> |
| <a href="/feed.xml" target="_blank"><span class="rss">Feed</span></a> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </div> |
| <div class="page__footer-bottom"> |
| <div>© 2024 Apache ServiceComb. 技术来自于 <a href="http://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div> |
| <div>All other marks mentioned may be trademarks or registered trademarks of their respective owners.</div> |
| </div> |
| |
| </footer> |
| </div> |
| |
| <script src="/assets/js/main.min.js"></script> |
| |
| |
| |
| |
| <script> |
| (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
| (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
| m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
| })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
| |
| ga('create', 'UA-101622733-1', 'auto'); |
| ga('send', 'pageview'); |
| </script> |
| |
| |
| |
| |
| |
| |
| |
| </body> |
| </html> |