简体   繁体   English

使用Maven而不是SonarRunner从Jenkins调用Java和Java语言的Sonar分析

[英]calling Sonar analysis of Java and Javascript from Jenkins using Maven not SonarRunner

I have a maven project(POM.xml) having java and Js files.I want to call sonar analysis from Jenkins.Please let me know how can I do to analyse both Java and Javascript files.I have done it for Java using sonar runner but the problem is Javascripts files are in different locations in Project directory.Hence, sonar.src=src/main/java will not work here.I think I need to go with Maven POM.xml to do the analysis as using POM.xml the project is getting build so analysis may be possible also? 我有一个包含Java和Js文件的Maven项目(POM.xml),我想从Jenkins调用声纳分析,请让我知道如何分析Java和Javascript文件。但是问题是Javascript文件位于Project目录中的不同位置。因此,sonar.src = src / main / java在这里不起作用。我认为我需要与Maven POM.xml一起使用POM.xml进行分析该项目正在构建中,因此可能进行分析吗?

1)I know using mvn sonar:sonar is possible but what I need to add in POM.xml for Sonar? 1)我知道可以使用mvn sonar:sonar,但我需要在Sonar的POM.xml中添加什么? 2)What I need to change in MAVEN settings.xml? 2)我需要在MAVEN settings.xml中进行更改吗? 3)Please let me know the exact step by step if possible. 3)如果可能,请逐步告诉我确切的信息。

Thanks in advance! 提前致谢!

You can try this here 你可以在这里试试

<project>
  ...
  <build>
    <!-- To define the plugin version in your parent POM -->
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>sonar-maven-plugin</artifactId>
          <version>2.5</version>
        </plugin>
        ...
      </plugins>
    </pluginManagement>
    <!-- To use the plugin goals in your POM or parent POM -->
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>sonar-maven-plugin</artifactId>
        <version>2.5</version>
      </plugin>
      ...
    </plugins>
  </build>
  ...
</project>

the website that has information to help you is this one here . 这里有信息可以帮助您的网站。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM