RocketMQ Console安装时报Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17错误

RocketMQ 编译Console时遇到的坑

明确1:spring-boot-starter-parent的版本2.1.3.RELEASE
明确2:项目开发中使用的RocketMQ版本,这里,我使用4.4.0,记着
是Apache项目,不是阿里的包
第一步:
打开github上下载的rocketmq-externals-master,进入到rocketmq-externals-master\rocketmq-console下面,打开如下路径rocketmq-externals-master\rocketmq-console\src\main\resources,修改为如下配置

server.contextPath=/rocketmq
server.port=8080
#spring.application.index=true
spring.application.name=rocketmq-console
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
logging.config=classpath:logback.xml
#if this value is empty,use env value rocketmq.config.namesrvAddr  NAMESRV_ADDR | now, you can set it in ops page.default localhost:9876
rocketmq.config.namesrvAddr=127.0.0.1:9876
#if you use rocketmq version < 3.5.8, rocketmq.config.isVIPChannel should be false.default true
rocketmq.config.isVIPChannel=
#rocketmq-console's data path:dashboard/monitor
rocketmq.config.dataPath=/tmp/rocketmq-console/data
#set it false if you don't want use dashboard.default true
rocketmq.config.enableDashBoardCollect=true
#set the message track trace topic if you don't want use the default one
rocketmq.config.msgTrackTopicName=

第二步:修改pom.xml,更改spring-boot-starter-parent的版本和rocketmq版本,并且删掉如下plugins

<plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-checkstyle-pluginartifactId>
                <version>2.17version>
                <executions>
                    <execution>
                        <id>validateid>
                        <phase>validatephase>
                        <configuration>
                            <excludes>src/main/resourcesexcludes>
                            <configLocation>style/rmq_checkstyle.xmlconfigLocation>
                            <encoding>UTF-8encoding>
                            <consoleOutput>trueconsoleOutput>
                            <failsOnError>truefailsOnError>
                        configuration>
                        <goals>
                            <goal>checkgoal>
                        goals>
                    execution>
                executions>
            plugin>

修改完代码如下所示:


<project 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/maven-4.0.0.xsd">
    <modelVersion>4.0.0modelVersion>
    <parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>2.1.3.RELEASEversion>
    parent>
    <groupId>org.apachegroupId>
    <artifactId>rocketmq-console-ngartifactId>
    <packaging>jarpackaging>
    <version>1.0.0version>
    <name>rocketmq-console-ngname>
    <properties>
        <project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
        <java.version>1.7java.version>
        <guava.version>16.0.1guava.version>
        <commons-digester.version>2.1commons-digester.version>
        <commons-lang.version>2.6commons-lang.version>
        <commons-io.version>2.4commons-io.version>
        <commons-cli.version>1.2commons-cli.version>
        <rocketmq.version>4.4.0-SNAPSHOTrocketmq.version>
        <surefire.version>2.19.1surefire.version>
        <aspectj.version>1.6.11aspectj.version>
        <main.basedir>${basedir}/../..main.basedir>
        <docker.image.prefix>styletangdocker.image.prefix>
    properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-webartifactId>
        dependency>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-actuatorartifactId>
        dependency>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-testartifactId>
            <scope>testscope>
        dependency>
        <dependency>
            <groupId>commons-collectionsgroupId>
            <artifactId>commons-collectionsartifactId>
            <version>3.2.2version>
        dependency>
        <dependency>
            <groupId>org.apache.rocketmqgroupId>
            <artifactId>rocketmq-toolsartifactId>
            <version>4.4.0version>
        dependency>
        <dependency>
            <groupId>org.apache.rocketmqgroupId>
            <artifactId>rocketmq-namesrvartifactId>
            <version>4.4.0version>
        dependency>
        <dependency>
            <groupId>org.apache.rocketmqgroupId>
            <artifactId>rocketmq-brokerartifactId>
            <version>4.4.0version>
        dependency>
        <dependency>
            <groupId>com.google.guavagroupId>
            <artifactId>guavaartifactId>
            <version>${guava.version}version>
        dependency>
        <dependency>
            <groupId>org.aspectjgroupId>
            <artifactId>aspectjrtartifactId>
            <version>${aspectj.version}version>
        dependency>

        <dependency>
            <groupId>org.aspectjgroupId>
            <artifactId>aspectjweaverartifactId>
            <version>${aspectj.version}version>
        dependency>
        
        <dependency>
            <groupId>cglibgroupId>
            <artifactId>cglibartifactId>
            <version>2.2.2version>
        dependency>
        <dependency>
            <groupId>org.jooqgroupId>
            <artifactId>joorartifactId>
            <version>0.9.6version>
        dependency>

    dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.bootgroupId>
                <artifactId>spring-boot-maven-pluginartifactId>
            plugin>
            <plugin>
                <groupId>com.spotifygroupId>
                <artifactId>docker-maven-pluginartifactId>
                <version>0.4.11version>
                <configuration>
                    <imageName>${docker.image.prefix}/${project.artifactId}imageName>
                    <dockerDirectory>src/main/dockerdockerDirectory>
                    <resources>
                        <resource>
                            <targetPath>/targetPath>
                            <directory>${project.build.directory}directory>
                            <include>${project.build.finalName}.jarinclude>
                        resource>
                    resources>
                    <imageTags>
                        <imageTag>${project.version}imageTag>
                        <imageTag>latestimageTag>
                    imageTags>
                configuration>
            plugin>
          
            <plugin>
                <artifactId>maven-surefire-pluginartifactId>
                <version>${surefire.version}version>
                <configuration>
                    <excludes>
                        <exclude>src/test/**exclude>
                    excludes>
                    <forkCount>1forkCount>
                    <reuseForks>truereuseForks>
                configuration>
            plugin>
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-failsafe-pluginartifactId>
                <version>2.19.1version>
                <configuration>
                    <forkCount>1forkCount>
                    <reuseForks>truereuseForks>
                    <argLine>@{failsafeArgLine}argLine>
                    <includes>
                        <include>src/test/**include>
                    includes>
                configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-testgoal>
                            <goal>verifygoal>
                        goals>
                    execution>
                executions>
            plugin>
            <plugin>
                <artifactId>maven-source-pluginartifactId>
                <version>3.0.1version>
                <executions>
                    <execution>
                        <id>attach-sourcesid>
                        <goals>
                            <goal>jargoal>
                        goals>
                    execution>
                executions>
            plugin>
            
            <plugin>
                <groupId>org.jacocogroupId>
                <artifactId>jacoco-maven-pluginartifactId>
                <version>0.7.9version>
                <executions>
                    <execution>
                        <id>default-prepare-agentid>
                        <goals>
                            <goal>prepare-agentgoal>
                        goals>
                        <configuration>
                            <destFile>${project.build.directory}/jacoco.execdestFile>
                        configuration>
                    execution>
                    <execution>
                        <id>default-prepare-agent-integrationid>
                        <phase>pre-integration-testphase>
                        <goals>
                            <goal>prepare-agent-integrationgoal>
                        goals>
                        <configuration>
                            <destFile>${project.build.directory}/jacoco-it.execdestFile>
                            <propertyName>failsafeArgLinepropertyName>
                        configuration>
                    execution>
                    <execution>
                        <id>default-reportid>
                        <goals>
                            <goal>reportgoal>
                        goals>
                    execution>
                    <execution>
                        <id>default-report-integrationid>
                        <goals>
                            <goal>report-integrationgoal>
                        goals>
                    execution>
                    <execution>
                        <id>default-checkid>
                        <goals>
                            <goal>checkgoal>
                        goals>
                        <configuration>
                            <rules>
                                
                                <rule implementation="org.jacoco.maven.RuleConfiguration">
                                    <element>BUNDLEelement>
                                    <limits>
                                        
                                        <limit implementation="org.jacoco.report.check.Limit">
                                            <counter>COMPLEXITYcounter>
                                            <value>COVEREDRATIOvalue>
                                            <minimum>0.20minimum>
                                        limit>
                                    limits>
                                rule>
                            rules>
                        configuration>
                    execution>
                executions>
            plugin>
            <plugin>
                <groupId>org.eluder.coverallsgroupId>
                <artifactId>coveralls-maven-pluginartifactId>
                <version>4.3.0version>
            plugin>
            <plugin>
                <groupId>org.codehaus.mojogroupId>
                <artifactId>findbugs-maven-pluginartifactId>
                <version>3.0.4version>
            plugin>

            
        plugins>
    build>

project>

第三步:maven编译
mvn clean package -Dmaven.test.skip=true
这时候,再target下面已经编译好jar包了,使用命令运行即可

这个问题折磨了一下午

你可能感兴趣的:(中间件)