【问题标题】:maven: able to execute sonar goal for "post-integration-test" but not for "site" phasemaven:能够执行“集成后测试”的声纳目标,但不能执行“站点”阶段
【发布时间】:2018-03-29 13:52:15
【问题描述】:

我们有一个用例,我们希望将声纳分析作为站点生成的一部分。也就是说,每当调用“mvn install site:site”时,我们都希望调用 sonar:sonar 以及其中的一部分。

我们尝试了以下插件配置,但在站点阶段执行声纳目标时不起作用(我们也尝试了“预站点”阶段,但效果不佳):

<build>
   <plugins>
      <plugin>
        <groupId>org.sonarsource.scanner.maven</groupId>
        <artifactId>sonar-maven-plugin</artifactId>
        <version>3.3.0.603</version>
        <executions>
          <execution>
            <id>sonar-site</id>
            <phase>site</phase>
            <goals>
              <goal>sonar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
   </plugins>
<build>

只是为了实验,当我们在上面的 sn-p 中将 &lt;phase&gt;site&lt;/phase&gt; 更改为 &lt;phase&gt;post-integration-test&lt;/phase&gt; 时,声纳目标在 IT 执行后开始执行。

sonar-maven-plugin 和 maven-site-plugin 之间的兼容性是否有问题。将不胜感激任何输入或替代方法来解决此问题。

【问题讨论】:

    标签: java maven sonarqube sonarqube-scan


    【解决方案1】:

    您将 SonarQube Maven 插件绑定到 site 阶段,但您没有执行该阶段。你通过了site:site,这意味着execute a site goal of the maven-site-plugin

    你必须执行:mvn install site

    post-integration-test 的解决方案有效,因为该阶段由install 阶段执行(或多或少)。

    阅读更多关于Maven Lifecycle Reference的信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-27
      相关资源
      最近更新 更多