mvn checkstyle插件:google_checks未达到

问题描述

maven checkstyle插件告诉我认情况下使用的是for new_id,d in enumerate(current_list_d,start=1): d['id'] = new_id current_list_d [{'id': 1,'name': 'Paco','age': 18},{'id': 2,'name': 'John','age': 20},{'id': 3,'name': 'Claire','age': 22}]

var node = companyhome.childByNamePath("Sites/demo/calendar"); 
var myEvent = node.createNode(new Date().getTime() + "-" + Math.round(Math.random()*10000) + ".ics","ia:calendarEvent")
myEvent.properties["ia:whereEvent"] = "Where event";
myEvent.properties["ia:descriptionEvent"] = "This is the description";
myEvent.properties["ia:whatEvent"] = "What event";


var fromDate = new Date();
var fromISODate = utils.toISO8601(fromDate);
myEvent.properties["ia:fromDate"] = fromISODate;

var toDate = new Date();
toDate.setHours(toDate.getHours() + 3);
var toISODate = utils.toISO8601(toDate);
myEvent.properties["ia:toDate"] = toISODate;


myEvent.save();
logger.warn("Created new calendar event: " + myEvent.nodeRef);

我的意思是,我没有在项目中放置任何sun_checks.xml来告诉Checkstyle插件使用此文件

因此,我想插件认情况下可以使用此文件

根据to documentation插件认具有两个可用的检查规则集:INFO] There are 5 errors reported by Checkstyle 8.29 with sun_checks.xml ruleset. sun_checks.xml

我试图更改它:

sun_checks.xml

执行google_checks.xml目标之后,它告诉我它是使用<reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>${checkstyle-plugin.version}</version> <configuration> <configLocation>google_checks.xml</configLocation> </configuration> </plugin> </plugins> </reporting> 而不是mvn checkstyle:check

sun_checks.xml

有什么想法吗?

解决方法

您正在使用<reporting>标签下的google_checks.xml。您可以像这样保留它,但是要重新标记标签,如maven.apache.org所示:插件本身并不是报告插件。但是,它的一个或几个目标或Mojos可能专门由maven-site-plugin调用,通常在站点构建生命周期中进行。

如果要使用mvn checkstyle:check目标,还需要:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>2.17</version>
            <executions>
                <execution>
                    <id>checkstyle</id>
                    <phase>validate</phase>
                    <goals>
                        <goal>check</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <configLocation>google_checks.xml</configLocation>
            </configuration>
        </plugin>
    </plugins>
</build>