Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
关于Jenkins中pom.xml通过maven项目运行sonarQube的问题_Maven_Jenkins_Sonarqube_Pom.xml - Fatal编程技术网

关于Jenkins中pom.xml通过maven项目运行sonarQube的问题

关于Jenkins中pom.xml通过maven项目运行sonarQube的问题,maven,jenkins,sonarqube,pom.xml,Maven,Jenkins,Sonarqube,Pom.xml,我正试图通过詹金斯来解决这个问题,但我现在遇到了一些困难。当我构建一个新作业时,我使用Maven项目,在配置中我必须给出一个pom.xml路径,但它对应什么 提前谢谢你在詹金斯的任何一份工作中,你都应该找到一份sonarqube分析的岗位 您提到的pom.xml是maven项目的pom.xml,因为有时您可以将父pom.xml放在子目录中,这是帮助jenkins找到它的方法。与其将Sonar任务添加到每个项目中,为什么不在全局级别配置Sonar为maven配置settings.xml,只需转到$

我正试图通过詹金斯来解决这个问题,但我现在遇到了一些困难。当我构建一个新作业时,我使用Maven项目,在配置中我必须给出一个pom.xml路径,但它对应什么


提前谢谢你

在詹金斯的任何一份工作中,你都应该找到一份sonarqube分析的岗位


您提到的pom.xml是maven项目的pom.xml,因为有时您可以将父pom.xml放在子目录中,这是帮助jenkins找到它的方法。

与其将Sonar任务添加到每个项目中,为什么不在全局级别配置Sonar为maven配置settings.xml,只需转到$HOME/someUser/.m2/settings.xml(如果您还没有创建它),其中包含以下内容:

<settings>
    <pluginGroups>
        <pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
    </pluginGroups>
    <profiles>
        <profile>
            <id>sonar</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <!-- Optional URL to server. Default value is http://localhost:9000 -->
                <sonar.host.url>
                  http://myserver:9000
                </sonar.host.url>
            </properties>
        </profile>
     </profiles>
</settings>
您可以在sonar官方文档中找到更多信息:


我真的不明白对不起,这个pom.xml是属于我要分析的git hub项目的pom.xml吗?或者别的什么?pom.xml是您的项目父级pom,是的。你的项目结构可以在任何地方,所以你必须精确。您好,我已经编辑了settings.xml并添加了核心。。。对于“根POM”和“目标和选项”,我在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.invoke0)(本机方法)的sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)中添加了mvn clean,但错误相同用于:java.lang.NoSuchFieldError:org.apache.maven.cli.DefaultMavenExecutionRequestBuilder.SETTINGS上的默认用户设置文件(DefaultMavenExecutionRequestBuilder.SETTINGS)(DefaultMavenExec…21更多错误:Echecála讲座des POMs
mvn clean verify sonar:sonar
 
# In some situation you may want to run sonar:sonar goal as a dedicated step. Be sure to use install as first step for multi-module projects
mvn clean install
mvn sonar:sonar
 
# Specify the version of sonar-maven-plugin instead of using the latest. See also 'How to Fix Version of Maven Plugin' below.
mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar