请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

按照文档安装了个sonarqube,但是运行报错

报错信息如下:
No quality profiles have been found,
you probably don’t have any language plugin installed

maven的setting已配置sonar 的profile, 不知道是否还有其他配置需要?

sonarqube版本:7.9.1

setting.xml

<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <localRepository>E:workspace
epo</localRepository>

    <servers>
        <server>
            <id>My-snapshots</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
        <server>
            <id>My-releases</id>
            <username>admin</username>
            <password>admin123</password>
        </server>

        <server>
            <id>My-nexus</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
    </servers>

    <mirrors>
        <mirror>
            <id>alimaven</id>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
            <mirrorOf>central</mirrorOf>
        </mirror>
    </mirrors>


    <pluginGroups>
        <pluginGroup>org.mortbay.jetty</pluginGroup>
    </pluginGroups>

    <!-- 设定除中央仓库(repo1.maven.org/maven2/)外的其他仓库,按设定顺序进行查找. -->
    <profiles>
        <profile>
            <!-- 如有Nexus私服, 取消注释并指向正确的服务器地址.-->
            <id>My-nexus</id>
            <repositories>
                <repository>
                    <id>My-nexus</id>
                    <name>My Repository</name>
                    <url>http://ip保密:8081/nexus/repository/maven-public/</url>
                    <layout>default</layout>

                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </snapshots>

                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>My-nexus</id>
                    <name>My Plugin Repository</name>
                    <url>http://ip保密:8081/nexus/repository/maven-public/</url>
                    <layout>default</layout>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </snapshots>
                </pluginRepository>

            </pluginRepositories>
        </profile>


        <profile>
            <id>aliyun</id>
            <repositories>
                <repository>
                    <id>aliyun</id>
                    <name>aliyun private nexus</name>
                    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>aliyun</id>
                    <name>aliyun private nexus</name>
                    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>

        <profile>
            <id>sonar</id>
            <properties>
                <sonar.jdbc.url>jdbc:postgresql://ip保密/sonar</sonar.jdbc.url>
                <sonar.jdbc.driver>org.postgresql.Driver</sonar.jdbc.driver>
                <sonar.jdbc.username>sonar</sonar.jdbc.username>
                <sonar.jdbc.password>sonar</sonar.jdbc.password>
                <sonar.host.url>http://ip保密:9000</sonar.host.url>
            </properties>
        </profile>
    </profiles>

    <activeProfiles>
        <activeProfile>My-nexus</activeProfile>
    </activeProfiles>

</settings>

发现错误原因:
Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failure to find org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 in http://ip:8081/nexus/repository/maven-public/ was cached in the local repository, resolution will not be reattempted until the update interval of My-nexus has elapsed or updates are forced

但我已经删除所有的.lastUpdate文件,jar包还是无法下载

最终发现,私服里确实没有lifecycle-mapping这个jar包
没办法死活下不来,用了极端方式解决,直接去maven 仓库里把jar包下载,然后上传到了私服里

org.eclipse.m2e lifecycle-mapping 1.0.0

正在回答 回答被采纳积分+3

3回答

大目 2019-09-11 20:22:08

您好,我使用您的pom.xml,将其改成了如下内容:

其实就改了:

  1. 改了My-nexus的地址,因为我不想搭建nexus私服;

  2. 改了sonar账号密码(和我手记里的账号密码一致)

<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <localRepository>E:workspace
epo</localRepository>
    <servers>
        <server>
            <id>My-snapshots</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
        <server>
            <id>My-releases</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
        <server>
            <id>My-nexus</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
    </servers>
    <mirrors>
        <mirror>
            <id>alimaven</id>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
            <mirrorOf>central</mirrorOf>
        </mirror>
    </mirrors>
    <pluginGroups>
        <pluginGroup>org.mortbay.jetty</pluginGroup>
    </pluginGroups>
    <!-- 设定除中央仓库(repo1.maven.org/maven2/)外的其他仓库,按设定顺序进行查找. -->
    <profiles>
        <profile>
            <!-- 如有Nexus私服, 取消注释并指向正确的服务器地址.-->
            <id>My-nexus</id>
            <repositories>
                <repository>
                    <id>My-nexus</id>
                    <name>My Repository</name>
                    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                    <layout>default</layout>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>My-nexus</id>
                    <name>My Plugin Repository</name>
                    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                    <layout>default</layout>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
        <profile>
            <id>aliyun</id>
            <repositories>
                <repository>
                    <id>aliyun</id>
                    <name>aliyun private nexus</name>
                    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>aliyun</id>
                    <name>aliyun private nexus</name>
                    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
        <profile>
            <id>sonar</id>
            <properties>
                <sonar.jdbc.url>jdbc:postgresql://localhost/sonar</sonar.jdbc.url>
                <sonar.jdbc.driver>org.postgresql.Driver</sonar.jdbc.driver>
                <sonar.jdbc.username>itmuch</sonar.jdbc.username>
                <sonar.jdbc.password>itmuch</sonar.jdbc.password>
                <sonar.host.url>http://localhost:9000</sonar.host.url>
            </properties>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>My-nexus</activeProfile>
    </activeProfiles>
</settings>

然后,执行:

mvn sonar:sonar

日志如下:

➜  microservice-consumer-movie-ribbon git:(master) ✗ mvn sonar:sonar
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.itmuch.cloud:microservice-consumer-movie-ribbon:jar:0.0.1-SNAPSHOT
[WARNING] 'parent.relativePath' of POM com.itmuch.cloud:microservice-consumer-movie-ribbon:0.0.1-SNAPSHOT (/Users/reno/develop/code_mine/spring-cloud-study/2019-Spring-Cloud-Alibaba/microservice-consumer-movie-ribbon/pom.xml) points at com.itmuch.cloud:spring-cloud-alibaba-follow-me instead of org.springframework.boot:spring-boot-starter-parent, please verify your project structure @ line 11, column 11
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
.....
慕课网字数限制,所以删除...
[INFO] 3 files had no CPD blocks
[INFO] Calculating CPD for 0 files
[INFO] CPD calculation finished
[INFO] Analysis report generated in 71ms, dir size=86 KB
[INFO] Analysis report compressed in 25ms, zip size=17 KB
[INFO] Analysis report uploaded in 35ms
[INFO] ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard?id=com.itmuch.cloud%3Amicroservice-consumer-movie-ribbon
[INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
[INFO] More about the report processing at http://localhost:9000/api/ce/task?id=AW0gQjejocQAHuE-6HZg
[INFO] Analysis total time: 4.117 s
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  9.520 s
[INFO] Finished at: 2019-09-11T20:17:53+08:00
[INFO] ------------------------------------------------------------------------


并没有出现您遇到的问题。我的Maven版本是3.6.0。

------------

如果您的依赖下载不完整,可使用mvn sonar:sonar -U,这样就会自动删除.lastUpdated文件,然后重新下载依赖了。不需要手动删除的。手动删除太累了。

0 回复 有任何疑惑可以回复我~
大目 2019-09-11 19:39:09

出去打印了下东西 刚到公司。请问问题已经解决啦不?

0 回复 有任何疑惑可以回复我~
  • 提问者 qq_Cc_37 #1
    没有,,,我在想是不是要装个checkstyle插件才可以,但我的服务器貌似容量不够。再看看
    回复 有任何疑惑可以回复我~ 2019-09-11 20:00:37
大目 2019-09-11 18:51:42

您好,请提供下您SonarQube的版本,并将settings.xml的全量文件贴出来哈。

0 回复 有任何疑惑可以回复我~
  • 提问者 qq_Cc_37 #1
    sonarqube: 7.9.1
    回复 有任何疑惑可以回复我~ 2019-09-11 19:02:58
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号