Maven 连接到声纳

发布于 2024-12-05 18:00:52 字数 708 浏览 0 评论 0原文

我在本地计算机上安装了 Maven,并且正在尝试测试安装在远程机器上的声纳。

我在网上找到了一些帖子来配置 settings.xml (maven\config\settings.xml) 并附加配置文件条目...我做了但不起作用

<profile>
   <id>sonar</id>
   <activation>
      <activeByDefault>true</activeByDefault>
   </activation>
   <properties>
      <!-- SERVER ON A REMOTE HOST -->
      <sonar.host.url>http://remotebox:9000</sonar.host.url>
   </properties>
</profile>

什么是cli方式吗?我尝试了几种选择,但没有任何效果。

我尝试过: mvn sonar:sonar http://remotebox:9000

正确的语法是什么?

提前致谢。 达米安

PS.这在安装了 Maven 和声纳的远程盒子上工作得很好...我只是想在远程盒子上尝试一下我的盒子。

I have maven installed on my local machine and I'm trying to test out Sonar installed on a remote box.

I found a few post online to configure settings.xml (maven\config\settings.xml) and append a profile entry...which I did but does not work

<profile>
   <id>sonar</id>
   <activation>
      <activeByDefault>true</activeByDefault>
   </activation>
   <properties>
      <!-- SERVER ON A REMOTE HOST -->
      <sonar.host.url>http://remotebox:9000</sonar.host.url>
   </properties>
</profile>

What is the cli way? I tried several options but nothing worked.

I tried: mvn sonar:sonar http://remotebox:9000

What is the correct syntax?

Thanks in advance.
Damian

PS. this works fine on the remote box where both maven and sonar are installed...i just want to try it my box to the remote box.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

无名指的心愿 2024-12-12 18:00:52

运行声纳

mvn sonar:sonar -Dsonar.jdbc.url=jdbc:h2:tcp://ipaddr:9092/sonar -Dsonar.host.url=http://ipaddr:9000

,其中 ipaddr 是您的远程主机,似乎可以工作。

Running sonar with

mvn sonar:sonar -Dsonar.jdbc.url=jdbc:h2:tcp://ipaddr:9092/sonar -Dsonar.host.url=http://ipaddr:9000

,where ipaddr is your remote host, seems to work.

锦欢 2024-12-12 18:00:52

直到版本 5.2,除了 sonar.host.url 之外,您还必须按照 此处。这样对我有用。

配置示例

<profile>
    <id>sonar</id>
    <activation>
        <activeByDefault>true</activeByDefault>
    </activation>
    <properties>
        <!-- EXAMPLE FOR MYSQL -->
        <sonar.jdbc.url>
          jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
        </sonar.jdbc.url>
        <sonar.jdbc.username>sonar</sonar.jdbc.username>
        <sonar.jdbc.password>sonar</sonar.jdbc.password>

        <!-- optional URL to server. Default value is http://localhost:9000 -->
        <sonar.host.url>
          http://myserver:9000
        </sonar.host.url>
    </properties>
</profile>

版本 5.2 开始,这不再是必要的:

引用

扫描仪不访问数据库

这是这个新版本最大的变化:扫描仪(例如Sonar Runner)不再访问数据库,它们仅使用Web服务与服务器通信。实际上,这意味着现在可以从分析 CI 作业中删除 JDBC 连接属性:
声纳.jdbc.url,
sonar.jdbc.用户名,
sonar.jdbc.password

Up to Version 5.2 beside the sonar.host.url you also have to specify the database parameters as described here. That way it works for me.

Configuration example

<profile>
    <id>sonar</id>
    <activation>
        <activeByDefault>true</activeByDefault>
    </activation>
    <properties>
        <!-- EXAMPLE FOR MYSQL -->
        <sonar.jdbc.url>
          jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
        </sonar.jdbc.url>
        <sonar.jdbc.username>sonar</sonar.jdbc.username>
        <sonar.jdbc.password>sonar</sonar.jdbc.password>

        <!-- optional URL to server. Default value is http://localhost:9000 -->
        <sonar.host.url>
          http://myserver:9000
        </sonar.host.url>
    </properties>
</profile>

Since Version 5.2 this not not necessary anymore:

Quote:

Scanners don't access the database

This is the biggest change of this new version: scanners (e.g. Sonar Runner) no longer access the database, they only use web services to communicate with the server. In practice, this means that the JDBC connection properties can now be removed from analysis CI jobs:
sonar.jdbc.url,
sonar.jdbc.username,
sonar.jdbc.password

盛夏已如深秋| 2024-12-12 18:00:52

以下内容适用于 sonar-maven-plugin:3.2

mvn sonar:sonar -Dsonar.host.url=http://: >

Just the following works for sonar-maven-plugin:3.2:

mvn sonar:sonar -Dsonar.host.url=http://<sonarqubeserver>:<port>

简单 2024-12-12 18:00:52

问题 1

正如所解释的,您需要指定 JDBC 连接详细信息,否则 Sonar 将尝试与嵌入式 Derby 实例通信,它假设在本地主机上运行。

问题2

您使用Derby 吗?那么,Derby 的默认配置不接受远程连接,而只接受来自同一主机的连接。

SONAR-1039 问题解释了如何解决此问题,但我的建议是设置一个完整的-崩溃的数据库,例如 MySQLPostgresql

Problem 1

As explained you need to specify the JDBC connection details, otherwise Sonar will attempt to talk to the embedded Derby instance, it assumes is running on localhost.

Problem 2

Are you using Derby? Well, the default configuration of Derby does not accept remote connections, but only connections from the same host.

The SONAR-1039 issue explains how to work-around this problem, but my advise would be to setup a full-blown database such as MySQL or Postgresql.

亣腦蒛氧 2024-12-12 18:00:52

我遇到了一些问题,然后意识到,我在父 pom 上运行 mavn,而声纳配置在子 pom 中,无论如何我都想要分析报告,因此使用子 pom 运行 mvn sonar:sonar 是有效的。

I had some problem and then realized, I was running mavn on parent pom whereas sonar configuration was in a child pom, for which I wanted analysis report anyway, so running mvn sonar:sonar with child pom worked.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文